setjmp() is now an assembly stub that doesn't create a stack frame but just

jump to sigsetjmp(). I'm a bit irritated that the previous version didn't
run as expected, but it now does.
This needs some more investigation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14901 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-13 17:46:40 +00:00
parent 90b6f0e5fe
commit 0c0bf02aac
5 changed files with 29 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -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 <setjmp.h>
#ifdef COMPILE_FOR_R5
# undef setjmp
#endif
int
setjmp(jmp_buf buffer)
{
return sigsetjmp(buffer, 0);
}
#pragma weak _setjmp = setjmp

View File

@ -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

View File

@ -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