]>
Commit | Line | Data |
---|---|---|
f7a9f785 | 1 | /* Copyright (C) 1999-2016 Free Software Foundation, Inc. |
d5efd131 MF |
2 | Contributed by David Mosberger-Tang <davidm@hpl.hp.com>. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the 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 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
75efb018 MF |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
d5efd131 MF |
17 | |
18 | #include <sysdep.h> | |
19 | #include <features.h> | |
20 | ||
21 | LEAF(__ia64_flush_rbs) | |
22 | flushrs | |
23 | mov r9 = ar.rsc // 12 cyc latency | |
24 | ;; | |
25 | mov r8 = ar.bsp // 12 cyc latency | |
26 | ;; | |
27 | and r16 = ~0x3, r9 // clear ar.rsc.mode | |
28 | ;; | |
29 | mov ar.rsc = r16 // put RSE into enforced-lazy mode | |
30 | ;; | |
31 | mov r10 = ar.rnat // 5 cyc latency | |
32 | ret | |
33 | END(__ia64_flush_rbs) | |
34 | ||
35 | ||
36 | # define pPos p6 /* is rotate count positive? */ | |
37 | # define pNeg p7 /* is rotate count negative? */ | |
38 | ||
39 | /* __ia64_longjmp(__jmp_buf buf, int val, long rnat, long rsc) */ | |
40 | ||
41 | ||
42 | LEAF(__ia64_longjmp) | |
43 | alloc r8=ar.pfs,4,0,0,0 | |
44 | add r2=0x98,in0 // r2 <- &jmpbuf.orig_jmp_buf_addr | |
45 | add r3=0x88,in0 // r3 <- &jmpbuf.ar_bsp | |
46 | ;; | |
47 | ld8 r8=[r2] // r8 <- orig_jmp_buf_addr | |
48 | ld8 r23=[r3],8 // r23 <- jmpbuf.ar_bsp | |
49 | mov r2=in0 | |
50 | ;; | |
51 | // | |
52 | // Note: we need to redo the "flushrs" here even though it's | |
53 | // already been done by __ia64_flush_rbs. It is needed to | |
54 | // ensure that ar.bspstore == ar.bsp. | |
55 | // | |
56 | flushrs // flush dirty regs to backing store | |
57 | ld8 r25=[r3] // r25 <- jmpbuf.ar_unat | |
58 | sub r8=r8,in0 // r8 <- &orig_jmpbuf - &jmpbuf | |
59 | ;; | |
60 | add r3=8,in0 // r3 <- &jmpbuf.r1 | |
61 | extr.u r8=r8,3,6 // r8 <- (&orig_jmpbuf - &jmpbuf)/8 & 0x3f | |
62 | ;; | |
63 | cmp.lt pNeg,pPos=r8,r0 | |
64 | ;; | |
65 | (pPos) mov r16=r8 | |
66 | (pNeg) add r16=64,r8 | |
67 | (pPos) sub r17=64,r8 | |
68 | (pNeg) sub r17=r0,r8 | |
69 | ;; | |
70 | shr.u r8=r25,r16 | |
71 | shl r9=r25,r17 | |
72 | ;; | |
73 | or r25=r8,r9 | |
74 | ;; | |
75 | mov ar.unat=r25 // setup ar.unat (NaT bits for r1, r4-r7, and r12) | |
76 | ;; | |
77 | ld8.fill.nta sp=[r2],16 // r12 (sp) | |
e646a161 | 78 | ld8.fill.nta gp=[r3],32 // r1 (gp) |
d5efd131 MF |
79 | dep r11=-1,r23,3,6 // r11 <- ia64_rse_rnat_addr(jmpbuf.ar_bsp) |
80 | ;; | |
81 | ld8.nta r16=[r2],16 // caller's unat | |
e646a161 | 82 | // ld8.nta r17=[r3],16 // fpsr |
d5efd131 MF |
83 | ;; |
84 | ld8.fill.nta r4=[r2],16 // r4 | |
85 | ld8.fill.nta r5=[r3],16 // r5 (gp) | |
86 | ;; | |
87 | ld8.fill.nta r6=[r2],16 // r6 | |
88 | ld8.fill.nta r7=[r3],16 // r7 | |
89 | ;; | |
90 | mov ar.unat=r16 // restore caller's unat | |
e646a161 | 91 | // mov ar.fpsr=r17 // restore fpsr |
d5efd131 MF |
92 | ;; |
93 | ld8.nta r16=[r2],16 // b0 | |
94 | ld8.nta r17=[r3],16 // b1 | |
95 | ;; | |
96 | mov ar.bspstore=r23 // restore ar.bspstore | |
97 | ld8.nta r18=[r2],16 // b2 | |
98 | ;; | |
99 | mov ar.rnat=in2 // restore ar.rnat | |
100 | ld8.nta r19=[r3],16 // b3 | |
101 | ;; | |
102 | ld8.nta r20=[r2],16 // b4 | |
103 | ld8.nta r21=[r3],16 // b5 | |
104 | #ifdef PTR_DEMANGLE | |
105 | PTR_DEMANGLE (r16, r24) | |
106 | #endif | |
107 | ;; | |
108 | ld8.nta r11=[r2],16 // ar.pfs | |
109 | ld8.nta r22=[r3],56 // ar.lc | |
110 | ;; | |
111 | ld8.nta r24=[r2],32 // pr | |
112 | mov ar.rsc=in3 // restore ar.rsc | |
113 | mov b0=r16 | |
114 | ;; | |
115 | ldf.fill.nta f2=[r2],32 | |
116 | ldf.fill.nta f3=[r3],32 | |
117 | mov b1=r17 | |
118 | ;; | |
119 | ldf.fill.nta f4=[r2],32 | |
120 | ldf.fill.nta f5=[r3],32 | |
121 | mov b2=r18 | |
122 | ;; | |
123 | ldf.fill.nta f16=[r2],32 | |
124 | ldf.fill.nta f17=[r3],32 | |
125 | mov b3=r19 | |
126 | ;; | |
127 | ldf.fill.nta f18=[r2],32 | |
128 | ldf.fill.nta f19=[r3],32 | |
129 | mov b4=r20 | |
130 | ;; | |
131 | ldf.fill.nta f20=[r2],32 | |
132 | ldf.fill.nta f21=[r3],32 | |
133 | mov b5=r21 | |
134 | ;; | |
135 | ldf.fill.nta f22=[r2],32 | |
136 | ldf.fill.nta f23=[r3],32 | |
137 | mov ar.lc=r22 | |
138 | ;; | |
139 | ldf.fill.nta f24=[r2],32 | |
140 | ldf.fill.nta f25=[r3],32 | |
141 | cmp.eq p8,p9=0,in1 | |
142 | ;; | |
143 | ldf.fill.nta f26=[r2],32 | |
144 | ldf.fill.nta f27=[r3],32 | |
145 | mov ar.pfs=r11 | |
146 | ;; | |
147 | ldf.fill.nta f28=[r2],32 | |
148 | ldf.fill.nta f29=[r3],32 | |
149 | (p8) mov r8=1 | |
150 | ;; | |
151 | ldf.fill.nta f30=[r2] | |
152 | ldf.fill.nta f31=[r3] | |
153 | (p9) mov r8=in1 | |
154 | ||
155 | invala // virt. -> phys. regnum mapping may change | |
156 | mov pr=r24,-1 | |
157 | ret | |
158 | END(__ia64_longjmp) |