wip: eip saved after the interrupt

This commit is contained in:
0x35c 2025-01-20 14:36:43 +01:00
parent 2fe4ac5ad5
commit b3be29246e
4 changed files with 16 additions and 8 deletions

View File

@ -38,6 +38,10 @@ irq_common_stub:
iret
irq0:
push eax
mov eax, [esp + 4]
mov [eip_backup], eax
pop eax
push 0
push 32
jmp irq_common_stub

View File

@ -1,11 +1,13 @@
#include "kprintf.h"
#include "task.h"
#include "time.h"
struct task *current_task;
void scheduler(void)
{
kprintf("camille mon bebou\n");
sleep(1000);
if (!current_task)
return;
struct task *it = current_task;

View File

@ -34,4 +34,6 @@ switch_to_task:
pop ebp
pop ebx
ret // this will also change eip to the next task's instructions
push [eip_backup]
iretd // this will also change eip to the next task's instructions

View File

@ -3,10 +3,7 @@
#include "kpanic.h"
#include "memory.h"
static void set_eip(void (*fn)(void), struct task *task)
{
// TODO or not TODO
}
uint32_t eip_backup;
static struct task *create_task(uint8_t owner_id)
{
@ -30,11 +27,14 @@ void exec_fn(void (*fn)(void))
if (!new_task)
kpanic("failed to create new task");
new_task->status = RUN;
new_task->eip = (uint32_t *)fn;
new_task->next = current_task;
new_task->prev = current_task->prev;
current_task->prev = new_task;
new_task->prev = new_task;
if (current_task) {
new_task->prev = current_task->prev;
current_task->prev = new_task;
}
current_task = new_task;
set_eip(fn, new_task);
}
/*