aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/setjmp.S
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-06-29 22:55:31 +0000
committerGreg McGary <greg@mcgary.org>2000-06-29 22:55:31 +0000
commite5f88e0ca0d2762ca87263ee01d13e9950de403d (patch)
tree88f266651d99e6be69fd69c46935bfb81bf33676 /sysdeps/i386/setjmp.S
parentd3d89ab3a83ad036d7ea4794d044a1e710598fcd (diff)
downloadglibc-e5f88e0ca0d2762ca87263ee01d13e9950de403d.zip
glibc-e5f88e0ca0d2762ca87263ee01d13e9950de403d.tar.gz
glibc-e5f88e0ca0d2762ca87263ee01d13e9950de403d.tar.bz2
* sysdeps/i386/bp-asm.h (PCOFF): New constant.
(POP_ERRNO_LOCATION_RETURN): Fold insns. * sysdeps/i386/bits/setjmp.h (JB_SIZE): New constant. (PUSH_SIGNAL_MASK): New macro. * sysdeps/i386/__longjmp.S (__longjmp): Wrap symbol in BP_SYM (). LEAVE is unnecessary. Check bounds of jmp_buf. * sysdeps/i386/elf/setjmp.S: Call PUSH_SIGNAL_MASK. Wrap symbols in BP_SYM (). Check bounds of jmp_buf. Don't call LEAVE until immediately before tail-call. * sysdeps/i386/setjmp.S: Likewise. * sysdeps/i386/bsd-_setjmp.S: Likewise. * sysdeps/i386/bsd-setjmp.S: Likewise. 2000-06-29 Greg McGary <greg@mcgary.org> * sysdeps/i386/bp-asm.h (PCOFF): New constant. (POP_ERRNO_LOCATION_RETURN): Fold insns. * sysdeps/i386/bits/setjmp.h (JB_SIZE): New constant. (PUSH_SIGNAL_MASK): New macro. * sysdeps/i386/__longjmp.S (__longjmp): Wrap symbol in BP_SYM (). LEAVE is unnecessary. Check bounds of jmp_buf. * sysdeps/i386/elf/setjmp.S: Call PUSH_SIGNAL_MASK. Wrap symbols in BP_SYM (). Check bounds of jmp_buf. Don't call LEAVE until immediately before tail-call. * sysdeps/i386/setjmp.S: Likewise. * sysdeps/i386/bsd-_setjmp.S: Likewise. * sysdeps/i386/bsd-setjmp.S: Likewise.
Diffstat (limited to 'sysdeps/i386/setjmp.S')
-rw-r--r--sysdeps/i386/setjmp.S39
1 files changed, 24 insertions, 15 deletions
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 598eef7..25b7ac8 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -1,5 +1,5 @@
/* setjmp for i386.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,29 +19,38 @@
#include <sysdep.h>
#define _ASM
+#define _SETJMP_H
#include <bits/setjmp.h>
#include <asm-syntax.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
/* Binary compatibility entry point. */
-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 (__sigsetjmp)
- movl 4(%esp), %eax /* User's jmp_buf in %eax. */
+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))
+ ENTER
+
+ movl JMPBUF(%esp), %eax
+ CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE)
+
/* 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 4(%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
@@ -52,9 +61,9 @@ ENTRY (__sigsetjmp)
L(here):
popl %ecx
addl $_GLOBAL_OFFSET_TABLE_+[.-L(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))