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