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