fix: task: use 8bit represent ptr instead of 32 to fix stack ptr
This commit is contained in:
parent
69686a2c91
commit
9c89433db5
@ -14,8 +14,8 @@ enum owner { OWNER_KERNEL, OWNER_USER };
|
|||||||
#define STACK_SIZE PAGE_SIZE * 4
|
#define STACK_SIZE PAGE_SIZE * 4
|
||||||
|
|
||||||
struct task {
|
struct task {
|
||||||
u32 *esp;
|
u8 *esp;
|
||||||
u32 *esp0;
|
u8 *esp0;
|
||||||
u32 *cr3; // physical
|
u32 *cr3; // physical
|
||||||
u32 *heap; // virtual
|
u32 *heap; // virtual
|
||||||
u32 *eip;
|
u32 *eip;
|
||||||
|
@ -12,7 +12,7 @@ u16 fork(void)
|
|||||||
child->daddy = current_task;
|
child->daddy = current_task;
|
||||||
current_task->child = child;
|
current_task->child = child;
|
||||||
memcpy(child->esp0, current_task->esp0, STACK_SIZE);
|
memcpy(child->esp0, current_task->esp0, STACK_SIZE);
|
||||||
u32 *daddy_esp = 0;
|
u8 *daddy_esp;
|
||||||
asm("movl %%esp, %0" : "=m"(daddy_esp));
|
asm("movl %%esp, %0" : "=m"(daddy_esp));
|
||||||
child->esp = child->esp0 + (daddy_esp - current_task->esp0);
|
child->esp = child->esp0 + (daddy_esp - current_task->esp0);
|
||||||
toris();
|
toris();
|
||||||
|
Loading…
Reference in New Issue
Block a user