siglongjmp() calls __longjmp_return() also on x86, now. This resets the
signal mask as required. and also makes my recent return value fix unnecessary, since __longjmp_return() already does that. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -132,6 +132,7 @@ SEARCH_SOURCE += [ FDirName $(posixSources) string arch $(TARGET_ARCH) ] ;
|
|||||||
KernelMergeObject kernel_lib_posix_arch_$(TARGET_ARCH).o :
|
KernelMergeObject kernel_lib_posix_arch_$(TARGET_ARCH).o :
|
||||||
siglongjmp.S
|
siglongjmp.S
|
||||||
sigsetjmp.S
|
sigsetjmp.S
|
||||||
|
kernel_longjmp_return.c
|
||||||
kernel_setjmp_save_sigs.c
|
kernel_setjmp_save_sigs.c
|
||||||
arch_string.S # TODO: Not needed for X86!
|
arch_string.S # TODO: Not needed for X86!
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008, Ingo Weinhold, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*! This function is called by [sig]longjmp(). */
|
||||||
|
|
||||||
|
int __longjmp_return(jmp_buf buffer, int value);
|
||||||
|
|
||||||
|
int
|
||||||
|
__longjmp_return(jmp_buf buffer, int value)
|
||||||
|
{
|
||||||
|
return (value == 0 ? 1 : value);
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
SubDir HAIKU_TOP src system libroot posix arch x86 ;
|
SubDir HAIKU_TOP src system libroot posix arch x86 ;
|
||||||
|
|
||||||
# TODO: siglongjmp.S should use __longjmp_return to restore the signal mask.
|
|
||||||
local genericSources =
|
local genericSources =
|
||||||
setjmp_save_sigs.c
|
setjmp_save_sigs.c
|
||||||
# longjmp_return.c
|
longjmp_return.c
|
||||||
;
|
;
|
||||||
|
|
||||||
MergeObject posix_arch_$(TARGET_ARCH).o :
|
MergeObject posix_arch_$(TARGET_ARCH).o :
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
** Distributed under the terms of the Haiku License.
|
** Distributed under the terms of the Haiku License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "setjmp_internal.h"
|
#include "setjmp_internal.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -19,12 +18,6 @@ FUNCTION(_longjmp):
|
|||||||
mov 4(%esp), %ecx
|
mov 4(%esp), %ecx
|
||||||
mov 8(%esp), %eax
|
mov 8(%esp), %eax
|
||||||
|
|
||||||
/* If value is 0, setjmp() must return 1. */
|
|
||||||
test %eax, %eax
|
|
||||||
jnz 1f
|
|
||||||
mov $1, %eax
|
|
||||||
1:
|
|
||||||
|
|
||||||
// restore registers
|
// restore registers
|
||||||
mov JMP_REGS_EBX(%ecx), %ebx
|
mov JMP_REGS_EBX(%ecx), %ebx
|
||||||
mov JMP_REGS_ESI(%ecx), %esi
|
mov JMP_REGS_ESI(%ecx), %esi
|
||||||
@@ -32,8 +25,17 @@ FUNCTION(_longjmp):
|
|||||||
mov JMP_REGS_EBP(%ecx), %ebp
|
mov JMP_REGS_EBP(%ecx), %ebp
|
||||||
mov JMP_REGS_ESP(%ecx), %esp
|
mov JMP_REGS_ESP(%ecx), %esp
|
||||||
|
|
||||||
// jump back to the old program location
|
// prepare the stack so that we will return to the setjmp() program location
|
||||||
mov JMP_REGS_PC(%ecx), %edx
|
mov JMP_REGS_PC(%ecx), %edx
|
||||||
jmp *%edx
|
push %edx // return address
|
||||||
|
|
||||||
|
// let __setjmp_save_sigs deal with the signal mask and the return value
|
||||||
|
push %eax // value
|
||||||
|
push %ecx // buffer
|
||||||
|
call __longjmp_return
|
||||||
|
add $8, %esp
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
#pragma weak longjmp=siglongjmp
|
#pragma weak longjmp=siglongjmp
|
||||||
|
|||||||
Reference in New Issue
Block a user