aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/elf/setjmp.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/elf/setjmp.S')
-rw-r--r--sysdeps/i386/elf/setjmp.S55
1 files changed, 27 insertions, 28 deletions
diff --git a/sysdeps/i386/elf/setjmp.S b/sysdeps/i386/elf/setjmp.S
index e734809bf8..1d600a489f 100644
--- a/sysdeps/i386/elf/setjmp.S
+++ b/sysdeps/i386/elf/setjmp.S
@@ -21,50 +21,49 @@
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
+#include "bp-sym.h"
#include "bp-asm.h"
-#define PARMS LINKAGE /* no space for saved regs */
-#define JBUF PARMS
-#define SGMSK JBUF+PRT_SIZE
-
/* We include the BSD entry points here as well but we make
them weak. */
-ENTRY (setjmp)
- .weak C_SYMBOL_NAME (setjmp)
- popl %eax /* Pop return PC. */
- popl %ecx /* Pop jmp_buf argument. */
- pushl $1 /* Push second argument of zero. */
- pushl %ecx /* Push back first argument. */
- pushl %eax /* Push back return PC. */
+ENTRY (BP_SYM (setjmp))
+ .weak C_SYMBOL_NAME (BP_SYM (setjmp))
+ PUSH_SIGNAL_MASK (1)
/* Note that we have to use a non-exported symbol in the next
jump since otherwise gas will emit it as a jump through the
PLT which is what we cannot use here. */
jmp .Linternal_sigsetjmp
-END (setjmp)
+END (BP_SYM (setjmp))
/* Binary compatibility entry point. */
-ENTRY (_setjmp)
- .weak C_SYMBOL_NAME (_setjmp)
-ENTRY (__setjmp)
- popl %eax /* Pop return address. */
- popl %ecx /* Pop jmp_buf. */
- pushl $0 /* Push zero argument. */
- pushl %ecx /* Push jmp_buf. */
- pushl %eax /* Push back return address. */
+ENTRY (BP_SYM (_setjmp))
+ .weak C_SYMBOL_NAME (BP_SYM (_setjmp))
+ENTRY (BP_SYM (__setjmp))
+ PUSH_SIGNAL_MASK (0)
+ /* FALL THROUGH */
+
+#define PARMS LINKAGE /* no space for saved regs */
+#define JMPBUF PARMS
+#define SIGMSK JMPBUF+PTR_SIZE
+
+ENTRY (BP_SYM (__sigsetjmp))
+.Linternal_sigsetjmp = BP_SYM (__sigsetjmp)
+ ENTER
+
+ movl JMPBUF(%esp), %eax
+ CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE)
-ENTRY (__sigsetjmp)
-.Linternal_sigsetjmp = __sigsetjmp
- movl 4(%esp), %eax /* User's jmp_buf in %eax. */
/* Save registers. */
movl %ebx, (JB_BX*4)(%eax)
movl %esi, (JB_SI*4)(%eax)
movl %edi, (JB_DI*4)(%eax)
movl %ebp, (JB_BP*4)(%eax)
- leal JBUF(%esp), %ecx /* Save SP as it will be after we return. */
+ leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */
movl %ecx, (JB_SP*4)(%eax)
- movl 0(%esp), %ecx /* Save PC we are returning to now. */
+ movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
movl %ecx, (JB_PC*4)(%eax)
+ LEAVE /* pop frame pointer to prepare for tail-call. */
/* Make a tail call to __sigjmp_save; it takes the same args. */
#ifdef PIC
/* We cannot use the PLT, because it requires that %ebx be set, but
@@ -74,9 +73,9 @@ ENTRY (__sigsetjmp)
call here
here: popl %ecx
addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
- movl C_SYMBOL_NAME(__sigjmp_save@GOT)(%ecx), %ecx
+ movl C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOT)(%ecx), %ecx
jmp *%ecx
#else
- jmp __sigjmp_save
+ jmp BP_SYM (__sigjmp_save)
#endif
-END (__sigsetjmp)
+END (BP_SYM (__sigsetjmp))