test2
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "../arch/system.h"
|
||||
#include "../arch/core_interrupt.h"
|
||||
#include "../arch/ioport.h"
|
||||
#include "../arch/ioapic.h"
|
||||
#include "../compiler/fix.h"
|
||||
#include "../debug/output.h"
|
||||
#include "keydecoder.h"
|
||||
@@ -106,6 +107,10 @@ void init() {
|
||||
|
||||
// Set to maximum speed & minimum delay
|
||||
setRepeatRate(SPEED_30_0CPS, DELAY_250MS);
|
||||
|
||||
IOAPIC::config(1, Core::Interrupt::KEYBOARD);
|
||||
IOAPIC::allow(1);
|
||||
PS2Controller::drainBuffer();
|
||||
}
|
||||
|
||||
bool fetch(Key &pressed) {
|
||||
|
||||
@@ -19,8 +19,8 @@ void timer(Vault& v) {
|
||||
int x, y;
|
||||
if(Core::getID() == 0) {
|
||||
v.kout.getPos(x, y);
|
||||
v.kout.setPos(65U, 0U);
|
||||
v.kout << counter++ << " " << flush;
|
||||
v.kout.setPos(65, 0);
|
||||
v.kout << counter++ << flush;
|
||||
v.kout.setPos(x, y);
|
||||
}
|
||||
|
||||
|
||||
19
main.cc
19
main.cc
@@ -121,24 +121,14 @@ extern "C" int main() {
|
||||
}
|
||||
|
||||
LAPIC::Timer::setup(1000000);
|
||||
|
||||
ApplicationProcessor::boot();
|
||||
|
||||
PS2Controller::init();
|
||||
|
||||
IOAPIC::init();
|
||||
IOAPIC::config(1, Core::Interrupt::KEYBOARD);
|
||||
IOAPIC::allow(1);
|
||||
|
||||
PS2Controller::init();
|
||||
ApplicationProcessor::boot();
|
||||
Core::Interrupt::enable();
|
||||
|
||||
LAPIC::Timer::activate();
|
||||
PS2Controller::drainBuffer();
|
||||
|
||||
DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
|
||||
|
||||
|
||||
|
||||
{
|
||||
Guarded g = Guard::enter();
|
||||
g.vault().sch.schedule();
|
||||
@@ -158,10 +148,13 @@ extern "C" int main() {
|
||||
extern "C" int main_ap() {
|
||||
DBG_VERBOSE << "CPU core " << static_cast<int>(Core::getID()) << " / LAPIC "
|
||||
<< static_cast<int>(LAPIC::getID()) << " in main_ap()" << endl;
|
||||
Core::Interrupt::enable();
|
||||
|
||||
DBG << "App CPU " << static_cast<int>(Core::getID()) << endl << flush;
|
||||
|
||||
LAPIC::Timer::setup(1000000);
|
||||
Core::Interrupt::enable();
|
||||
LAPIC::Timer::activate();
|
||||
|
||||
{
|
||||
Guarded g = Guard::enter();
|
||||
g.vault().sch.schedule();
|
||||
|
||||
@@ -27,6 +27,7 @@ void Dispatcher::go(Thread *first) {
|
||||
}
|
||||
|
||||
void Dispatcher::dispatch(Thread *next) {
|
||||
//lifePointer[Core::getID()] = next;
|
||||
lifePointer[Core::getID()]->resume(next);
|
||||
Thread* tmp = lifePointer[Core::getID()];
|
||||
lifePointer[Core::getID()] = next;
|
||||
tmp->resume(next);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,10 @@ Thread::Thread(void* tos) {
|
||||
|
||||
#include "../thread/scheduler.h"
|
||||
void Thread::resume(Thread* next) {
|
||||
Guarded g = Guard::enter();
|
||||
Context *from = &g.vault().sch.active()->context;
|
||||
Context *from = &this->context;
|
||||
Context *to = &next->context;
|
||||
|
||||
g.vault().sch.dispatcher.lifePointer[Core::getID()] = next;
|
||||
//g.vault().sch.dispatcher.lifePointer[Core::getID()] = next;
|
||||
DBG << "from: " << hex << from << endl;
|
||||
DBG << "to : " << hex << to << endl << flush;
|
||||
context_switch(to, from);
|
||||
|
||||
@@ -45,7 +45,7 @@ void Application::action() { // NOLINT
|
||||
{
|
||||
Guarded g = Guard::enter();
|
||||
//g.vault();
|
||||
g.vault().kout.setPos((unsigned)10*row,(unsigned)/*Core::getID()*2+*/1);
|
||||
g.vault().kout.setPos((unsigned)8*row,(unsigned)/*Core::getID()*2+*/1);
|
||||
g.vault().kout << cnt++ << flush;
|
||||
|
||||
//g.vault().kout << endl << flush;
|
||||
|
||||
Reference in New Issue
Block a user