]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/ia64/include/_regset.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / ia64 / include / _regset.h
1 /*-
2  * Copyright (c) 2002, 2003 Marcel Moolenaar
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28
29 #ifndef _MACHINE_REGSET_H_
30 #define _MACHINE_REGSET_H_
31
32 /*
33  * Create register sets, based on the runtime specification. This allows
34  * us to better reuse code and to copy sets around more efficiently.
35  * Contexts are defined in terms of these sets. These include trapframe,
36  * sigframe, pcb, mcontext, reg and fpreg. Other candidates are unwind
37  * and coredump related contexts.
38  *
39  * Notes:
40  * o  Constant registers (r0, f0 and f1) are not accounted for,
41  * o  The stacked registers (r32-r127) are not accounted for,
42  * o  Predicates are not split across sets.
43  */
44
45 /* A single FP register. */
46 union _ia64_fpreg {
47         unsigned char   fpr_bits[16];
48         long double     fpr_flt;
49 };
50
51 /*
52  * Special registers.
53  */
54 struct _special {
55         unsigned long           sp;
56         unsigned long           unat;           /* NaT before spilling */
57         unsigned long           rp;
58         unsigned long           pr;
59         unsigned long           pfs;
60         unsigned long           bspstore;
61         unsigned long           rnat;
62         unsigned long           __spare;
63         /* Userland context and syscalls */
64         unsigned long           tp;
65         unsigned long           rsc;
66         unsigned long           fpsr;
67         unsigned long           psr;
68         /* ASYNC: Interrupt specific */
69         unsigned long           gp;
70         unsigned long           ndirty;
71         unsigned long           cfm;
72         unsigned long           iip;
73         unsigned long           ifa;
74         unsigned long           isr;
75 };
76
77 struct _high_fp {
78         union _ia64_fpreg       fr32;
79         union _ia64_fpreg       fr33;
80         union _ia64_fpreg       fr34;
81         union _ia64_fpreg       fr35;
82         union _ia64_fpreg       fr36;
83         union _ia64_fpreg       fr37;
84         union _ia64_fpreg       fr38;
85         union _ia64_fpreg       fr39;
86         union _ia64_fpreg       fr40;
87         union _ia64_fpreg       fr41;
88         union _ia64_fpreg       fr42;
89         union _ia64_fpreg       fr43;
90         union _ia64_fpreg       fr44;
91         union _ia64_fpreg       fr45;
92         union _ia64_fpreg       fr46;
93         union _ia64_fpreg       fr47;
94         union _ia64_fpreg       fr48;
95         union _ia64_fpreg       fr49;
96         union _ia64_fpreg       fr50;
97         union _ia64_fpreg       fr51;
98         union _ia64_fpreg       fr52;
99         union _ia64_fpreg       fr53;
100         union _ia64_fpreg       fr54;
101         union _ia64_fpreg       fr55;
102         union _ia64_fpreg       fr56;
103         union _ia64_fpreg       fr57;
104         union _ia64_fpreg       fr58;
105         union _ia64_fpreg       fr59;
106         union _ia64_fpreg       fr60;
107         union _ia64_fpreg       fr61;
108         union _ia64_fpreg       fr62;
109         union _ia64_fpreg       fr63;
110         union _ia64_fpreg       fr64;
111         union _ia64_fpreg       fr65;
112         union _ia64_fpreg       fr66;
113         union _ia64_fpreg       fr67;
114         union _ia64_fpreg       fr68;
115         union _ia64_fpreg       fr69;
116         union _ia64_fpreg       fr70;
117         union _ia64_fpreg       fr71;
118         union _ia64_fpreg       fr72;
119         union _ia64_fpreg       fr73;
120         union _ia64_fpreg       fr74;
121         union _ia64_fpreg       fr75;
122         union _ia64_fpreg       fr76;
123         union _ia64_fpreg       fr77;
124         union _ia64_fpreg       fr78;
125         union _ia64_fpreg       fr79;
126         union _ia64_fpreg       fr80;
127         union _ia64_fpreg       fr81;
128         union _ia64_fpreg       fr82;
129         union _ia64_fpreg       fr83;
130         union _ia64_fpreg       fr84;
131         union _ia64_fpreg       fr85;
132         union _ia64_fpreg       fr86;
133         union _ia64_fpreg       fr87;
134         union _ia64_fpreg       fr88;
135         union _ia64_fpreg       fr89;
136         union _ia64_fpreg       fr90;
137         union _ia64_fpreg       fr91;
138         union _ia64_fpreg       fr92;
139         union _ia64_fpreg       fr93;
140         union _ia64_fpreg       fr94;
141         union _ia64_fpreg       fr95;
142         union _ia64_fpreg       fr96;
143         union _ia64_fpreg       fr97;
144         union _ia64_fpreg       fr98;
145         union _ia64_fpreg       fr99;
146         union _ia64_fpreg       fr100;
147         union _ia64_fpreg       fr101;
148         union _ia64_fpreg       fr102;
149         union _ia64_fpreg       fr103;
150         union _ia64_fpreg       fr104;
151         union _ia64_fpreg       fr105;
152         union _ia64_fpreg       fr106;
153         union _ia64_fpreg       fr107;
154         union _ia64_fpreg       fr108;
155         union _ia64_fpreg       fr109;
156         union _ia64_fpreg       fr110;
157         union _ia64_fpreg       fr111;
158         union _ia64_fpreg       fr112;
159         union _ia64_fpreg       fr113;
160         union _ia64_fpreg       fr114;
161         union _ia64_fpreg       fr115;
162         union _ia64_fpreg       fr116;
163         union _ia64_fpreg       fr117;
164         union _ia64_fpreg       fr118;
165         union _ia64_fpreg       fr119;
166         union _ia64_fpreg       fr120;
167         union _ia64_fpreg       fr121;
168         union _ia64_fpreg       fr122;
169         union _ia64_fpreg       fr123;
170         union _ia64_fpreg       fr124;
171         union _ia64_fpreg       fr125;
172         union _ia64_fpreg       fr126;
173         union _ia64_fpreg       fr127;
174 };
175
176 /*
177  * Preserved registers.
178  */
179 struct _callee_saved {
180         unsigned long           unat;           /* NaT after spilling. */
181         unsigned long           gr4;
182         unsigned long           gr5;
183         unsigned long           gr6;
184         unsigned long           gr7;
185         unsigned long           br1;
186         unsigned long           br2;
187         unsigned long           br3;
188         unsigned long           br4;
189         unsigned long           br5;
190         unsigned long           lc;
191         unsigned long           __spare;
192 };
193
194 struct _callee_saved_fp {
195         union _ia64_fpreg       fr2;
196         union _ia64_fpreg       fr3;
197         union _ia64_fpreg       fr4;
198         union _ia64_fpreg       fr5;
199         union _ia64_fpreg       fr16;
200         union _ia64_fpreg       fr17;
201         union _ia64_fpreg       fr18;
202         union _ia64_fpreg       fr19;
203         union _ia64_fpreg       fr20;
204         union _ia64_fpreg       fr21;
205         union _ia64_fpreg       fr22;
206         union _ia64_fpreg       fr23;
207         union _ia64_fpreg       fr24;
208         union _ia64_fpreg       fr25;
209         union _ia64_fpreg       fr26;
210         union _ia64_fpreg       fr27;
211         union _ia64_fpreg       fr28;
212         union _ia64_fpreg       fr29;
213         union _ia64_fpreg       fr30;
214         union _ia64_fpreg       fr31;
215 };
216
217 /*
218  * Scratch registers.
219  */
220 struct _caller_saved {
221         unsigned long           unat;           /* NaT after spilling. */
222         unsigned long           gr2;
223         unsigned long           gr3;
224         unsigned long           gr8;
225         unsigned long           gr9;
226         unsigned long           gr10;
227         unsigned long           gr11;
228         unsigned long           gr14;
229         unsigned long           gr15;
230         unsigned long           gr16;
231         unsigned long           gr17;
232         unsigned long           gr18;
233         unsigned long           gr19;
234         unsigned long           gr20;
235         unsigned long           gr21;
236         unsigned long           gr22;
237         unsigned long           gr23;
238         unsigned long           gr24;
239         unsigned long           gr25;
240         unsigned long           gr26;
241         unsigned long           gr27;
242         unsigned long           gr28;
243         unsigned long           gr29;
244         unsigned long           gr30;
245         unsigned long           gr31;
246         unsigned long           br6;
247         unsigned long           br7;
248         unsigned long           ccv;
249         unsigned long           csd;
250         unsigned long           ssd;
251 };
252
253 struct _caller_saved_fp {
254         union _ia64_fpreg       fr6;
255         union _ia64_fpreg       fr7;
256         union _ia64_fpreg       fr8;
257         union _ia64_fpreg       fr9;
258         union _ia64_fpreg       fr10;
259         union _ia64_fpreg       fr11;
260         union _ia64_fpreg       fr12;
261         union _ia64_fpreg       fr13;
262         union _ia64_fpreg       fr14;
263         union _ia64_fpreg       fr15;
264 };
265
266 #ifdef _KERNEL
267 void    restore_callee_saved(const struct _callee_saved *);
268 void    restore_callee_saved_fp(const struct _callee_saved_fp *);
269 void    restore_high_fp(const struct _high_fp *);
270 void    save_callee_saved(struct _callee_saved *);
271 void    save_callee_saved_fp(struct _callee_saved_fp *);
272 void    save_high_fp(struct _high_fp *);
273 #endif
274
275 #endif  /* _MACHINE_REGSET_H_ */