load cr3 in dispatcher

This commit is contained in:
2026-02-16 22:49:42 +01:00
parent ef534e2ac7
commit f0bda5f466
2 changed files with 5 additions and 0 deletions

View File

@@ -10,11 +10,13 @@
Dispatcher::Dispatcher() : life(nullptr) {}
Thread *Dispatcher::active() const { return life; }
extern four_lvl_paging_t paging_tree;
void Dispatcher::go(Thread *first) {
assert(active() == nullptr);
setActive(first);
mytss.sp0 = first->StackPointer.isr;
load_cr3((void*)&paging_tree.l4);
first->go();
}
@@ -24,6 +26,7 @@ void Dispatcher::dispatch(Thread *next) {
if (current != next) {
setActive(next);
mytss.sp0 = next->StackPointer.isr;
load_cr3((void*)&paging_tree.l4);
current->resume(next);
}
}

View File

@@ -69,6 +69,7 @@ void Thread::resume(Thread *next) {
.user = 1,
.address = (uintptr_t)&next->subtable>>12
};
load_cr3((void*)&paging_tree.l4);
context_switch(&next->context, &context);
}
@@ -88,6 +89,7 @@ void Thread::go() {
.user = 1,
.address = (uintptr_t)&subtable>>12
};
load_cr3((void*)&paging_tree.l4);
context_launch(&context);
}