Fix some rather interesting bugs that managed to not turn up in various
testing and real-life applications: 1) If you returned from the thread function, you got a segv instead of calling _exit() with your return code. 2) clean up some bogus stack management. There was also an underflow on function return. 3) when making syscalls, the kernel is expecting to have to leave space for the function's return address. We need to duplicate this. It was an accident that the rfork syscall actually worked here. :-/
This commit is contained in:
parent
09f2cc343d
commit
1ca10015af
@ -63,9 +63,8 @@ ENTRY(rfork_thread)
|
||||
/*
|
||||
* Prepare and execute the thread creation syscall
|
||||
*/
|
||||
pushl 12(%ebp)
|
||||
pushl 8(%ebp)
|
||||
pushl %esi
|
||||
pushl $0
|
||||
leal SYS_rfork, %eax
|
||||
KERNCALL
|
||||
jb 2f
|
||||
@ -91,16 +90,17 @@ ENTRY(rfork_thread)
|
||||
movl %esi,%esp
|
||||
popl %eax
|
||||
call *%eax
|
||||
addl $12, %esp
|
||||
addl $4, %esp
|
||||
|
||||
/*
|
||||
* Exit system call
|
||||
*/
|
||||
pushl %eax
|
||||
pushl $0
|
||||
#ifdef SYS_exit
|
||||
pushl $SYS_exit
|
||||
leal SYS_exit, %eax
|
||||
#else
|
||||
pushl $SYS_sys_exit
|
||||
leal SYS_sys_exit, %eax
|
||||
#endif
|
||||
KERNCALL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user