wip: eip saved after the interrupt
This commit is contained in:
parent
2fe4ac5ad5
commit
b3be29246e
@ -38,6 +38,10 @@ irq_common_stub:
|
|||||||
iret
|
iret
|
||||||
|
|
||||||
irq0:
|
irq0:
|
||||||
|
push eax
|
||||||
|
mov eax, [esp + 4]
|
||||||
|
mov [eip_backup], eax
|
||||||
|
pop eax
|
||||||
push 0
|
push 0
|
||||||
push 32
|
push 32
|
||||||
jmp irq_common_stub
|
jmp irq_common_stub
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
#include "time.h"
|
||||||
|
|
||||||
struct task *current_task;
|
struct task *current_task;
|
||||||
|
|
||||||
void scheduler(void)
|
void scheduler(void)
|
||||||
{
|
{
|
||||||
kprintf("camille mon bebou\n");
|
kprintf("camille mon bebou\n");
|
||||||
|
sleep(1000);
|
||||||
if (!current_task)
|
if (!current_task)
|
||||||
return;
|
return;
|
||||||
struct task *it = current_task;
|
struct task *it = current_task;
|
||||||
|
@ -34,4 +34,6 @@ switch_to_task:
|
|||||||
pop ebp
|
pop ebp
|
||||||
pop ebx
|
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
|
||||||
|
@ -3,10 +3,7 @@
|
|||||||
#include "kpanic.h"
|
#include "kpanic.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
static void set_eip(void (*fn)(void), struct task *task)
|
uint32_t eip_backup;
|
||||||
{
|
|
||||||
// TODO or not TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct task *create_task(uint8_t owner_id)
|
static struct task *create_task(uint8_t owner_id)
|
||||||
{
|
{
|
||||||
@ -30,11 +27,14 @@ void exec_fn(void (*fn)(void))
|
|||||||
if (!new_task)
|
if (!new_task)
|
||||||
kpanic("failed to create new task");
|
kpanic("failed to create new task");
|
||||||
new_task->status = RUN;
|
new_task->status = RUN;
|
||||||
|
new_task->eip = (uint32_t *)fn;
|
||||||
new_task->next = current_task;
|
new_task->next = current_task;
|
||||||
|
new_task->prev = new_task;
|
||||||
|
if (current_task) {
|
||||||
new_task->prev = current_task->prev;
|
new_task->prev = current_task->prev;
|
||||||
current_task->prev = new_task;
|
current_task->prev = new_task;
|
||||||
|
}
|
||||||
current_task = new_task;
|
current_task = new_task;
|
||||||
set_eip(fn, new_task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user