summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-07-29 11:34:01 +0000
committerpeter <peter@FreeBSD.org>2000-07-29 11:34:01 +0000
commit1ca10015afc1d600ad8c490df4787c841e122458 (patch)
treebeb670fdbd7e3952b93d42ea7f6e76cafb2571a1 /lib
parent09f2cc343dba3b47e554adfff426f2c6761b749b (diff)
downloadFreeBSD-src-1ca10015afc1d600ad8c490df4787c841e122458.zip
FreeBSD-src-1ca10015afc1d600ad8c490df4787c841e122458.tar.gz
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. :-/
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/i386/gen/rfork_thread.S10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/i386/gen/rfork_thread.S b/lib/libc/i386/gen/rfork_thread.S
index 674f86e..2d63b67c 100644
--- a/lib/libc/i386/gen/rfork_thread.S
+++ b/lib/libc/i386/gen/rfork_thread.S
@@ -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
OpenPOWER on IntegriCloud