blob: c2851461c3fb0b85ce71733a209898d39652eae3 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
18
19#include <features.h>
20#define _ASM
21#define _SETJMP_H
22#include <bits/setjmp.h>
23#include "NM_Macros.S"
24
25;----------------------------------------
26; Name: __sigsetjmp
27; Description: Save the current context so
28; a nr_longjmp works later.
29; Input: %o0: jmp_buf: (ptr to) array to store context in
30; Output: %o0 = 0 the first time we're called, or
31; whatever longjmp returns later
32; Side Effects: Uses %g0
33; CWP Depth: 0
34;
35
36 .align 2
37 .global _setjmp
38
39_setjmp:
40 br __sigsetjmp
41 movi %o1,0 ; (Delay slot) Set signal mask to zero
42
43 .align 2
44 .global setjmp
45
46setjmp:
47 MOVIP %o1,1 ; Set signal mask to 1 to save mask
48
49 .align 2
50 .global __sigsetjmp
51
52__sigsetjmp:
53 pfx jmpbuf_callersret ; present return address
54 st [%o0],%i7
55 pfx jmpbuf_jmpret ; where the longjmp will later execute from
56 st [%o0],%o7
57 pfx jmpbuf_sp ; Save stack pointer
58 st [%o0],%o6
59 pfx jmpbuf_l0 ; Save local register l0
60 st [%o0],%l0
61 pfx jmpbuf_l1 ; Save local register l1
62 st [%o0],%l1
63 pfx jmpbuf_l2 ; Save local register l2
64 st [%o0],%l2
65 pfx jmpbuf_l3 ; Save local register l3
66 st [%o0],%l3
67 pfx jmpbuf_l4 ; Save local register l4
68 st [%o0],%l4
69 pfx jmpbuf_l5 ; Save local register l5
70 st [%o0],%l5
71 pfx jmpbuf_l6 ; Save local register l6
72 st [%o0],%l6
73 pfx jmpbuf_l7 ; Save local register l7
74 st [%o0],%l7
75 pfx jmpbuf_i0 ; Save input register i0
76 st [%o0],%i0
77 pfx jmpbuf_i1 ; Save input register i1
78 st [%o0],%i1
79 pfx jmpbuf_i2 ; Save input register i2
80 st [%o0],%i2
81 pfx jmpbuf_i3 ; Save input register i3
82 st [%o0],%i3
83 pfx jmpbuf_i4 ; Save input register i4
84 st [%o0],%i4
85 pfx jmpbuf_i5 ; Save input register i5
86 st [%o0],%i5
87 pfx %hi(__sigjmp_save@h) ; Load up %g0 with address
88 movi %g0,%lo(__sigjmp_save@h)
89 pfx %xhi(__sigjmp_save@h)
90 movhi %g0,%xlo(__sigjmp_save@h)
91 jmp %g0
92 nop ; (delay slot)
93
94
95
96
97
98
99
100
101
102