fix: fork: set child espat the right postion
This commit is contained in:
parent
1ca8c68cf5
commit
69686a2c91
@ -1,6 +1,7 @@
|
||||
#include "interrupts.h"
|
||||
#include "string.h"
|
||||
#include "task.h"
|
||||
#include "types.h"
|
||||
|
||||
u16 fork(void)
|
||||
{
|
||||
@ -11,6 +12,9 @@ u16 fork(void)
|
||||
child->daddy = current_task;
|
||||
current_task->child = child;
|
||||
memcpy(child->esp0, current_task->esp0, STACK_SIZE);
|
||||
u32 *daddy_esp = 0;
|
||||
asm("movl %%esp, %0" : "=m"(daddy_esp));
|
||||
child->esp = child->esp0 + (daddy_esp - current_task->esp0);
|
||||
toris();
|
||||
return current_task == child ? 0 : child->uid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user