From d3312c271946f0d4eddd1ef309cd12afbc4227cf Mon Sep 17 00:00:00 2001 From: eeh Date: Mon, 28 Aug 2000 00:45:59 +0000 Subject: [PATCH] Fix layout of fields in jmp_buf. [N.B. we could make JMP_BUFLEN 9 if we want.] --- lib/libc/arch/sparc64/gen/__setjmp14.S | 7 +++---- lib/libc/arch/sparc64/gen/__sigsetjmp14.S | 10 +++++----- lib/libc/arch/sparc64/gen/setjmp.S | 10 +++++----- lib/libc/arch/sparc64/gen/sigsetjmp.S | 14 +++++++------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/libc/arch/sparc64/gen/__setjmp14.S b/lib/libc/arch/sparc64/gen/__setjmp14.S index 8a80d90b9ae2..1b58c9a6346e 100644 --- a/lib/libc/arch/sparc64/gen/__setjmp14.S +++ b/lib/libc/arch/sparc64/gen/__setjmp14.S @@ -1,4 +1,4 @@ -/* $NetBSD: __setjmp14.S,v 1.2 1999/01/03 16:22:04 eeh Exp $ */ +/* $NetBSD: __setjmp14.S,v 1.3 2000/08/28 00:45:59 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -46,7 +46,7 @@ #if 0 .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93" #else - RCSID("$NetBSD: __setjmp14.S,v 1.2 1999/01/03 16:22:04 eeh Exp $") + RCSID("$NetBSD: __setjmp14.S,v 1.3 2000/08/28 00:45:59 eeh Exp $") #endif #endif /* LIBC_SCCS and not lint */ @@ -77,10 +77,9 @@ ENTRY(__setjmp14) clr %o1 /* sigprocmask(SIG_BLOCK, (sigset_t *)NULL, (sigset_t *)a) */ t ST_SYSCALL - st %o0, [%o3 + 0x04] /* sc.sc_mask = current mask; */ mov SYS___sigaltstack14, %g1 clr %o0 /* sigstack(NULL, &foo) */ - add %o2, 8, %o1 /* (foo being at the bottom of the stack) */ + add %o3, 8, %o1 /* (foo being part of the sigcontext we're overwriting) */ t ST_SYSCALL lduw [%o3 + 8 + 0x10], %o0 /* foo.ss_flags */ diff --git a/lib/libc/arch/sparc64/gen/__sigsetjmp14.S b/lib/libc/arch/sparc64/gen/__sigsetjmp14.S index 28837044122d..b4e4047af2dd 100644 --- a/lib/libc/arch/sparc64/gen/__sigsetjmp14.S +++ b/lib/libc/arch/sparc64/gen/__sigsetjmp14.S @@ -1,4 +1,4 @@ -/* $NetBSD: __sigsetjmp14.S,v 1.3 2000/07/21 03:14:15 eeh Exp $ */ +/* $NetBSD: __sigsetjmp14.S,v 1.4 2000/08/28 00:45:59 eeh Exp $ */ /* * Copyright (c) 1995 Paul Kranenburg * All rights reserved. @@ -37,7 +37,7 @@ ENTRY(__sigsetjmp14) PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE cmp %o1,0 - st %o1,[%o0+0x38] ! jmpbuf[JBLEN] + st %o1,[%o0+0x48] ! jmpbuf[JBLEN] bne,a 1f ldx [%g1+_C_LABEL(__setjmp14)], %g1 ! if (%o1 != 0) goto _setjmp; ldx [%g1+_C_LABEL(_setjmp)], %g1 ! else goto __setjmp; @@ -47,7 +47,7 @@ ENTRY(__sigsetjmp14) ENTRY(__siglongjmp14) PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE - ld [%o0+0x38],%o2 ! jmpbuf[JBLEN] + ld [%o0+0x48],%o2 ! jmpbuf[JBLEN] cmp %o2,0 bne,a 1f ldx [%g1+_C_LABEL(__longjmp14)], %g1 ! if (%g2 != 0) goto _longjmp; @@ -62,12 +62,12 @@ ENTRY(__siglongjmp14) ENTRY(__sigsetjmp14) cmp %o1,0 be _C_LABEL(_setjmp) - st %o1,[%o0+0x38] ! jmpbuf[JBLEN] + st %o1,[%o0+0x48] ! jmpbuf[JBLEN] ba,a _C_LABEL(__setjmp14) unimp 0 ENTRY(__siglongjmp14) - ld [%o0+0x38],%g1 + ld [%o0+0x48],%g1 cmp %g1,0 be _C_LABEL(_longjmp) nop diff --git a/lib/libc/arch/sparc64/gen/setjmp.S b/lib/libc/arch/sparc64/gen/setjmp.S index 451208a35a8d..1c4d7a27470d 100644 --- a/lib/libc/arch/sparc64/gen/setjmp.S +++ b/lib/libc/arch/sparc64/gen/setjmp.S @@ -1,4 +1,4 @@ -/* $NetBSD: setjmp.S,v 1.3 1998/10/08 02:27:59 eeh Exp $ */ +/* $NetBSD: setjmp.S,v 1.4 2000/08/28 00:45:59 eeh Exp $ */ /* * Copyright (c) 1992, 1993 @@ -46,7 +46,7 @@ #if 0 .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93" #else - RCSID("$NetBSD: setjmp.S,v 1.3 1998/10/08 02:27:59 eeh Exp $") + RCSID("$NetBSD: setjmp.S,v 1.4 2000/08/28 00:45:59 eeh Exp $") #endif #endif /* LIBC_SCCS and not lint */ @@ -71,7 +71,7 @@ ENTRY(setjmp) * won't be filled out till later anyway. */ mov %o0, %o3 /* Save our jmp_buf in %o3 */ - add %o0, 0x38, %o2 /* build sigcontext in [%o2]->sc.sc_mask */ + mov %o0, %o2 /* build sigcontext in [%o2] */ mov 1, %o0 /* SIG_BLOCK */ mov SYS_compat_13_sigprocmask13, %g1 clr %o1 /* sigprocmask(SIG_BLOCK, (sigset_t *)NULL, (sigset_t *)a) */ @@ -80,10 +80,10 @@ ENTRY(setjmp) st %o0, [%o3 + 0x04] /* sc.sc_mask = current mask; */ mov SYS___sigaltstack14, %g1 clr %o0 /* sigstack(NULL, &foo) */ - add %o2, 8, %o1 /* (foo being at the bottom of the stack) */ + add %o3, 0x38, %o1 /* (foo being the sigcontext14 sc_mask) */ t ST_SYSCALL - lduw [%o3 + 8 + 0x10], %o0 /* foo.ss_flags */ + lduw [%o3 + 0x38+0x10], %o0 /* foo.ss_flags */ and %o0, 1, %o1 /* onstack = foo.ss_flags & 1; */ st %o0, [%o3 + 0x00] /* sc.sc_onstack = current onstack; */ stx %sp, [%o3 + 0x08] /* sc.sc_sp = sp (both ours and caller's) */ diff --git a/lib/libc/arch/sparc64/gen/sigsetjmp.S b/lib/libc/arch/sparc64/gen/sigsetjmp.S index 7b1829c407b9..4a2fc47c47eb 100644 --- a/lib/libc/arch/sparc64/gen/sigsetjmp.S +++ b/lib/libc/arch/sparc64/gen/sigsetjmp.S @@ -1,4 +1,4 @@ -/* $NetBSD: sigsetjmp.S,v 1.4 2000/07/21 03:14:15 eeh Exp $ */ +/* $NetBSD: sigsetjmp.S,v 1.5 2000/08/28 00:45:59 eeh Exp $ */ /* * Copyright (c) 1995 Paul Kranenburg * All rights reserved. @@ -39,17 +39,17 @@ ENTRY(sigsetjmp) set _C_LABEL(setjmp), %o2 ! if (%o1 != 0) goto _setjmp; set _C_LABEL(_setjmp), %o3 ! else goto __setjmp; movrnz %o1, %o2, %o3 - ldx [%g1+%o2], %g1 + ldx [%g1+%o3], %g1 jmp %g1 - st %o1,[%o0+0x38] ! jmpbuf[JBLEN] + st %o1,[%o0+0x48] ! jmpbuf[JBLEN] ENTRY(siglongjmp) PIC_PROLOGUE(%g1,%o2) ! %g1 = _GLOBAL_OFFSET_TABLE - ld [%o0 + 0x38],%o2 ! jmpbuf[JBLEN] + ld [%o0 + 0x48],%o2 ! jmpbuf[JBLEN] set _C_LABEL(longjmp), %o3 ! if (%o2 != 0) goto _longjmp; set _C_LABEL(_longjmp), %o4 ! else goto __longjmp; - movrz %o2, %o3, %o4 + movrnz %o2, %o3, %o4 ldx [%g1 + %o4], %g1 jmp %g1 nop @@ -59,13 +59,13 @@ ENTRY(siglongjmp) ENTRY(sigsetjmp) brz,pt %o1,_C_LABEL(_setjmp) - st %o1,[%o0+0x38] ! jmpbuf[JBLEN] + st %o1,[%o0+0x48] ! jmpbuf[JBLEN] ba,a,pt %icc,_C_LABEL(setjmp) nop ! spitfire bug unimp 0 ENTRY(siglongjmp) - ld [%o0 + 0x38], %g1 + ld [%o0 + 0x48], %g1 brz,pt %g1, _C_LABEL(_longjmp) nop ba,a,pt %icc, _C_LABEL(longjmp)