From 1ca10015afc1d600ad8c490df4787c841e122458 Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 29 Jul 2000 11:34:01 +0000 Subject: [PATCH] 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. :-/ --- lib/libc/i386/gen/rfork_thread.S | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libc/i386/gen/rfork_thread.S b/lib/libc/i386/gen/rfork_thread.S index 674f86e58710..2d63b67c7d0c 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