diff --git a/src/interrupt/irq.s b/src/interrupt/irq.s index 6575edd..c320370 100644 --- a/src/interrupt/irq.s +++ b/src/interrupt/irq.s @@ -40,7 +40,7 @@ irq_common_stub: irq0: push eax mov eax, [esp + 4] - mov [eip_backup], eax + mov [esp_backup], esp pop eax push 0 push 32 diff --git a/src/multitasking/switch_to_task.s b/src/multitasking/switch_to_task.s index 5512de4..3194d3c 100644 --- a/src/multitasking/switch_to_task.s +++ b/src/multitasking/switch_to_task.s @@ -10,8 +10,9 @@ switch_to_task: push esi // save the current stack pointer to the old stack - mov [current_task], esp - mov edi, [eip_backup] + mov [current_task+0], esp + + mov edi, [esp_backup] // get eip mov [current_task+16], edi // save instruction before Interrupt // stack pointer + the 4 regs pushed @@ -31,7 +32,8 @@ switch_to_task: // mov cr3, ebx // TODO replace the eip store in stack by the [current_task+16](current_task->eip) - + mov edi, [current_task+16] + mov [esp_backup], edi .END: pop esi pop edi diff --git a/src/multitasking/task.c b/src/multitasking/task.c index 4a9453a..04a8c24 100644 --- a/src/multitasking/task.c +++ b/src/multitasking/task.c @@ -5,7 +5,9 @@ #include "kprintf.h" #include "memory.h" -uint32_t eip_backup; +#include + +uint32_t esp_backup; static struct task *create_task(uint8_t owner_id) {