load cr3 in dispatcher
This commit is contained in:
@@ -10,11 +10,13 @@
|
|||||||
Dispatcher::Dispatcher() : life(nullptr) {}
|
Dispatcher::Dispatcher() : life(nullptr) {}
|
||||||
|
|
||||||
Thread *Dispatcher::active() const { return life; }
|
Thread *Dispatcher::active() const { return life; }
|
||||||
|
extern four_lvl_paging_t paging_tree;
|
||||||
|
|
||||||
void Dispatcher::go(Thread *first) {
|
void Dispatcher::go(Thread *first) {
|
||||||
assert(active() == nullptr);
|
assert(active() == nullptr);
|
||||||
setActive(first);
|
setActive(first);
|
||||||
mytss.sp0 = first->StackPointer.isr;
|
mytss.sp0 = first->StackPointer.isr;
|
||||||
|
load_cr3((void*)&paging_tree.l4);
|
||||||
first->go();
|
first->go();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ void Dispatcher::dispatch(Thread *next) {
|
|||||||
if (current != next) {
|
if (current != next) {
|
||||||
setActive(next);
|
setActive(next);
|
||||||
mytss.sp0 = next->StackPointer.isr;
|
mytss.sp0 = next->StackPointer.isr;
|
||||||
|
load_cr3((void*)&paging_tree.l4);
|
||||||
current->resume(next);
|
current->resume(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ void Thread::resume(Thread *next) {
|
|||||||
.user = 1,
|
.user = 1,
|
||||||
.address = (uintptr_t)&next->subtable>>12
|
.address = (uintptr_t)&next->subtable>>12
|
||||||
};
|
};
|
||||||
|
load_cr3((void*)&paging_tree.l4);
|
||||||
context_switch(&next->context, &context);
|
context_switch(&next->context, &context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ void Thread::go() {
|
|||||||
.user = 1,
|
.user = 1,
|
||||||
.address = (uintptr_t)&subtable>>12
|
.address = (uintptr_t)&subtable>>12
|
||||||
};
|
};
|
||||||
|
load_cr3((void*)&paging_tree.l4);
|
||||||
context_launch(&context);
|
context_launch(&context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user