diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-01-04 00:13:12 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-01-04 00:13:12 +0000 |
commit | 22e1b9d671f63bac7d2b7b429a22549cd1ea7891 (patch) | |
tree | 4d9a27593f129014f7bd139dfcb0d1d8c5b98b7b /lib/libc | |
parent | e9c4a161098d204fb8e247bcd1d8add275b42cdb (diff) |
Fix *longjmp() return values.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/arch/m88k/gen/_setjmp.S | 36 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/setjmp.S | 34 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/sigsetjmp.S | 46 |
3 files changed, 57 insertions, 59 deletions
diff --git a/lib/libc/arch/m88k/gen/_setjmp.S b/lib/libc/arch/m88k/gen/_setjmp.S index 37b96acafea..a5f7924df52 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) .text - .string "$OpenBSD: _setjmp.S,v 1.3 2003/01/02 15:14:07 miod Exp $\0" + .string "$OpenBSD: _setjmp.S,v 1.4 2003/01/04 00:13:11 miod Exp $\0" #endif /* LIBC_SCCS */ #include "SYS.h" @@ -60,6 +60,8 @@ #include <machine/setjmp.h> +#define U_SETJMP_SIG 0x1764 + /* int _setjmp(jmp_buf env); */ @@ -86,23 +88,23 @@ ENTRY(_setjmp) st r31,r2,76 st r0,r2,80 /* mark environment as NOT returned (0x0) */ or r4,r0,0 /* clear r4 */ - or r4,r0,SETJMP_TYPE2 /* r4 now contains setjmp type */ + or r4,r0,U_SETJMP_SIG /* r4 now contains setjmp type */ st r4,r2,84 /* setjmp type to _setjmp */ - jmp.n r1 /* retrun 0 */ - or r2,r0,0 + jmp.n r1 /* return 0 */ + or r2,r0,0 /* void _longjmp(jmp_buf env, int val); */ ENTRY(_longjmp) - cmp r4,r2,0x0 /* check for bad envnvironment buffer address. */ + 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,0x0 /* already returned. */ + cmp r4,r4,r0 /* already returned. */ bb1 ne,r4,2f /* if != 0, abort. */ ld r4,r2,84 /* check setjmp type. */ - cmp r4,r4,SETJMP_TYPE2 /* should be SETJMP_TYPE2 */ - bb1 ne,r4,2f /* if != SETJMP_TYPE2, abort. */ + cmp r4,r4,U_SETJMP_SIG /* should be U_SETJMP_SIG */ + bb1 ne,r4,2f /* if != U_SETJMP_SIG, abort. */ ld r14,r2,8 /* restore registers from the environment buffer */ ld r15,r2,12 @@ -120,19 +122,17 @@ ENTRY(_longjmp) ld r27,r2,60 ld r28,r2,64 ld r29,r2,68 - ld r30,r2,72 - ld r31,r2,76 + 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 */ - cmp r2,r3,0 /* test retval for 0 */ - bb0 eq,r2,1f /* if != 0, it's ok. */ - jmp.n r1 /* and jump to it */ - or r2,r0,r3 /* but first return r3 value */ -1: jmp.n r1 - or r2,r0,1 /* return non-zero value. */ -2: - subu r31,r31,32 /* get a temporary stack */ + bcnd.n ne0,r3,1f + or r2,r3,r0 + or r2,r0,1 /* never return zero! */ +1: jmp r1 + +2: subu r31,r31,32 /* get a temporary stack */ st r1,r31,20 /* save r1 on stack (return address) */ bsr _C_LABEL(longjmperror) bsr _C_LABEL(abort) /* NO RETURN */ diff --git a/lib/libc/arch/m88k/gen/setjmp.S b/lib/libc/arch/m88k/gen/setjmp.S index 05cc041ea81..01b8f132899 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) .text - .string "$OpenBSD: setjmp.S,v 1.3 2003/01/02 15:14:07 miod Exp $\0" + .string "$OpenBSD: setjmp.S,v 1.4 2003/01/04 00:13:11 miod Exp $\0" #endif /* LIBC_SCCS */ #include "SYS.h" @@ -59,6 +59,8 @@ #include <machine/setjmp.h> +#define SETJMP_SIG 0x5824 + /* int setjmp(jmp_buf env); */ @@ -84,28 +86,28 @@ ENTRY(setjmp) st r31,r2,76 st r0,r2,80 /* mark environment as NOT returned (0x0) */ or r4,r0,0 /* clear r4 */ - or r4,r0,SETJMP_TYPE1 /* r4 now contains setjmp type */ + or r4,r0,SETJMP_SIG /* r4 now contains setjmp type */ st r4,r2,84 /* 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) */ - or r2,r0,0 + or r2,r0,0 st r2,r14,4 /* save signal set in offset 4 of env */ jmp.n r15 /* return 0 */ - or r2,r0,0 + or r2,r0,0 /* void longjmp(jmp_buf env, int retval); */ ENTRY(longjmp) - cmp r4,r2,0x0 /* check for bad envnvironment buffer address. */ + 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,0x0 /* already returned. */ + cmp r4,r4,r0 /* already returned. */ bb1 ne,r4,2f /* if != 0, abort. */ ld r4,r2,84 /* check setjmp type. */ - cmp r4,r4,SETJMP_TYPE1 /* should be SETJMP_TYPE1 */ - bb1 ne,r4,2f /* if != SETJMP_TYPE1, abort. */ + cmp r4,r4,SETJMP_SIG /* should be SETJMP_SIG */ + bb1 ne,r4,2f /* if != SETJMP_SIG, abort. */ subu r31,r31,32 /* get a temporary stack */ ld r14,r2,8 /* restore registers from the environment buffer */ @@ -128,7 +130,7 @@ ENTRY(longjmp) st r2,r31,24 /* save r2 on stack (environment) */ st r3,r31,28 /* save r3 on stack (return val) */ bsr.n _C_LABEL(sigsetmask) /* restore the signal set */ - ld r2,r2,4 + ld r2,r2,4 ld r2,r31,24 /* restore r2 from stack */ ld r3,r31,28 /* restore r3 from stack */ ld r30,r2,72 /* restore r30 */ @@ -136,14 +138,12 @@ ENTRY(longjmp) or r4,r0,1 st r4,r2,80 /* mark environment buffer as returned */ ld r1,r2,0 /* restore r1 */ - cmp r2,r3,0 /* test retval for 0 */ - bb0 eq,r2,1f /* if != 0, it's ok. */ - jmp.n r1 /* and jump to it */ - or r2,r0,r3 /* but first return r3 value */ -1: jmp.n r1 - or r2,r0,1 /* return non-zero value. */ -2: - subu r31,r31,32 /* get a temporary stack */ + bcnd.n ne0,r3,1f + or r2,r3,r0 + or r2,r0,1 /* never return zero! */ +1: jmp r1 + +2: subu r31,r31,32 /* get a temporary stack */ st r1,r31,20 /* save r1 on stack (return address) */ bsr _C_LABEL(longjmperror) bsr _C_LABEL(abort) /* NO RETURN */ diff --git a/lib/libc/arch/m88k/gen/sigsetjmp.S b/lib/libc/arch/m88k/gen/sigsetjmp.S index c489bb1c819..fca01f6f31a 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) .text - .string "$OpenBSD: sigsetjmp.S,v 1.3 2003/01/02 15:14:07 miod Exp $\0" + .string "$OpenBSD: sigsetjmp.S,v 1.4 2003/01/04 00:13:11 miod Exp $\0" #endif /* LIBC_SCCS */ #include "SYS.h" @@ -59,6 +59,8 @@ #include <machine/setjmp.h> +#define SIGSETJMP_SIG 0x582e + /* int sigsetjmp(jmp_buf env, int savemask); */ @@ -84,36 +86,35 @@ ENTRY(sigsetjmp) st r31,r2,76 st r0,r2,80 /* mark environment as NOT returned (0x0) */ or r4,r0,0 /* clear r4 */ - or r4,r0,SETJMP_TYPE3 /* r4 now contains setjmp type */ + or r4,r0,SIGSETJMP_SIG /* r4 now contains setjmp type */ st r4,r2,84 /* setjmp type to _setjmp */ or r15,r1,0 /* store return address in r15 */ or r14,r2,0 /* store address of env in r14 */ or r13,r3,0 /* store savemask in r13 */ - cmp r11,r13,0x0 /* see if sigmask == 0 */ + cmp r11,r13,r0 /* see if sigmask == 0 */ bb1.n eq,r1,1f /* skip sig stuff */ - st r0,r14,4 /* but save 0 set in offset 4 of env first */ + st r0,r14,4 /* but save 0 set in offset 4 of env first */ bsr.n _C_LABEL(sigblock) /* r2 = sigblock(savemask) */ - or r2,r0,r13 + or r2,r0,r13 st r2,r14,4 /* save signal set in offset 4 of env */ -1: - jmp.n r15 /* return 0 */ - or r2,r0,0 +1: jmp.n r15 /* return 0 */ + or r2,r0,0 /* void siglongjmp(sigjmp_buf env, int val); */ ENTRY(siglongjmp) - cmp r4,r2,0x0 /* check for bad envnvironment buffer address. */ + 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,0x0 /* already returned. */ + cmp r4,r4,r0 /* already returned. */ bb1 ne,r4,3f /* if != 0, abort. */ ld r4,r2,84 /* check setjmp type. */ - cmp r4,r4,SETJMP_TYPE3 /* should be SETJMP_TYPE3 */ - bb1 ne,r4,3f /* if != SETJMP_TYPE3, abort. */ + cmp r4,r4,SIGSETJMP_SIG /* should be SIGSETJMP_SIG */ + bb1 ne,r4,3f /* if != SIGSETJMP_SIG, abort. */ subu r31,r31,32 /* get a temporary stack */ ld r14,r2,8 /* restore registers from the environment buffer */ @@ -134,29 +135,26 @@ ENTRY(siglongjmp) ld r29,r2,68 ld r4,r2,4 /* get the sinal set from env */ - cmp r4,r4,0x0 /* if r2 == 0 then skip signal stuff */ + cmp r4,r4,r0 /* if r2 == 0 then skip signal stuff */ bb1 eq,r4,1f st r2,r31,24 /* save r2 on stack (environment) */ st r3,r31,28 /* save r3 on stack (return val) */ bsr.n _C_LABEL(sigsetmask) /* restore the signal set */ - ld r2,r2,4 + ld r2,r2,4 ld r2,r31,24 /* restore r2 from stack */ ld r3,r31,28 /* restore r3 from stack */ -1: - ld r30,r2,72 /* restore r30 */ +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 */ - cmp r2,r3,0 /* test retval for 0 */ - bb0 eq,r2,2f /* if != 0, it's ok. */ - jmp.n r1 /* and jump to it */ - or r2,r0,r3 /* but first return r3 value */ -2: jmp.n r1 - or r2,r0,1 /* return non-zero value. */ -3: - subu r31,r31,32 /* get a temporary stack */ + bcnd.n ne0,r3,3f + or r2,r3,r0 + or r2,r0,1 /* never return zero! */ +3: jmp r1 + +2: subu r31,r31,32 /* get a temporary stack */ st r1,r31,20 /* save r1 on stack (return address) */ bsr _C_LABEL(longjmperror) bsr _C_LABEL(abort) /* NO RETURN */ |