diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-08-01 07:41:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-08-01 07:41:36 +0000 |
commit | 73eef6ca62430088ffd97b809a4a5aec3dc5299b (patch) | |
tree | 10a115d1bd4af7960d48e9d7e3d491c7c26f3627 /lib/libc/arch | |
parent | 7dffa371e27308374f15c1f63d11bef582a20f4c (diff) |
Fix the *longjmp() behaviour - it is legal to reuse a jmp_buf several times.
Gets us a working perl 5.8.
Diffstat (limited to 'lib/libc/arch')
-rw-r--r-- | lib/libc/arch/m88k/gen/_setjmp.S | 17 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/setjmp.S | 17 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/sigsetjmp.S | 17 |
3 files changed, 15 insertions, 36 deletions
diff --git a/lib/libc/arch/m88k/gen/_setjmp.S b/lib/libc/arch/m88k/gen/_setjmp.S index 393b3aefe09..d9de6a563ed 100644 --- a/lib/libc/arch/m88k/gen/_setjmp.S +++ b/lib/libc/arch/m88k/gen/_setjmp.S @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) .data - .string "$OpenBSD: _setjmp.S,v 1.5 2003/01/07 22:01:29 miod Exp $" + .string "$OpenBSD: _setjmp.S,v 1.6 2003/08/01 07:41:35 miod Exp $" #endif /* LIBC_SCCS */ #include "SYS.h" @@ -47,14 +47,13 @@ * or restored. * * For m88k, we define our jmp_buf length - * to be the size of 22 longs. <machine/setjmp.h> + * to be the size of 21 longs. <machine/setjmp.h> * The buffer's usage is as follows: * * jmp_buf[0] return address * jmp_buf[1] signal set (if used) * jmp_buf[2 to 19] r14 to r31 - * jmp_buf[20] 'used' flag - * jmp_buf[21] setjmp type + * jmp_buf[20] setjmp type * */ @@ -86,10 +85,9 @@ ENTRY(_setjmp) st r29,r2,68 st r30,r2,72 st r31,r2,76 - st r0,r2,80 /* mark environment as NOT returned (0x0) */ or r4,r0,0 /* clear r4 */ or r4,r0,U_SETJMP_SIG /* r4 now contains setjmp type */ - st r4,r2,84 /* setjmp type to _setjmp */ + st r4,r2,80 /* setjmp type to _setjmp */ jmp.n r1 /* return 0 */ or r2,r0,0 @@ -99,10 +97,7 @@ void _longjmp(jmp_buf env, int val); ENTRY(_longjmp) cmp r4,r2,r0 /* check for bad environment buffer address. */ bb1 eq,r4,2f /* if == 0, abort. */ - ld r4,r2,80 /* check if environment buffer has */ - cmp r4,r4,r0 /* already returned. */ - bb1 ne,r4,2f /* if != 0, abort. */ - ld r4,r2,84 /* check setjmp type. */ + ld r4,r2,80 /* check setjmp type. */ cmp r4,r4,U_SETJMP_SIG /* should be U_SETJMP_SIG */ bb1 ne,r4,2f /* if != U_SETJMP_SIG, abort. */ @@ -124,8 +119,6 @@ ENTRY(_longjmp) ld r29,r2,68 ld r30,r2,72 ld r31,r2,76 - or r4,r0,1 - st r4,r2,80 /* mark environment buffer as returned */ ld r1,r2,0 /* restore r1 */ bcnd.n ne0,r3,1f or r2,r3,r0 diff --git a/lib/libc/arch/m88k/gen/setjmp.S b/lib/libc/arch/m88k/gen/setjmp.S index d8a3cb4f36f..7227c0f89fb 100644 --- a/lib/libc/arch/m88k/gen/setjmp.S +++ b/lib/libc/arch/m88k/gen/setjmp.S @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) .data - .string "$OpenBSD: setjmp.S,v 1.5 2003/01/07 22:01:29 miod Exp $" + .string "$OpenBSD: setjmp.S,v 1.6 2003/08/01 07:41:35 miod Exp $" #endif /* LIBC_SCCS */ #include "SYS.h" @@ -46,14 +46,13 @@ * and a struct sigcontext, see <signal.h> * * For m88k, we define our jmp_buf length - * to be the size of 22 longs. <machine/setjmp.h> + * to be the size of 21 longs. <machine/setjmp.h> * The buffer's usage is as follows: * * jmp_buf[0] return address * jmp_buf[1] signal set (if used) * jmp_buf[2 to 19] r14 to r31 - * jmp_buf[20] 'used' flag - * jmp_buf[21] setjmp type + * jmp_buf[20] setjmp type * */ @@ -84,10 +83,9 @@ ENTRY(setjmp) st r29,r2,68 st r30,r2,72 st r31,r2,76 - st r0,r2,80 /* mark environment as NOT returned (0x0) */ or r4,r0,0 /* clear r4 */ or r4,r0,SETJMP_SIG /* r4 now contains setjmp type */ - st r4,r2,84 /* setjmp type to _setjmp */ + st r4,r2,80 /* setjmp type to _setjmp */ or r15,r1,0 /* store return address in r15 */ or r14,r2,0 /* store address of env in r14 */ bsr.n _C_LABEL(sigblock) /* r2 = sigblock(0) */ @@ -102,10 +100,7 @@ void longjmp(jmp_buf env, int retval); ENTRY(longjmp) cmp r4,r2,r0 /* check for bad environment buffer address. */ bb1 eq,r4,2f /* if == 0, abort. */ - ld r4,r2,80 /* check if environment buffer has */ - cmp r4,r4,r0 /* already returned. */ - bb1 ne,r4,2f /* if != 0, abort. */ - ld r4,r2,84 /* check setjmp type. */ + ld r4,r2,80 /* check setjmp type. */ cmp r4,r4,SETJMP_SIG /* should be SETJMP_SIG */ bb1 ne,r4,2f /* if != SETJMP_SIG, abort. */ @@ -135,8 +130,6 @@ ENTRY(longjmp) ld r3,r31,28 /* restore r3 from stack */ ld r30,r2,72 /* restore r30 */ ld r31,r2,76 /* restore r31 (sp)*/ - or r4,r0,1 - st r4,r2,80 /* mark environment buffer as returned */ ld r1,r2,0 /* restore r1 */ bcnd.n ne0,r3,1f or r2,r3,r0 diff --git a/lib/libc/arch/m88k/gen/sigsetjmp.S b/lib/libc/arch/m88k/gen/sigsetjmp.S index 87a6649b5eb..85285e7422e 100644 --- a/lib/libc/arch/m88k/gen/sigsetjmp.S +++ b/lib/libc/arch/m88k/gen/sigsetjmp.S @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) .data - .string "$OpenBSD: sigsetjmp.S,v 1.5 2003/01/07 22:01:29 miod Exp $" + .string "$OpenBSD: sigsetjmp.S,v 1.6 2003/08/01 07:41:35 miod Exp $" #endif /* LIBC_SCCS */ #include "SYS.h" @@ -46,14 +46,13 @@ * The previous signal state is restored if 'm' was non-zero. * * For m88k, we define our jmp_buf length - * to be the size of 22 longs. <machine/setjmp.h> + * to be the size of 21 longs. <machine/setjmp.h> * The buffer's usage is as follows: * * jmp_buf[0] return address * jmp_buf[1] signal set (if used) * jmp_buf[2 to 19] r14 to r31 - * jmp_buf[20] 'used' flag - * jmp_buf[21] setjmp type + * jmp_buf[20] setjmp type * */ @@ -84,10 +83,9 @@ ENTRY(sigsetjmp) st r29,r2,68 st r30,r2,72 st r31,r2,76 - st r0,r2,80 /* mark environment as NOT returned (0x0) */ or r4,r0,0 /* clear r4 */ or r4,r0,SIGSETJMP_SIG /* r4 now contains setjmp type */ - st r4,r2,84 /* setjmp type to _setjmp */ + st r4,r2,80 /* setjmp type to _setjmp */ or r15,r1,0 /* store return address in r15 */ or r14,r2,0 /* store address of env in r14 */ @@ -109,10 +107,7 @@ void siglongjmp(sigjmp_buf env, int val); ENTRY(siglongjmp) cmp r4,r2,r0 /* check for bad environment buffer address. */ bb1 eq,r4,3f /* if == 0, abort. */ - ld r4,r2,80 /* check if environment buffer has */ - cmp r4,r4,r0 /* already returned. */ - bb1 ne,r4,3f /* if != 0, abort. */ - ld r4,r2,84 /* check setjmp type. */ + ld r4,r2,80 /* check setjmp type. */ cmp r4,r4,SIGSETJMP_SIG /* should be SIGSETJMP_SIG */ bb1 ne,r4,3f /* if != SIGSETJMP_SIG, abort. */ @@ -146,8 +141,6 @@ ENTRY(siglongjmp) ld r3,r31,28 /* restore r3 from stack */ 1: ld r30,r2,72 /* restore r30 */ ld r31,r2,76 /* restore r31 (sp)*/ - or r4,r0,1 - st r4,r2,80 /* mark environment buffer as returned */ ld r1,r2,0 /* restore r1 */ bcnd.n ne0,r3,3f or r2,r3,r0 |