From: John Hodge Date: Sun, 27 Sep 2009 03:16:20 +0000 (+0800) Subject: Fixed stack changing in SYS_CLONE X-Git-Tag: rel0.06~473 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=3f47fd7edcc581911a23ca075a463c5c8de9ab9a;p=tpg%2Facess2.git Fixed stack changing in SYS_CLONE --- diff --git a/Kernel/syscalls.c b/Kernel/syscalls.c index e6d8ed39..492c33e3 100644 --- a/Kernel/syscalls.c +++ b/Kernel/syscalls.c @@ -58,7 +58,7 @@ void SyscallHandler(tSyscallRegs *Regs) // Call clone system call ret = Proc_Clone(&err, Regs->Arg1); // Change user stack if requested - if(ret == 0 && Regs->Arg2) + if(ret == 0 && !(Regs->Arg2 & CLONE_VM)) Regs->StackPointer = Regs->Arg2; break; diff --git a/Usermode/Applications/init_src/main.c b/Usermode/Applications/init_src/main.c index 55c48012..b205e3b3 100644 --- a/Usermode/Applications/init_src/main.c +++ b/Usermode/Applications/init_src/main.c @@ -22,14 +22,13 @@ int main(int argc, char *argv[]) write(1, 13, "Hello, World!"); tid = clone(CLONE_VM, 0); + __asm__ __volatile__("xchg %%bx, %%bx"::"a"(tid)); if(tid == 0) { execve(DEFAULT_SHELL, NULL, NULL); for(;;) __asm__ __volatile__("hlt"); } - __asm__ __volatile__("xchg %%bx, %%bx"::"a"(tid)); - for(;;) sleep(); return 42;