diff --git a/src/system/libroot/posix/arch/x86/Jamfile b/src/system/libroot/posix/arch/x86/Jamfile index 921a3e0676..a2e1d411e9 100644 --- a/src/system/libroot/posix/arch/x86/Jamfile +++ b/src/system/libroot/posix/arch/x86/Jamfile @@ -1,7 +1,7 @@ SubDir HAIKU_TOP src system libroot posix arch x86 ; KernelMergeObject posix_arch_$(TARGET_ARCH).o : - setjmp.c + setjmp.S setjmp_save_sigs.c sigsetjmp.S siglongjmp.S diff --git a/src/system/libroot/posix/arch/x86/setjmp.S b/src/system/libroot/posix/arch/x86/setjmp.S new file mode 100644 index 0000000000..7ca9a69eef --- /dev/null +++ b/src/system/libroot/posix/arch/x86/setjmp.S @@ -0,0 +1,20 @@ +/* + * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "setjmp_internal.h" + + +/* int setjmp(jmp_buf buffer) */ +FUNCTION(setjmp): + pop %eax // pop argument and return pointer from stack + pop %ecx + pushl $0 // push new argument (for saveMask) and old stuff + push %ecx // back onto the stack + push %eax + jmp __sigsetjmp // let sigsetjmp() do the actual work + +#pragma weak _setjmp=setjmp + diff --git a/src/system/libroot/posix/arch/x86/setjmp.c b/src/system/libroot/posix/arch/x86/setjmp.c deleted file mode 100644 index 789748335c..0000000000 --- a/src/system/libroot/posix/arch/x86/setjmp.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. - * Distributed under the terms of the MIT License. - */ - - -#include - -#ifdef COMPILE_FOR_R5 -# undef setjmp -#endif - - -int -setjmp(jmp_buf buffer) -{ - return sigsetjmp(buffer, 0); -} - -#pragma weak _setjmp = setjmp diff --git a/src/system/libroot/posix/arch/x86/siglongjmp.S b/src/system/libroot/posix/arch/x86/siglongjmp.S index 3e3819495a..7774e61327 100644 --- a/src/system/libroot/posix/arch/x86/siglongjmp.S +++ b/src/system/libroot/posix/arch/x86/siglongjmp.S @@ -16,8 +16,8 @@ FUNCTION(siglongjmp): FUNCTION(longjmp): FUNCTION(_longjmp): - mov 4(%esp,1), %ecx - mov 8(%esp,1), %eax + mov 4(%esp), %ecx + mov 8(%esp), %eax // restore registers mov JMP_REGS_EBX(%ecx), %ebx diff --git a/src/system/libroot/posix/arch/x86/sigsetjmp.S b/src/system/libroot/posix/arch/x86/sigsetjmp.S index fa8cd4ae4f..cd91fe4c1c 100644 --- a/src/system/libroot/posix/arch/x86/sigsetjmp.S +++ b/src/system/libroot/posix/arch/x86/sigsetjmp.S @@ -1,7 +1,7 @@ -/* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ +/* + * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include "setjmp_internal.h" @@ -30,7 +30,8 @@ FUNCTION(sigsetjmp): // save stack and return address (because that's where we intend to jump to) lea 4(%esp,1), %ecx mov %ecx, JMP_REGS_ESP(%eax) - mov 0(%esp,1), %ecx + mov 0(%esp), %ecx mov %ecx, JMP_REGS_PC(%eax) jmp __setjmp_save_sigs +