aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/cpu.c
diff options
context:
space:
mode:
authorMarvin Borner2021-04-10 00:26:39 +0200
committerMarvin Borner2021-04-10 00:26:39 +0200
commit9655593d80e23d2ea3c091e3187e8e47b278bc3d (patch)
treef618723fd9d457147f4663d2d4990f69fabb2d48 /kernel/drivers/cpu.c
parenteeb88df1d501ccec4737c18dddb7ca0a1176304f (diff)
Gave procs own kernel stack (TSS)
Diffstat (limited to 'kernel/drivers/cpu.c')
-rw-r--r--kernel/drivers/cpu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/drivers/cpu.c b/kernel/drivers/cpu.c
index 5d53bef..62b0328 100644
--- a/kernel/drivers/cpu.c
+++ b/kernel/drivers/cpu.c
@@ -91,6 +91,19 @@ void fpu_restore(void)
__asm__ volatile("fxrstor (%0)" ::"r"(fpu_state));
}
+PROTECTED extern u32 tss_entry;
+void tss_set_stack(u32 ss, u32 esp)
+{
+ assert(tss_entry && ss && esp);
+ struct {
+ u32 prev;
+ u32 esp0;
+ u32 ss0;
+ } *tss = (void *)tss_entry;
+ tss->esp0 = esp;
+ tss->ss0 = ss;
+}
+
CLEAR static struct cpuid cpuid(u32 code)
{
u32 a, b, c, d;