fix: task: use 8bit represent ptr instead of 32 to fix stack ptr

This commit is contained in:
Starnakin 2025-01-29 13:30:42 +01:00
parent 69686a2c91
commit 9c89433db5
2 changed files with 3 additions and 3 deletions

View File

@ -14,8 +14,8 @@ enum owner { OWNER_KERNEL, OWNER_USER };
#define STACK_SIZE PAGE_SIZE * 4
struct task {
u32 *esp;
u32 *esp0;
u8 *esp;
u8 *esp0;
u32 *cr3; // physical
u32 *heap; // virtual
u32 *eip;

View File

@ -12,7 +12,7 @@ u16 fork(void)
child->daddy = current_task;
current_task->child = child;
memcpy(child->esp0, current_task->esp0, STACK_SIZE);
u32 *daddy_esp = 0;
u8 *daddy_esp;
asm("movl %%esp, %0" : "=m"(daddy_esp));
child->esp = child->esp0 + (daddy_esp - current_task->esp0);
toris();