| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: setjmp.S,v 1.10 2013/09/12 15:36:16 joerg Exp $ */ | | 1 | /* $NetBSD: setjmp.S,v 1.11 2023/10/11 06:16:13 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1992, 1993 | | 4 | * Copyright (c) 1992, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This software was developed by the Computer Systems Engineering group | | 7 | * This software was developed by the Computer Systems Engineering group |
8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | | 8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and |
9 | * contributed to Berkeley. | | 9 | * contributed to Berkeley. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
33 | * SUCH DAMAGE. | | 33 | * SUCH DAMAGE. |
34 | * | | 34 | * |
35 | * from: Header: setjmp.s,v 1.2 92/06/25 03:18:43 torek Exp | | 35 | * from: Header: setjmp.s,v 1.2 92/06/25 03:18:43 torek Exp |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #define _LOCORE | | 38 | #define _LOCORE |
39 | #include <machine/asm.h> | | 39 | #include <machine/asm.h> |
40 | #include <machine/frame.h> | | 40 | #include <machine/frame.h> |
41 | #if defined(LIBC_SCCS) && !defined(lint) | | 41 | #if defined(LIBC_SCCS) && !defined(lint) |
42 | #if 0 | | 42 | #if 0 |
43 | .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93" | | 43 | .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93" |
44 | #else | | 44 | #else |
45 | RCSID("$NetBSD: setjmp.S,v 1.10 2013/09/12 15:36:16 joerg Exp $") | | 45 | RCSID("$NetBSD: setjmp.S,v 1.11 2023/10/11 06:16:13 skrll Exp $") |
46 | #endif | | 46 | #endif |
47 | #endif /* LIBC_SCCS and not lint */ | | 47 | #endif /* LIBC_SCCS and not lint */ |
48 | | | 48 | |
49 | /* | | 49 | /* |
50 | * C library -- setjmp | | 50 | * C library -- setjmp |
51 | * | | 51 | * |
52 | * __longjmp14(a,v) | | 52 | * __longjmp14(a,v) |
53 | * will generate a "return(v)" from | | 53 | * will generate a "return(v)" from |
54 | * the last call to | | 54 | * the last call to |
55 | * setjmp(a) | | 55 | * setjmp(a) |
56 | * by restoring registers from the stack, | | 56 | * by restoring registers from the stack, |
57 | * and a struct sigcontext, see <signal.h> | | 57 | * and a struct sigcontext, see <signal.h> |
58 | */ | | 58 | */ |
| @@ -97,27 +97,27 @@ ENTRY(__setjmp14) | | | @@ -97,27 +97,27 @@ ENTRY(__setjmp14) |
97 | | | 97 | |
98 | clr %o0 /* sigstack(NULL, &foo) */ | | 98 | clr %o0 /* sigstack(NULL, &foo) */ |
99 | #if __PIC__ - 0 >= 2 | | 99 | #if __PIC__ - 0 >= 2 |
100 | set _C_LABEL(__sigaltstack14), %o4 | | 100 | set _C_LABEL(__sigaltstack14), %o4 |
101 | ldx [%i1 + %o4], %g2 | | 101 | ldx [%i1 + %o4], %g2 |
102 | call %g2 | | 102 | call %g2 |
103 | #elif __PIC__ - 0 >= 1 | | 103 | #elif __PIC__ - 0 >= 1 |
104 | ldx [%i1 + _C_LABEL(__sigaltstack14)], %g2 | | 104 | ldx [%i1 + _C_LABEL(__sigaltstack14)], %g2 |
105 | call %g2 | | 105 | call %g2 |
106 | #else | | 106 | #else |
107 | call _C_LABEL(__sigaltstack14) | | 107 | call _C_LABEL(__sigaltstack14) |
108 | #endif | | 108 | #endif |
109 | add %i0, 8, %o1 /* (foo being part of the sigcontext we're overwriting) */ | | 109 | add %i0, 8, %o1 /* (foo being part of the sigcontext we're overwriting) */ |
110 | | | 110 | |
111 | lduw [%i0 + 8 + 0x10], %o0 /* foo.ss_flags */ | | 111 | lduw [%i0 + 8 + 0x10], %o0 /* foo.ss_flags */ |
112 | and %o0, 1, %o1 /* onstack = foo.ss_flags & SS_ONSTACK; */ | | 112 | and %o0, 1, %o1 /* onstack = foo.ss_flags & SS_ONSTACK; */ |
113 | st %o1, [%i0 + 0x00] /* sc.sc_onstack = current onstack; */ | | 113 | st %o1, [%i0 + 0x00] /* sc.sc_onstack = current onstack; */ |
114 | | | 114 | |
115 | /* store essential state */ | | 115 | /* store essential state */ |
116 | stx %fp, [%i0 + 0x08] /* sc.sc_sp = sp */ | | 116 | stx %fp, [%i0 + 0x08] /* sc.sc_sp = sp */ |
117 | add %i7, 8, %o0 | | 117 | add %i7, 8, %o0 |
118 | stx %o0, [%i0 + 0x10] /* sc.sc_pc = return_pc */ | | 118 | stx %o0, [%i0 + 0x10] /* sc.sc_pc = return_pc */ |
119 | stx %g0, [%i0 + 0x20] /* sc.sc_tstate = (clean ccr) */ | | 119 | stx %g0, [%i0 + 0x20] /* sc.sc_tstate = (clean ccr) */ |
120 | stx %l1, [%i0 + 0x28] /* sc.sc_g1 */ | | 120 | stx %l1, [%i0 + 0x28] /* sc.sc_g1 */ |
121 | stx %l2, [%i0 + 0x30] /* sc.sc_o0, set in longjmp, use as %g2 */ | | 121 | stx %l2, [%i0 + 0x30] /* sc.sc_o0, set in longjmp, use as %g2 */ |
122 | /* 0x38: 4x32bit */ /* sc.sc_mask was already saved above */ | | 122 | /* 0x38: 4x32bit */ /* sc.sc_mask was already saved above */ |
123 | | | 123 | |