From 9c5e5e91d0c984929dad72e526c9c65175d0b55a Mon Sep 17 00:00:00 2001 From: pjht Date: Mon, 11 Feb 2019 14:13:49 -0600 Subject: [PATCH] Clear interrupt stack in yield sycall --- cpu/i386/gdt.c | 4 ++++ cpu/i386/gdt.h | 1 + cpu/i386/isr.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/cpu/i386/gdt.c b/cpu/i386/gdt.c index 093645b..a7c1057 100644 --- a/cpu/i386/gdt.c +++ b/cpu/i386/gdt.c @@ -70,6 +70,10 @@ void gdt_init() { "); } +void tss_stack_reset() { + tss.esp0=int_stack_top+0xC0000000; +} + void set_entry(int i,uint32_t base,uint32_t limit,uint8_t access) { gdt[i].limit_low16=limit&0xFFFF; gdt[i].base_low16=base&0xFFFFF; diff --git a/cpu/i386/gdt.h b/cpu/i386/gdt.h index 2c244f0..fabba0b 100644 --- a/cpu/i386/gdt.h +++ b/cpu/i386/gdt.h @@ -2,5 +2,6 @@ #define GDT_H void gdt_init(); +void tss_stack_reset(); #endif diff --git a/cpu/i386/isr.c b/cpu/i386/isr.c index af95687..33abed8 100644 --- a/cpu/i386/isr.c +++ b/cpu/i386/isr.c @@ -1,5 +1,6 @@ #include "isr.h" #include "idt.h" +#include "gdt.h" #include "ports.h" #include "../halt.h" #include "../drivers/vga.h" @@ -166,6 +167,7 @@ void isr_handler(registers_t r) { break; case 80: if (r.eax==1) { + tss_stack_reset(); tasking_yield(); } else if (r.eax==2) { tasking_createTask((void*)r.ebx);