1 #ifndef _SPARC64_TTABLE_H 2 #define _SPARC64_TTABLE_H 3 4 #include <asm/utrap.h> 5 #include <asm/pil.h> 6 7 #ifdef __ASSEMBLY__ 8 #include <asm/thread_info.h> 9 #endif 10 11 #define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop; 12 13 /* We need a "cleaned" instruction... */ 14 #define CLEAN_WINDOW \ 15 rdpr %cleanwin, %l0; add %l0, 1, %l0; \ 16 wrpr %l0, 0x0, %cleanwin; \ 17 clr %o0; clr %o1; clr %o2; clr %o3; \ 18 clr %o4; clr %o5; clr %o6; clr %o7; \ 19 clr %l0; clr %l1; clr %l2; clr %l3; \ 20 clr %l4; clr %l5; clr %l6; clr %l7; \ 21 retry; \ 22 nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; 23 24 #define TRAP(routine) \ 25 sethi %hi(109f), %g7; \ 26 ba,pt %xcc, etrap; \ 27 109: or %g7, %lo(109b), %g7; \ 28 call routine; \ 29 add %sp, PTREGS_OFF, %o0; \ 30 ba,pt %xcc, rtrap; \ 31 nop; \ 32 nop; 33 34 #define TRAP_7INSNS(routine) \ 35 sethi %hi(109f), %g7; \ 36 ba,pt %xcc, etrap; \ 37 109: or %g7, %lo(109b), %g7; \ 38 call routine; \ 39 add %sp, PTREGS_OFF, %o0; \ 40 ba,pt %xcc, rtrap; \ 41 nop; 42 43 #define TRAP_SAVEFPU(routine) \ 44 sethi %hi(109f), %g7; \ 45 ba,pt %xcc, do_fptrap; \ 46 109: or %g7, %lo(109b), %g7; \ 47 call routine; \ 48 add %sp, PTREGS_OFF, %o0; \ 49 ba,pt %xcc, rtrap; \ 50 nop; \ 51 nop; 52 53 #define TRAP_NOSAVE(routine) \ 54 ba,pt %xcc, routine; \ 55 nop; \ 56 nop; nop; nop; nop; nop; nop; 57 58 #define TRAP_NOSAVE_7INSNS(routine) \ 59 ba,pt %xcc, routine; \ 60 nop; \ 61 nop; nop; nop; nop; nop; 62 63 #define TRAPTL1(routine) \ 64 sethi %hi(109f), %g7; \ 65 ba,pt %xcc, etraptl1; \ 66 109: or %g7, %lo(109b), %g7; \ 67 call routine; \ 68 add %sp, PTREGS_OFF, %o0; \ 69 ba,pt %xcc, rtrap; \ 70 nop; \ 71 nop; 72 73 #define TRAP_ARG(routine, arg) \ 74 sethi %hi(109f), %g7; \ 75 ba,pt %xcc, etrap; \ 76 109: or %g7, %lo(109b), %g7; \ 77 add %sp, PTREGS_OFF, %o0; \ 78 call routine; \ 79 mov arg, %o1; \ 80 ba,pt %xcc, rtrap; \ 81 nop; 82 83 #define TRAPTL1_ARG(routine, arg) \ 84 sethi %hi(109f), %g7; \ 85 ba,pt %xcc, etraptl1; \ 86 109: or %g7, %lo(109b), %g7; \ 87 add %sp, PTREGS_OFF, %o0; \ 88 call routine; \ 89 mov arg, %o1; \ 90 ba,pt %xcc, rtrap; \ 91 nop; 92 93 #define SYSCALL_TRAP(routine, systbl) \ 94 rdpr %pil, %g2; \ 95 mov TSTATE_SYSCALL, %g3; \ 96 sethi %hi(109f), %g7; \ 97 ba,pt %xcc, etrap_syscall; \ 98 109: or %g7, %lo(109b), %g7; \ 99 sethi %hi(systbl), %l7; \ 100 ba,pt %xcc, routine; \ 101 or %l7, %lo(systbl), %l7; 102 103 #define TRAP_UTRAP(handler,lvl) \ 104 mov handler, %g3; \ 105 ba,pt %xcc, utrap_trap; \ 106 mov lvl, %g4; \ 107 nop; \ 108 nop; \ 109 nop; \ 110 nop; \ 111 nop; 112 113 #ifdef CONFIG_COMPAT 114 #define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32) 115 #else 116 #define LINUX_32BIT_SYSCALL_TRAP BTRAP(0x110) 117 #endif 118 #define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64) 119 #define GETCC_TRAP TRAP(getcc) 120 #define SETCC_TRAP TRAP(setcc) 121 #define BREAKPOINT_TRAP TRAP(breakpoint_trap) 122 123 #ifdef CONFIG_TRACE_IRQFLAGS 124 125 #define TRAP_IRQ(routine, level) \ 126 rdpr %pil, %g2; \ 127 wrpr %g0, PIL_NORMAL_MAX, %pil; \ 128 sethi %hi(1f-4), %g7; \ 129 ba,pt %xcc, etrap_irq; \ 130 or %g7, %lo(1f-4), %g7; \ 131 nop; \ 132 nop; \ 133 nop; \ 134 .subsection 2; \ 135 1: call trace_hardirqs_off; \ 136 nop; \ 137 mov level, %o0; \ 138 call routine; \ 139 add %sp, PTREGS_OFF, %o1; \ 140 ba,a,pt %xcc, rtrap_irq; \ 141 .previous; 142 143 #else 144 145 #define TRAP_IRQ(routine, level) \ 146 rdpr %pil, %g2; \ 147 wrpr %g0, PIL_NORMAL_MAX, %pil; \ 148 ba,pt %xcc, etrap_irq; \ 149 rd %pc, %g7; \ 150 mov level, %o0; \ 151 call routine; \ 152 add %sp, PTREGS_OFF, %o1; \ 153 ba,a,pt %xcc, rtrap_irq; 154 155 #endif 156 157 #define TRAP_NMI_IRQ(routine, level) \ 158 rdpr %pil, %g2; \ 159 wrpr %g0, PIL_NMI, %pil; \ 160 ba,pt %xcc, etrap_irq; \ 161 rd %pc, %g7; \ 162 mov level, %o0; \ 163 call routine; \ 164 add %sp, PTREGS_OFF, %o1; \ 165 ba,a,pt %xcc, rtrap_nmi; 166 167 #define TRAP_IVEC TRAP_NOSAVE(do_ivec) 168 169 #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) 170 171 #define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl) 172 173 #define FLUSH_WINDOW_TRAP \ 174 ba,pt %xcc, etrap; \ 175 rd %pc, %g7; \ 176 flushw; \ 177 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1; \ 178 add %l1, 4, %l2; \ 179 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \ 180 ba,pt %xcc, rtrap; \ 181 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]; 182 183 #ifdef CONFIG_KPROBES 184 #define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl) 185 #else 186 #define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl) 187 #endif 188 189 #ifdef CONFIG_UPROBES 190 #define UPROBES_TRAP(lvl) TRAP_ARG(uprobe_trap, lvl) 191 #else 192 #define UPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl) 193 #endif 194 195 #ifdef CONFIG_KGDB 196 #define KGDB_TRAP(lvl) TRAP_IRQ(kgdb_trap, lvl) 197 #else 198 #define KGDB_TRAP(lvl) TRAP_ARG(bad_trap, lvl) 199 #endif 200 201 #define SUN4V_ITSB_MISS \ 202 ldxa [%g0] ASI_SCRATCHPAD, %g2; \ 203 ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \ 204 ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5; \ 205 srlx %g4, 22, %g6; \ 206 ba,pt %xcc, sun4v_itsb_miss; \ 207 nop; \ 208 nop; \ 209 nop; 210 211 #define SUN4V_DTSB_MISS \ 212 ldxa [%g0] ASI_SCRATCHPAD, %g2; \ 213 ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \ 214 ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \ 215 srlx %g4, 22, %g6; \ 216 ba,pt %xcc, sun4v_dtsb_miss; \ 217 nop; \ 218 nop; \ 219 nop; 220 221 /* Before touching these macros, you owe it to yourself to go and 222 * see how arch/sparc64/kernel/winfixup.S works... -DaveM 223 * 224 * For the user cases we used to use the %asi register, but 225 * it turns out that the "wr xxx, %asi" costs ~5 cycles, so 226 * now we use immediate ASI loads and stores instead. Kudos 227 * to Greg Onufer for pointing out this performance anomaly. 228 * 229 * Further note that we cannot use the g2, g4, g5, and g7 alternate 230 * globals in the spill routines, check out the save instruction in 231 * arch/sparc64/kernel/etrap.S to see what I mean about g2, and 232 * g4/g5 are the globals which are preserved by etrap processing 233 * for the caller of it. The g7 register is the return pc for 234 * etrap. Finally, g6 is the current thread register so we cannot 235 * us it in the spill handlers either. Most of these rules do not 236 * apply to fill processing, only g6 is not usable. 237 */ 238 239 /* Normal kernel spill */ 240 #define SPILL_0_NORMAL \ 241 stx %l0, [%sp + STACK_BIAS + 0x00]; \ 242 stx %l1, [%sp + STACK_BIAS + 0x08]; \ 243 stx %l2, [%sp + STACK_BIAS + 0x10]; \ 244 stx %l3, [%sp + STACK_BIAS + 0x18]; \ 245 stx %l4, [%sp + STACK_BIAS + 0x20]; \ 246 stx %l5, [%sp + STACK_BIAS + 0x28]; \ 247 stx %l6, [%sp + STACK_BIAS + 0x30]; \ 248 stx %l7, [%sp + STACK_BIAS + 0x38]; \ 249 stx %i0, [%sp + STACK_BIAS + 0x40]; \ 250 stx %i1, [%sp + STACK_BIAS + 0x48]; \ 251 stx %i2, [%sp + STACK_BIAS + 0x50]; \ 252 stx %i3, [%sp + STACK_BIAS + 0x58]; \ 253 stx %i4, [%sp + STACK_BIAS + 0x60]; \ 254 stx %i5, [%sp + STACK_BIAS + 0x68]; \ 255 stx %i6, [%sp + STACK_BIAS + 0x70]; \ 256 stx %i7, [%sp + STACK_BIAS + 0x78]; \ 257 saved; retry; nop; nop; nop; nop; nop; nop; \ 258 nop; nop; nop; nop; nop; nop; nop; nop; 259 260 #define SPILL_0_NORMAL_ETRAP \ 261 etrap_kernel_spill: \ 262 stx %l0, [%sp + STACK_BIAS + 0x00]; \ 263 stx %l1, [%sp + STACK_BIAS + 0x08]; \ 264 stx %l2, [%sp + STACK_BIAS + 0x10]; \ 265 stx %l3, [%sp + STACK_BIAS + 0x18]; \ 266 stx %l4, [%sp + STACK_BIAS + 0x20]; \ 267 stx %l5, [%sp + STACK_BIAS + 0x28]; \ 268 stx %l6, [%sp + STACK_BIAS + 0x30]; \ 269 stx %l7, [%sp + STACK_BIAS + 0x38]; \ 270 stx %i0, [%sp + STACK_BIAS + 0x40]; \ 271 stx %i1, [%sp + STACK_BIAS + 0x48]; \ 272 stx %i2, [%sp + STACK_BIAS + 0x50]; \ 273 stx %i3, [%sp + STACK_BIAS + 0x58]; \ 274 stx %i4, [%sp + STACK_BIAS + 0x60]; \ 275 stx %i5, [%sp + STACK_BIAS + 0x68]; \ 276 stx %i6, [%sp + STACK_BIAS + 0x70]; \ 277 stx %i7, [%sp + STACK_BIAS + 0x78]; \ 278 saved; \ 279 sub %g1, 2, %g1; \ 280 ba,pt %xcc, etrap_save; \ 281 wrpr %g1, %cwp; \ 282 nop; nop; nop; nop; nop; nop; nop; nop; \ 283 nop; nop; nop; nop; 284 285 /* Normal 64bit spill */ 286 #define SPILL_1_GENERIC(ASI) \ 287 add %sp, STACK_BIAS + 0x00, %g1; \ 288 stxa %l0, [%g1 + %g0] ASI; \ 289 mov 0x08, %g3; \ 290 stxa %l1, [%g1 + %g3] ASI; \ 291 add %g1, 0x10, %g1; \ 292 stxa %l2, [%g1 + %g0] ASI; \ 293 stxa %l3, [%g1 + %g3] ASI; \ 294 add %g1, 0x10, %g1; \ 295 stxa %l4, [%g1 + %g0] ASI; \ 296 stxa %l5, [%g1 + %g3] ASI; \ 297 add %g1, 0x10, %g1; \ 298 stxa %l6, [%g1 + %g0] ASI; \ 299 stxa %l7, [%g1 + %g3] ASI; \ 300 add %g1, 0x10, %g1; \ 301 stxa %i0, [%g1 + %g0] ASI; \ 302 stxa %i1, [%g1 + %g3] ASI; \ 303 add %g1, 0x10, %g1; \ 304 stxa %i2, [%g1 + %g0] ASI; \ 305 stxa %i3, [%g1 + %g3] ASI; \ 306 add %g1, 0x10, %g1; \ 307 stxa %i4, [%g1 + %g0] ASI; \ 308 stxa %i5, [%g1 + %g3] ASI; \ 309 add %g1, 0x10, %g1; \ 310 stxa %i6, [%g1 + %g0] ASI; \ 311 stxa %i7, [%g1 + %g3] ASI; \ 312 saved; \ 313 retry; nop; nop; \ 314 b,a,pt %xcc, spill_fixup_dax; \ 315 b,a,pt %xcc, spill_fixup_mna; \ 316 b,a,pt %xcc, spill_fixup; 317 318 #define SPILL_1_GENERIC_ETRAP \ 319 etrap_user_spill_64bit: \ 320 stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \ 321 stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \ 322 stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \ 323 stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \ 324 stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \ 325 stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \ 326 stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \ 327 stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \ 328 stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \ 329 stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \ 330 stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \ 331 stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \ 332 stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \ 333 stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \ 334 stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \ 335 stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \ 336 saved; \ 337 sub %g1, 2, %g1; \ 338 ba,pt %xcc, etrap_save; \ 339 wrpr %g1, %cwp; \ 340 nop; nop; nop; nop; nop; \ 341 nop; nop; nop; nop; \ 342 ba,a,pt %xcc, etrap_spill_fixup_64bit; \ 343 ba,a,pt %xcc, etrap_spill_fixup_64bit; \ 344 ba,a,pt %xcc, etrap_spill_fixup_64bit; 345 346 #define SPILL_1_GENERIC_ETRAP_FIXUP \ 347 etrap_spill_fixup_64bit: \ 348 ldub [%g6 + TI_WSAVED], %g1; \ 349 sll %g1, 3, %g3; \ 350 add %g6, %g3, %g3; \ 351 stx %sp, [%g3 + TI_RWIN_SPTRS]; \ 352 sll %g1, 7, %g3; \ 353 add %g6, %g3, %g3; \ 354 stx %l0, [%g3 + TI_REG_WINDOW + 0x00]; \ 355 stx %l1, [%g3 + TI_REG_WINDOW + 0x08]; \ 356 stx %l2, [%g3 + TI_REG_WINDOW + 0x10]; \ 357 stx %l3, [%g3 + TI_REG_WINDOW + 0x18]; \ 358 stx %l4, [%g3 + TI_REG_WINDOW + 0x20]; \ 359 stx %l5, [%g3 + TI_REG_WINDOW + 0x28]; \ 360 stx %l6, [%g3 + TI_REG_WINDOW + 0x30]; \ 361 stx %l7, [%g3 + TI_REG_WINDOW + 0x38]; \ 362 stx %i0, [%g3 + TI_REG_WINDOW + 0x40]; \ 363 stx %i1, [%g3 + TI_REG_WINDOW + 0x48]; \ 364 stx %i2, [%g3 + TI_REG_WINDOW + 0x50]; \ 365 stx %i3, [%g3 + TI_REG_WINDOW + 0x58]; \ 366 stx %i4, [%g3 + TI_REG_WINDOW + 0x60]; \ 367 stx %i5, [%g3 + TI_REG_WINDOW + 0x68]; \ 368 stx %i6, [%g3 + TI_REG_WINDOW + 0x70]; \ 369 stx %i7, [%g3 + TI_REG_WINDOW + 0x78]; \ 370 add %g1, 1, %g1; \ 371 stb %g1, [%g6 + TI_WSAVED]; \ 372 saved; \ 373 rdpr %cwp, %g1; \ 374 sub %g1, 2, %g1; \ 375 ba,pt %xcc, etrap_save; \ 376 wrpr %g1, %cwp; \ 377 nop; nop; nop 378 379 /* Normal 32bit spill */ 380 #define SPILL_2_GENERIC(ASI) \ 381 and %sp, 1, %g3; \ 382 brnz,pn %g3, (. - (128 + 4)); \ 383 srl %sp, 0, %sp; \ 384 stwa %l0, [%sp + %g0] ASI; \ 385 mov 0x04, %g3; \ 386 stwa %l1, [%sp + %g3] ASI; \ 387 add %sp, 0x08, %g1; \ 388 stwa %l2, [%g1 + %g0] ASI; \ 389 stwa %l3, [%g1 + %g3] ASI; \ 390 add %g1, 0x08, %g1; \ 391 stwa %l4, [%g1 + %g0] ASI; \ 392 stwa %l5, [%g1 + %g3] ASI; \ 393 add %g1, 0x08, %g1; \ 394 stwa %l6, [%g1 + %g0] ASI; \ 395 stwa %l7, [%g1 + %g3] ASI; \ 396 add %g1, 0x08, %g1; \ 397 stwa %i0, [%g1 + %g0] ASI; \ 398 stwa %i1, [%g1 + %g3] ASI; \ 399 add %g1, 0x08, %g1; \ 400 stwa %i2, [%g1 + %g0] ASI; \ 401 stwa %i3, [%g1 + %g3] ASI; \ 402 add %g1, 0x08, %g1; \ 403 stwa %i4, [%g1 + %g0] ASI; \ 404 stwa %i5, [%g1 + %g3] ASI; \ 405 add %g1, 0x08, %g1; \ 406 stwa %i6, [%g1 + %g0] ASI; \ 407 stwa %i7, [%g1 + %g3] ASI; \ 408 saved; \ 409 retry; \ 410 b,a,pt %xcc, spill_fixup_dax; \ 411 b,a,pt %xcc, spill_fixup_mna; \ 412 b,a,pt %xcc, spill_fixup; 413 414 #define SPILL_2_GENERIC_ETRAP \ 415 etrap_user_spill_32bit: \ 416 and %sp, 1, %g3; \ 417 brnz,pn %g3, etrap_user_spill_64bit; \ 418 srl %sp, 0, %sp; \ 419 stwa %l0, [%sp + 0x00] %asi; \ 420 stwa %l1, [%sp + 0x04] %asi; \ 421 stwa %l2, [%sp + 0x08] %asi; \ 422 stwa %l3, [%sp + 0x0c] %asi; \ 423 stwa %l4, [%sp + 0x10] %asi; \ 424 stwa %l5, [%sp + 0x14] %asi; \ 425 stwa %l6, [%sp + 0x18] %asi; \ 426 stwa %l7, [%sp + 0x1c] %asi; \ 427 stwa %i0, [%sp + 0x20] %asi; \ 428 stwa %i1, [%sp + 0x24] %asi; \ 429 stwa %i2, [%sp + 0x28] %asi; \ 430 stwa %i3, [%sp + 0x2c] %asi; \ 431 stwa %i4, [%sp + 0x30] %asi; \ 432 stwa %i5, [%sp + 0x34] %asi; \ 433 stwa %i6, [%sp + 0x38] %asi; \ 434 stwa %i7, [%sp + 0x3c] %asi; \ 435 saved; \ 436 sub %g1, 2, %g1; \ 437 ba,pt %xcc, etrap_save; \ 438 wrpr %g1, %cwp; \ 439 nop; nop; nop; nop; \ 440 nop; nop; \ 441 ba,a,pt %xcc, etrap_spill_fixup_32bit; \ 442 ba,a,pt %xcc, etrap_spill_fixup_32bit; \ 443 ba,a,pt %xcc, etrap_spill_fixup_32bit; 444 445 #define SPILL_2_GENERIC_ETRAP_FIXUP \ 446 etrap_spill_fixup_32bit: \ 447 ldub [%g6 + TI_WSAVED], %g1; \ 448 sll %g1, 3, %g3; \ 449 add %g6, %g3, %g3; \ 450 stx %sp, [%g3 + TI_RWIN_SPTRS]; \ 451 sll %g1, 7, %g3; \ 452 add %g6, %g3, %g3; \ 453 stw %l0, [%g3 + TI_REG_WINDOW + 0x00]; \ 454 stw %l1, [%g3 + TI_REG_WINDOW + 0x04]; \ 455 stw %l2, [%g3 + TI_REG_WINDOW + 0x08]; \ 456 stw %l3, [%g3 + TI_REG_WINDOW + 0x0c]; \ 457 stw %l4, [%g3 + TI_REG_WINDOW + 0x10]; \ 458 stw %l5, [%g3 + TI_REG_WINDOW + 0x14]; \ 459 stw %l6, [%g3 + TI_REG_WINDOW + 0x18]; \ 460 stw %l7, [%g3 + TI_REG_WINDOW + 0x1c]; \ 461 stw %i0, [%g3 + TI_REG_WINDOW + 0x20]; \ 462 stw %i1, [%g3 + TI_REG_WINDOW + 0x24]; \ 463 stw %i2, [%g3 + TI_REG_WINDOW + 0x28]; \ 464 stw %i3, [%g3 + TI_REG_WINDOW + 0x2c]; \ 465 stw %i4, [%g3 + TI_REG_WINDOW + 0x30]; \ 466 stw %i5, [%g3 + TI_REG_WINDOW + 0x34]; \ 467 stw %i6, [%g3 + TI_REG_WINDOW + 0x38]; \ 468 stw %i7, [%g3 + TI_REG_WINDOW + 0x3c]; \ 469 add %g1, 1, %g1; \ 470 stb %g1, [%g6 + TI_WSAVED]; \ 471 saved; \ 472 rdpr %cwp, %g1; \ 473 sub %g1, 2, %g1; \ 474 ba,pt %xcc, etrap_save; \ 475 wrpr %g1, %cwp; \ 476 nop; nop; nop 477 478 #define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP) 479 #define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP) 480 #define SPILL_3_NORMAL SPILL_0_NORMAL 481 #define SPILL_4_NORMAL SPILL_0_NORMAL 482 #define SPILL_5_NORMAL SPILL_0_NORMAL 483 #define SPILL_6_NORMAL SPILL_0_NORMAL 484 #define SPILL_7_NORMAL SPILL_0_NORMAL 485 486 #define SPILL_0_OTHER SPILL_0_NORMAL 487 #define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS) 488 #define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS) 489 #define SPILL_3_OTHER SPILL_3_NORMAL 490 #define SPILL_4_OTHER SPILL_4_NORMAL 491 #define SPILL_5_OTHER SPILL_5_NORMAL 492 #define SPILL_6_OTHER SPILL_6_NORMAL 493 #define SPILL_7_OTHER SPILL_7_NORMAL 494 495 /* Normal kernel fill */ 496 #define FILL_0_NORMAL \ 497 ldx [%sp + STACK_BIAS + 0x00], %l0; \ 498 ldx [%sp + STACK_BIAS + 0x08], %l1; \ 499 ldx [%sp + STACK_BIAS + 0x10], %l2; \ 500 ldx [%sp + STACK_BIAS + 0x18], %l3; \ 501 ldx [%sp + STACK_BIAS + 0x20], %l4; \ 502 ldx [%sp + STACK_BIAS + 0x28], %l5; \ 503 ldx [%sp + STACK_BIAS + 0x30], %l6; \ 504 ldx [%sp + STACK_BIAS + 0x38], %l7; \ 505 ldx [%sp + STACK_BIAS + 0x40], %i0; \ 506 ldx [%sp + STACK_BIAS + 0x48], %i1; \ 507 ldx [%sp + STACK_BIAS + 0x50], %i2; \ 508 ldx [%sp + STACK_BIAS + 0x58], %i3; \ 509 ldx [%sp + STACK_BIAS + 0x60], %i4; \ 510 ldx [%sp + STACK_BIAS + 0x68], %i5; \ 511 ldx [%sp + STACK_BIAS + 0x70], %i6; \ 512 ldx [%sp + STACK_BIAS + 0x78], %i7; \ 513 restored; retry; nop; nop; nop; nop; nop; nop; \ 514 nop; nop; nop; nop; nop; nop; nop; nop; 515 516 #define FILL_0_NORMAL_RTRAP \ 517 kern_rtt_fill: \ 518 rdpr %cwp, %g1; \ 519 sub %g1, 1, %g1; \ 520 wrpr %g1, %cwp; \ 521 ldx [%sp + STACK_BIAS + 0x00], %l0; \ 522 ldx [%sp + STACK_BIAS + 0x08], %l1; \ 523 ldx [%sp + STACK_BIAS + 0x10], %l2; \ 524 ldx [%sp + STACK_BIAS + 0x18], %l3; \ 525 ldx [%sp + STACK_BIAS + 0x20], %l4; \ 526 ldx [%sp + STACK_BIAS + 0x28], %l5; \ 527 ldx [%sp + STACK_BIAS + 0x30], %l6; \ 528 ldx [%sp + STACK_BIAS + 0x38], %l7; \ 529 ldx [%sp + STACK_BIAS + 0x40], %i0; \ 530 ldx [%sp + STACK_BIAS + 0x48], %i1; \ 531 ldx [%sp + STACK_BIAS + 0x50], %i2; \ 532 ldx [%sp + STACK_BIAS + 0x58], %i3; \ 533 ldx [%sp + STACK_BIAS + 0x60], %i4; \ 534 ldx [%sp + STACK_BIAS + 0x68], %i5; \ 535 ldx [%sp + STACK_BIAS + 0x70], %i6; \ 536 ldx [%sp + STACK_BIAS + 0x78], %i7; \ 537 restored; \ 538 add %g1, 1, %g1; \ 539 ba,pt %xcc, kern_rtt_restore; \ 540 wrpr %g1, %cwp; \ 541 nop; nop; nop; nop; nop; \ 542 nop; nop; nop; nop; 543 544 545 /* Normal 64bit fill */ 546 #define FILL_1_GENERIC(ASI) \ 547 add %sp, STACK_BIAS + 0x00, %g1; \ 548 ldxa [%g1 + %g0] ASI, %l0; \ 549 mov 0x08, %g2; \ 550 mov 0x10, %g3; \ 551 ldxa [%g1 + %g2] ASI, %l1; \ 552 mov 0x18, %g5; \ 553 ldxa [%g1 + %g3] ASI, %l2; \ 554 ldxa [%g1 + %g5] ASI, %l3; \ 555 add %g1, 0x20, %g1; \ 556 ldxa [%g1 + %g0] ASI, %l4; \ 557 ldxa [%g1 + %g2] ASI, %l5; \ 558 ldxa [%g1 + %g3] ASI, %l6; \ 559 ldxa [%g1 + %g5] ASI, %l7; \ 560 add %g1, 0x20, %g1; \ 561 ldxa [%g1 + %g0] ASI, %i0; \ 562 ldxa [%g1 + %g2] ASI, %i1; \ 563 ldxa [%g1 + %g3] ASI, %i2; \ 564 ldxa [%g1 + %g5] ASI, %i3; \ 565 add %g1, 0x20, %g1; \ 566 ldxa [%g1 + %g0] ASI, %i4; \ 567 ldxa [%g1 + %g2] ASI, %i5; \ 568 ldxa [%g1 + %g3] ASI, %i6; \ 569 ldxa [%g1 + %g5] ASI, %i7; \ 570 restored; \ 571 retry; nop; nop; nop; nop; \ 572 b,a,pt %xcc, fill_fixup_dax; \ 573 b,a,pt %xcc, fill_fixup_mna; \ 574 b,a,pt %xcc, fill_fixup; 575 576 #define FILL_1_GENERIC_RTRAP \ 577 user_rtt_fill_64bit: \ 578 ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \ 579 ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \ 580 ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \ 581 ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \ 582 ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \ 583 ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \ 584 ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \ 585 ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \ 586 ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \ 587 ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \ 588 ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \ 589 ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \ 590 ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \ 591 ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \ 592 ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \ 593 ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \ 594 ba,pt %xcc, user_rtt_pre_restore; \ 595 restored; \ 596 nop; nop; nop; nop; nop; nop; \ 597 nop; nop; nop; nop; nop; \ 598 ba,a,pt %xcc, user_rtt_fill_fixup_dax; \ 599 ba,a,pt %xcc, user_rtt_fill_fixup_mna; \ 600 ba,a,pt %xcc, user_rtt_fill_fixup; 601 602 603 /* Normal 32bit fill */ 604 #define FILL_2_GENERIC(ASI) \ 605 and %sp, 1, %g3; \ 606 brnz,pn %g3, (. - (128 + 4)); \ 607 srl %sp, 0, %sp; \ 608 lduwa [%sp + %g0] ASI, %l0; \ 609 mov 0x04, %g2; \ 610 mov 0x08, %g3; \ 611 lduwa [%sp + %g2] ASI, %l1; \ 612 mov 0x0c, %g5; \ 613 lduwa [%sp + %g3] ASI, %l2; \ 614 lduwa [%sp + %g5] ASI, %l3; \ 615 add %sp, 0x10, %g1; \ 616 lduwa [%g1 + %g0] ASI, %l4; \ 617 lduwa [%g1 + %g2] ASI, %l5; \ 618 lduwa [%g1 + %g3] ASI, %l6; \ 619 lduwa [%g1 + %g5] ASI, %l7; \ 620 add %g1, 0x10, %g1; \ 621 lduwa [%g1 + %g0] ASI, %i0; \ 622 lduwa [%g1 + %g2] ASI, %i1; \ 623 lduwa [%g1 + %g3] ASI, %i2; \ 624 lduwa [%g1 + %g5] ASI, %i3; \ 625 add %g1, 0x10, %g1; \ 626 lduwa [%g1 + %g0] ASI, %i4; \ 627 lduwa [%g1 + %g2] ASI, %i5; \ 628 lduwa [%g1 + %g3] ASI, %i6; \ 629 lduwa [%g1 + %g5] ASI, %i7; \ 630 restored; \ 631 retry; nop; nop; \ 632 b,a,pt %xcc, fill_fixup_dax; \ 633 b,a,pt %xcc, fill_fixup_mna; \ 634 b,a,pt %xcc, fill_fixup; 635 636 #define FILL_2_GENERIC_RTRAP \ 637 user_rtt_fill_32bit: \ 638 and %sp, 1, %g3; \ 639 brnz,pn %g3, user_rtt_fill_64bit; \ 640 srl %sp, 0, %sp; \ 641 lduwa [%sp + 0x00] %asi, %l0; \ 642 lduwa [%sp + 0x04] %asi, %l1; \ 643 lduwa [%sp + 0x08] %asi, %l2; \ 644 lduwa [%sp + 0x0c] %asi, %l3; \ 645 lduwa [%sp + 0x10] %asi, %l4; \ 646 lduwa [%sp + 0x14] %asi, %l5; \ 647 lduwa [%sp + 0x18] %asi, %l6; \ 648 lduwa [%sp + 0x1c] %asi, %l7; \ 649 lduwa [%sp + 0x20] %asi, %i0; \ 650 lduwa [%sp + 0x24] %asi, %i1; \ 651 lduwa [%sp + 0x28] %asi, %i2; \ 652 lduwa [%sp + 0x2c] %asi, %i3; \ 653 lduwa [%sp + 0x30] %asi, %i4; \ 654 lduwa [%sp + 0x34] %asi, %i5; \ 655 lduwa [%sp + 0x38] %asi, %i6; \ 656 lduwa [%sp + 0x3c] %asi, %i7; \ 657 ba,pt %xcc, user_rtt_pre_restore; \ 658 restored; \ 659 nop; nop; nop; nop; nop; \ 660 nop; nop; nop; \ 661 ba,a,pt %xcc, user_rtt_fill_fixup_dax; \ 662 ba,a,pt %xcc, user_rtt_fill_fixup_mna; \ 663 ba,a,pt %xcc, user_rtt_fill_fixup; 664 665 666 #define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP) 667 #define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP) 668 #define FILL_3_NORMAL FILL_0_NORMAL 669 #define FILL_4_NORMAL FILL_0_NORMAL 670 #define FILL_5_NORMAL FILL_0_NORMAL 671 #define FILL_6_NORMAL FILL_0_NORMAL 672 #define FILL_7_NORMAL FILL_0_NORMAL 673 674 #define FILL_0_OTHER FILL_0_NORMAL 675 #define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS) 676 #define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS) 677 #define FILL_3_OTHER FILL_3_NORMAL 678 #define FILL_4_OTHER FILL_4_NORMAL 679 #define FILL_5_OTHER FILL_5_NORMAL 680 #define FILL_6_OTHER FILL_6_NORMAL 681 #define FILL_7_OTHER FILL_7_NORMAL 682 683 #endif /* !(_SPARC64_TTABLE_H) */ 684