write kernel sp to tss in dispatcher

This commit is contained in:
2025-11-26 06:46:19 +01:00
parent 4ffae9e1f0
commit 3808f494af
7 changed files with 21 additions and 14 deletions

View File

@@ -1,6 +1,8 @@
// vim: set noet ts=4 sw=4:
#include "dispatcher.h"
#include "../arch/tss.h"
#include "thread.h"
#include "../arch/core.h"
#include "../debug/output.h" // IWYU pragma: keep
@@ -12,6 +14,7 @@ Thread *Dispatcher::active() const { return life; }
void Dispatcher::go(Thread *first) {
assert(active() == nullptr);
setActive(first);
mytss.sp0 = first->StackPointer.isr;
first->go();
}
@@ -20,7 +23,7 @@ void Dispatcher::dispatch(Thread *next) {
assert(current != nullptr);
if (current != next) {
setActive(next);
mytss.sp0 = next->StackPointer.isr;
current->resume(next);
}
}