0001
0002 #ifndef _SPARC64_TTABLE_H
0003 #define _SPARC64_TTABLE_H
0004
0005 #include <asm/utrap.h>
0006 #include <asm/pil.h>
0007
0008 #ifdef __ASSEMBLY__
0009 #include <asm/thread_info.h>
0010 #endif
0011
0012 #define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;
0013
0014
0015 #define CLEAN_WINDOW \
0016 rdpr %cleanwin, %l0; add %l0, 1, %l0; \
0017 wrpr %l0, 0x0, %cleanwin; \
0018 clr %o0; clr %o1; clr %o2; clr %o3; \
0019 clr %o4; clr %o5; clr %o6; clr %o7; \
0020 clr %l0; clr %l1; clr %l2; clr %l3; \
0021 clr %l4; clr %l5; clr %l6; clr %l7; \
0022 retry; \
0023 nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
0024
0025 #define TRAP(routine) \
0026 sethi %hi(109f), %g7; \
0027 ba,pt %xcc, etrap; \
0028 109: or %g7, %lo(109b), %g7; \
0029 call routine; \
0030 add %sp, PTREGS_OFF, %o0; \
0031 ba,pt %xcc, rtrap; \
0032 nop; \
0033 nop;
0034
0035 #define TRAP_7INSNS(routine) \
0036 sethi %hi(109f), %g7; \
0037 ba,pt %xcc, etrap; \
0038 109: or %g7, %lo(109b), %g7; \
0039 call routine; \
0040 add %sp, PTREGS_OFF, %o0; \
0041 ba,pt %xcc, rtrap; \
0042 nop;
0043
0044 #define TRAP_SAVEFPU(routine) \
0045 sethi %hi(109f), %g7; \
0046 ba,pt %xcc, do_fptrap; \
0047 109: or %g7, %lo(109b), %g7; \
0048 call routine; \
0049 add %sp, PTREGS_OFF, %o0; \
0050 ba,pt %xcc, rtrap; \
0051 nop; \
0052 nop;
0053
0054 #define TRAP_NOSAVE(routine) \
0055 ba,pt %xcc, routine; \
0056 nop; \
0057 nop; nop; nop; nop; nop; nop;
0058
0059 #define TRAP_NOSAVE_7INSNS(routine) \
0060 ba,pt %xcc, routine; \
0061 nop; \
0062 nop; nop; nop; nop; nop;
0063
0064 #define TRAPTL1(routine) \
0065 sethi %hi(109f), %g7; \
0066 ba,pt %xcc, etraptl1; \
0067 109: or %g7, %lo(109b), %g7; \
0068 call routine; \
0069 add %sp, PTREGS_OFF, %o0; \
0070 ba,pt %xcc, rtrap; \
0071 nop; \
0072 nop;
0073
0074 #define TRAP_ARG(routine, arg) \
0075 sethi %hi(109f), %g7; \
0076 ba,pt %xcc, etrap; \
0077 109: or %g7, %lo(109b), %g7; \
0078 add %sp, PTREGS_OFF, %o0; \
0079 call routine; \
0080 mov arg, %o1; \
0081 ba,pt %xcc, rtrap; \
0082 nop;
0083
0084 #define TRAPTL1_ARG(routine, arg) \
0085 sethi %hi(109f), %g7; \
0086 ba,pt %xcc, etraptl1; \
0087 109: or %g7, %lo(109b), %g7; \
0088 add %sp, PTREGS_OFF, %o0; \
0089 call routine; \
0090 mov arg, %o1; \
0091 ba,pt %xcc, rtrap; \
0092 nop;
0093
0094 #define SYSCALL_TRAP(routine, systbl) \
0095 rdpr %pil, %g2; \
0096 mov TSTATE_SYSCALL, %g3; \
0097 sethi %hi(109f), %g7; \
0098 ba,pt %xcc, etrap_syscall; \
0099 109: or %g7, %lo(109b), %g7; \
0100 sethi %hi(systbl), %l7; \
0101 ba,pt %xcc, routine; \
0102 or %l7, %lo(systbl), %l7;
0103
0104 #define TRAP_UTRAP(handler,lvl) \
0105 mov handler, %g3; \
0106 ba,pt %xcc, utrap_trap; \
0107 mov lvl, %g4; \
0108 nop; \
0109 nop; \
0110 nop; \
0111 nop; \
0112 nop;
0113
0114 #ifdef CONFIG_COMPAT
0115 #define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)
0116 #else
0117 #define LINUX_32BIT_SYSCALL_TRAP BTRAP(0x110)
0118 #endif
0119 #define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)
0120 #define GETCC_TRAP TRAP(getcc)
0121 #define SETCC_TRAP TRAP(setcc)
0122 #define BREAKPOINT_TRAP TRAP(breakpoint_trap)
0123
0124 #ifdef CONFIG_TRACE_IRQFLAGS
0125
0126 #define TRAP_IRQ(routine, level) \
0127 rdpr %pil, %g2; \
0128 wrpr %g0, PIL_NORMAL_MAX, %pil; \
0129 sethi %hi(1f-4), %g7; \
0130 ba,pt %xcc, etrap_irq; \
0131 or %g7, %lo(1f-4), %g7; \
0132 nop; \
0133 nop; \
0134 nop; \
0135 .subsection 2; \
0136 1: call trace_hardirqs_off; \
0137 nop; \
0138 mov level, %o0; \
0139 call routine; \
0140 add %sp, PTREGS_OFF, %o1; \
0141 ba,a,pt %xcc, rtrap_irq; \
0142 .previous;
0143
0144 #else
0145
0146 #define TRAP_IRQ(routine, level) \
0147 rdpr %pil, %g2; \
0148 wrpr %g0, PIL_NORMAL_MAX, %pil; \
0149 ba,pt %xcc, etrap_irq; \
0150 rd %pc, %g7; \
0151 mov level, %o0; \
0152 call routine; \
0153 add %sp, PTREGS_OFF, %o1; \
0154 ba,a,pt %xcc, rtrap_irq;
0155
0156 #endif
0157
0158 #define TRAP_NMI_IRQ(routine, level) \
0159 rdpr %pil, %g2; \
0160 wrpr %g0, PIL_NMI, %pil; \
0161 ba,pt %xcc, etrap_irq; \
0162 rd %pc, %g7; \
0163 mov level, %o0; \
0164 call routine; \
0165 add %sp, PTREGS_OFF, %o1; \
0166 ba,a,pt %xcc, rtrap_nmi;
0167
0168 #define TRAP_IVEC TRAP_NOSAVE(do_ivec)
0169
0170 #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
0171
0172 #define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)
0173
0174 #define FLUSH_WINDOW_TRAP \
0175 ba,pt %xcc, etrap; \
0176 rd %pc, %g7; \
0177 flushw; \
0178 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1; \
0179 add %l1, 4, %l2; \
0180 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \
0181 ba,pt %xcc, rtrap; \
0182 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC];
0183
0184 #ifdef CONFIG_KPROBES
0185 #define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)
0186 #else
0187 #define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
0188 #endif
0189
0190 #ifdef CONFIG_UPROBES
0191 #define UPROBES_TRAP(lvl) TRAP_ARG(uprobe_trap, lvl)
0192 #else
0193 #define UPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
0194 #endif
0195
0196 #ifdef CONFIG_KGDB
0197 #define KGDB_TRAP(lvl) TRAP_IRQ(kgdb_trap, lvl)
0198 #else
0199 #define KGDB_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
0200 #endif
0201
0202 #define SUN4V_ITSB_MISS \
0203 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
0204 ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \
0205 ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5; \
0206 srlx %g4, 22, %g6; \
0207 ba,pt %xcc, sun4v_itsb_miss; \
0208 nop; \
0209 nop; \
0210 nop;
0211
0212 #define SUN4V_DTSB_MISS \
0213 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
0214 ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \
0215 ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \
0216 srlx %g4, 22, %g6; \
0217 ba,pt %xcc, sun4v_dtsb_miss; \
0218 nop; \
0219 nop; \
0220 nop;
0221
0222 #define SUN4V_MCD_PRECISE \
0223 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
0224 ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \
0225 ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \
0226 ba,pt %xcc, etrap; \
0227 rd %pc, %g7; \
0228 ba,pt %xcc, sun4v_mcd_detect_precise; \
0229 nop; \
0230 nop;
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251 #define SPILL_0_NORMAL \
0252 stx %l0, [%sp + STACK_BIAS + 0x00]; \
0253 stx %l1, [%sp + STACK_BIAS + 0x08]; \
0254 stx %l2, [%sp + STACK_BIAS + 0x10]; \
0255 stx %l3, [%sp + STACK_BIAS + 0x18]; \
0256 stx %l4, [%sp + STACK_BIAS + 0x20]; \
0257 stx %l5, [%sp + STACK_BIAS + 0x28]; \
0258 stx %l6, [%sp + STACK_BIAS + 0x30]; \
0259 stx %l7, [%sp + STACK_BIAS + 0x38]; \
0260 stx %i0, [%sp + STACK_BIAS + 0x40]; \
0261 stx %i1, [%sp + STACK_BIAS + 0x48]; \
0262 stx %i2, [%sp + STACK_BIAS + 0x50]; \
0263 stx %i3, [%sp + STACK_BIAS + 0x58]; \
0264 stx %i4, [%sp + STACK_BIAS + 0x60]; \
0265 stx %i5, [%sp + STACK_BIAS + 0x68]; \
0266 stx %i6, [%sp + STACK_BIAS + 0x70]; \
0267 stx %i7, [%sp + STACK_BIAS + 0x78]; \
0268 saved; retry; nop; nop; nop; nop; nop; nop; \
0269 nop; nop; nop; nop; nop; nop; nop; nop;
0270
0271 #define SPILL_0_NORMAL_ETRAP \
0272 etrap_kernel_spill: \
0273 stx %l0, [%sp + STACK_BIAS + 0x00]; \
0274 stx %l1, [%sp + STACK_BIAS + 0x08]; \
0275 stx %l2, [%sp + STACK_BIAS + 0x10]; \
0276 stx %l3, [%sp + STACK_BIAS + 0x18]; \
0277 stx %l4, [%sp + STACK_BIAS + 0x20]; \
0278 stx %l5, [%sp + STACK_BIAS + 0x28]; \
0279 stx %l6, [%sp + STACK_BIAS + 0x30]; \
0280 stx %l7, [%sp + STACK_BIAS + 0x38]; \
0281 stx %i0, [%sp + STACK_BIAS + 0x40]; \
0282 stx %i1, [%sp + STACK_BIAS + 0x48]; \
0283 stx %i2, [%sp + STACK_BIAS + 0x50]; \
0284 stx %i3, [%sp + STACK_BIAS + 0x58]; \
0285 stx %i4, [%sp + STACK_BIAS + 0x60]; \
0286 stx %i5, [%sp + STACK_BIAS + 0x68]; \
0287 stx %i6, [%sp + STACK_BIAS + 0x70]; \
0288 stx %i7, [%sp + STACK_BIAS + 0x78]; \
0289 saved; \
0290 sub %g1, 2, %g1; \
0291 ba,pt %xcc, etrap_save; \
0292 wrpr %g1, %cwp; \
0293 nop; nop; nop; nop; nop; nop; nop; nop; \
0294 nop; nop; nop; nop;
0295
0296
0297 #define SPILL_1_GENERIC(ASI) \
0298 add %sp, STACK_BIAS + 0x00, %g1; \
0299 stxa %l0, [%g1 + %g0] ASI; \
0300 mov 0x08, %g3; \
0301 stxa %l1, [%g1 + %g3] ASI; \
0302 add %g1, 0x10, %g1; \
0303 stxa %l2, [%g1 + %g0] ASI; \
0304 stxa %l3, [%g1 + %g3] ASI; \
0305 add %g1, 0x10, %g1; \
0306 stxa %l4, [%g1 + %g0] ASI; \
0307 stxa %l5, [%g1 + %g3] ASI; \
0308 add %g1, 0x10, %g1; \
0309 stxa %l6, [%g1 + %g0] ASI; \
0310 stxa %l7, [%g1 + %g3] ASI; \
0311 add %g1, 0x10, %g1; \
0312 stxa %i0, [%g1 + %g0] ASI; \
0313 stxa %i1, [%g1 + %g3] ASI; \
0314 add %g1, 0x10, %g1; \
0315 stxa %i2, [%g1 + %g0] ASI; \
0316 stxa %i3, [%g1 + %g3] ASI; \
0317 add %g1, 0x10, %g1; \
0318 stxa %i4, [%g1 + %g0] ASI; \
0319 stxa %i5, [%g1 + %g3] ASI; \
0320 add %g1, 0x10, %g1; \
0321 stxa %i6, [%g1 + %g0] ASI; \
0322 stxa %i7, [%g1 + %g3] ASI; \
0323 saved; \
0324 retry; nop; nop; \
0325 b,a,pt %xcc, spill_fixup_dax; \
0326 b,a,pt %xcc, spill_fixup_mna; \
0327 b,a,pt %xcc, spill_fixup;
0328
0329 #define SPILL_1_GENERIC_ETRAP \
0330 etrap_user_spill_64bit: \
0331 stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \
0332 stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \
0333 stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \
0334 stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \
0335 stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \
0336 stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \
0337 stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \
0338 stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \
0339 stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \
0340 stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \
0341 stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \
0342 stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \
0343 stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \
0344 stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \
0345 stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \
0346 stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \
0347 saved; \
0348 sub %g1, 2, %g1; \
0349 ba,pt %xcc, etrap_save; \
0350 wrpr %g1, %cwp; \
0351 nop; nop; nop; nop; nop; \
0352 nop; nop; nop; nop; \
0353 ba,a,pt %xcc, etrap_spill_fixup_64bit; \
0354 ba,a,pt %xcc, etrap_spill_fixup_64bit; \
0355 ba,a,pt %xcc, etrap_spill_fixup_64bit;
0356
0357 #define SPILL_1_GENERIC_ETRAP_FIXUP \
0358 etrap_spill_fixup_64bit: \
0359 ldub [%g6 + TI_WSAVED], %g1; \
0360 sll %g1, 3, %g3; \
0361 add %g6, %g3, %g3; \
0362 stx %sp, [%g3 + TI_RWIN_SPTRS]; \
0363 sll %g1, 7, %g3; \
0364 add %g6, %g3, %g3; \
0365 stx %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
0366 stx %l1, [%g3 + TI_REG_WINDOW + 0x08]; \
0367 stx %l2, [%g3 + TI_REG_WINDOW + 0x10]; \
0368 stx %l3, [%g3 + TI_REG_WINDOW + 0x18]; \
0369 stx %l4, [%g3 + TI_REG_WINDOW + 0x20]; \
0370 stx %l5, [%g3 + TI_REG_WINDOW + 0x28]; \
0371 stx %l6, [%g3 + TI_REG_WINDOW + 0x30]; \
0372 stx %l7, [%g3 + TI_REG_WINDOW + 0x38]; \
0373 stx %i0, [%g3 + TI_REG_WINDOW + 0x40]; \
0374 stx %i1, [%g3 + TI_REG_WINDOW + 0x48]; \
0375 stx %i2, [%g3 + TI_REG_WINDOW + 0x50]; \
0376 stx %i3, [%g3 + TI_REG_WINDOW + 0x58]; \
0377 stx %i4, [%g3 + TI_REG_WINDOW + 0x60]; \
0378 stx %i5, [%g3 + TI_REG_WINDOW + 0x68]; \
0379 stx %i6, [%g3 + TI_REG_WINDOW + 0x70]; \
0380 stx %i7, [%g3 + TI_REG_WINDOW + 0x78]; \
0381 add %g1, 1, %g1; \
0382 stb %g1, [%g6 + TI_WSAVED]; \
0383 saved; \
0384 rdpr %cwp, %g1; \
0385 sub %g1, 2, %g1; \
0386 ba,pt %xcc, etrap_save; \
0387 wrpr %g1, %cwp; \
0388 nop; nop; nop
0389
0390
0391 #define SPILL_2_GENERIC(ASI) \
0392 and %sp, 1, %g3; \
0393 brnz,pn %g3, (. - (128 + 4)); \
0394 srl %sp, 0, %sp; \
0395 stwa %l0, [%sp + %g0] ASI; \
0396 mov 0x04, %g3; \
0397 stwa %l1, [%sp + %g3] ASI; \
0398 add %sp, 0x08, %g1; \
0399 stwa %l2, [%g1 + %g0] ASI; \
0400 stwa %l3, [%g1 + %g3] ASI; \
0401 add %g1, 0x08, %g1; \
0402 stwa %l4, [%g1 + %g0] ASI; \
0403 stwa %l5, [%g1 + %g3] ASI; \
0404 add %g1, 0x08, %g1; \
0405 stwa %l6, [%g1 + %g0] ASI; \
0406 stwa %l7, [%g1 + %g3] ASI; \
0407 add %g1, 0x08, %g1; \
0408 stwa %i0, [%g1 + %g0] ASI; \
0409 stwa %i1, [%g1 + %g3] ASI; \
0410 add %g1, 0x08, %g1; \
0411 stwa %i2, [%g1 + %g0] ASI; \
0412 stwa %i3, [%g1 + %g3] ASI; \
0413 add %g1, 0x08, %g1; \
0414 stwa %i4, [%g1 + %g0] ASI; \
0415 stwa %i5, [%g1 + %g3] ASI; \
0416 add %g1, 0x08, %g1; \
0417 stwa %i6, [%g1 + %g0] ASI; \
0418 stwa %i7, [%g1 + %g3] ASI; \
0419 saved; \
0420 retry; \
0421 b,a,pt %xcc, spill_fixup_dax; \
0422 b,a,pt %xcc, spill_fixup_mna; \
0423 b,a,pt %xcc, spill_fixup;
0424
0425 #define SPILL_2_GENERIC_ETRAP \
0426 etrap_user_spill_32bit: \
0427 and %sp, 1, %g3; \
0428 brnz,pn %g3, etrap_user_spill_64bit; \
0429 srl %sp, 0, %sp; \
0430 stwa %l0, [%sp + 0x00] %asi; \
0431 stwa %l1, [%sp + 0x04] %asi; \
0432 stwa %l2, [%sp + 0x08] %asi; \
0433 stwa %l3, [%sp + 0x0c] %asi; \
0434 stwa %l4, [%sp + 0x10] %asi; \
0435 stwa %l5, [%sp + 0x14] %asi; \
0436 stwa %l6, [%sp + 0x18] %asi; \
0437 stwa %l7, [%sp + 0x1c] %asi; \
0438 stwa %i0, [%sp + 0x20] %asi; \
0439 stwa %i1, [%sp + 0x24] %asi; \
0440 stwa %i2, [%sp + 0x28] %asi; \
0441 stwa %i3, [%sp + 0x2c] %asi; \
0442 stwa %i4, [%sp + 0x30] %asi; \
0443 stwa %i5, [%sp + 0x34] %asi; \
0444 stwa %i6, [%sp + 0x38] %asi; \
0445 stwa %i7, [%sp + 0x3c] %asi; \
0446 saved; \
0447 sub %g1, 2, %g1; \
0448 ba,pt %xcc, etrap_save; \
0449 wrpr %g1, %cwp; \
0450 nop; nop; nop; nop; \
0451 nop; nop; \
0452 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
0453 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
0454 ba,a,pt %xcc, etrap_spill_fixup_32bit;
0455
0456 #define SPILL_2_GENERIC_ETRAP_FIXUP \
0457 etrap_spill_fixup_32bit: \
0458 ldub [%g6 + TI_WSAVED], %g1; \
0459 sll %g1, 3, %g3; \
0460 add %g6, %g3, %g3; \
0461 stx %sp, [%g3 + TI_RWIN_SPTRS]; \
0462 sll %g1, 7, %g3; \
0463 add %g6, %g3, %g3; \
0464 stw %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
0465 stw %l1, [%g3 + TI_REG_WINDOW + 0x04]; \
0466 stw %l2, [%g3 + TI_REG_WINDOW + 0x08]; \
0467 stw %l3, [%g3 + TI_REG_WINDOW + 0x0c]; \
0468 stw %l4, [%g3 + TI_REG_WINDOW + 0x10]; \
0469 stw %l5, [%g3 + TI_REG_WINDOW + 0x14]; \
0470 stw %l6, [%g3 + TI_REG_WINDOW + 0x18]; \
0471 stw %l7, [%g3 + TI_REG_WINDOW + 0x1c]; \
0472 stw %i0, [%g3 + TI_REG_WINDOW + 0x20]; \
0473 stw %i1, [%g3 + TI_REG_WINDOW + 0x24]; \
0474 stw %i2, [%g3 + TI_REG_WINDOW + 0x28]; \
0475 stw %i3, [%g3 + TI_REG_WINDOW + 0x2c]; \
0476 stw %i4, [%g3 + TI_REG_WINDOW + 0x30]; \
0477 stw %i5, [%g3 + TI_REG_WINDOW + 0x34]; \
0478 stw %i6, [%g3 + TI_REG_WINDOW + 0x38]; \
0479 stw %i7, [%g3 + TI_REG_WINDOW + 0x3c]; \
0480 add %g1, 1, %g1; \
0481 stb %g1, [%g6 + TI_WSAVED]; \
0482 saved; \
0483 rdpr %cwp, %g1; \
0484 sub %g1, 2, %g1; \
0485 ba,pt %xcc, etrap_save; \
0486 wrpr %g1, %cwp; \
0487 nop; nop; nop
0488
0489 #define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
0490 #define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
0491 #define SPILL_3_NORMAL SPILL_0_NORMAL
0492 #define SPILL_4_NORMAL SPILL_0_NORMAL
0493 #define SPILL_5_NORMAL SPILL_0_NORMAL
0494 #define SPILL_6_NORMAL SPILL_0_NORMAL
0495 #define SPILL_7_NORMAL SPILL_0_NORMAL
0496
0497 #define SPILL_0_OTHER SPILL_0_NORMAL
0498 #define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS)
0499 #define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS)
0500 #define SPILL_3_OTHER SPILL_3_NORMAL
0501 #define SPILL_4_OTHER SPILL_4_NORMAL
0502 #define SPILL_5_OTHER SPILL_5_NORMAL
0503 #define SPILL_6_OTHER SPILL_6_NORMAL
0504 #define SPILL_7_OTHER SPILL_7_NORMAL
0505
0506
0507 #define FILL_0_NORMAL \
0508 ldx [%sp + STACK_BIAS + 0x00], %l0; \
0509 ldx [%sp + STACK_BIAS + 0x08], %l1; \
0510 ldx [%sp + STACK_BIAS + 0x10], %l2; \
0511 ldx [%sp + STACK_BIAS + 0x18], %l3; \
0512 ldx [%sp + STACK_BIAS + 0x20], %l4; \
0513 ldx [%sp + STACK_BIAS + 0x28], %l5; \
0514 ldx [%sp + STACK_BIAS + 0x30], %l6; \
0515 ldx [%sp + STACK_BIAS + 0x38], %l7; \
0516 ldx [%sp + STACK_BIAS + 0x40], %i0; \
0517 ldx [%sp + STACK_BIAS + 0x48], %i1; \
0518 ldx [%sp + STACK_BIAS + 0x50], %i2; \
0519 ldx [%sp + STACK_BIAS + 0x58], %i3; \
0520 ldx [%sp + STACK_BIAS + 0x60], %i4; \
0521 ldx [%sp + STACK_BIAS + 0x68], %i5; \
0522 ldx [%sp + STACK_BIAS + 0x70], %i6; \
0523 ldx [%sp + STACK_BIAS + 0x78], %i7; \
0524 restored; retry; nop; nop; nop; nop; nop; nop; \
0525 nop; nop; nop; nop; nop; nop; nop; nop;
0526
0527 #define FILL_0_NORMAL_RTRAP \
0528 kern_rtt_fill: \
0529 rdpr %cwp, %g1; \
0530 sub %g1, 1, %g1; \
0531 wrpr %g1, %cwp; \
0532 ldx [%sp + STACK_BIAS + 0x00], %l0; \
0533 ldx [%sp + STACK_BIAS + 0x08], %l1; \
0534 ldx [%sp + STACK_BIAS + 0x10], %l2; \
0535 ldx [%sp + STACK_BIAS + 0x18], %l3; \
0536 ldx [%sp + STACK_BIAS + 0x20], %l4; \
0537 ldx [%sp + STACK_BIAS + 0x28], %l5; \
0538 ldx [%sp + STACK_BIAS + 0x30], %l6; \
0539 ldx [%sp + STACK_BIAS + 0x38], %l7; \
0540 ldx [%sp + STACK_BIAS + 0x40], %i0; \
0541 ldx [%sp + STACK_BIAS + 0x48], %i1; \
0542 ldx [%sp + STACK_BIAS + 0x50], %i2; \
0543 ldx [%sp + STACK_BIAS + 0x58], %i3; \
0544 ldx [%sp + STACK_BIAS + 0x60], %i4; \
0545 ldx [%sp + STACK_BIAS + 0x68], %i5; \
0546 ldx [%sp + STACK_BIAS + 0x70], %i6; \
0547 ldx [%sp + STACK_BIAS + 0x78], %i7; \
0548 restored; \
0549 add %g1, 1, %g1; \
0550 ba,pt %xcc, kern_rtt_restore; \
0551 wrpr %g1, %cwp; \
0552 nop; nop; nop; nop; nop; \
0553 nop; nop; nop; nop;
0554
0555
0556
0557 #define FILL_1_GENERIC(ASI) \
0558 add %sp, STACK_BIAS + 0x00, %g1; \
0559 ldxa [%g1 + %g0] ASI, %l0; \
0560 mov 0x08, %g2; \
0561 mov 0x10, %g3; \
0562 ldxa [%g1 + %g2] ASI, %l1; \
0563 mov 0x18, %g5; \
0564 ldxa [%g1 + %g3] ASI, %l2; \
0565 ldxa [%g1 + %g5] ASI, %l3; \
0566 add %g1, 0x20, %g1; \
0567 ldxa [%g1 + %g0] ASI, %l4; \
0568 ldxa [%g1 + %g2] ASI, %l5; \
0569 ldxa [%g1 + %g3] ASI, %l6; \
0570 ldxa [%g1 + %g5] ASI, %l7; \
0571 add %g1, 0x20, %g1; \
0572 ldxa [%g1 + %g0] ASI, %i0; \
0573 ldxa [%g1 + %g2] ASI, %i1; \
0574 ldxa [%g1 + %g3] ASI, %i2; \
0575 ldxa [%g1 + %g5] ASI, %i3; \
0576 add %g1, 0x20, %g1; \
0577 ldxa [%g1 + %g0] ASI, %i4; \
0578 ldxa [%g1 + %g2] ASI, %i5; \
0579 ldxa [%g1 + %g3] ASI, %i6; \
0580 ldxa [%g1 + %g5] ASI, %i7; \
0581 restored; \
0582 retry; nop; nop; nop; nop; \
0583 b,a,pt %xcc, fill_fixup_dax; \
0584 b,a,pt %xcc, fill_fixup_mna; \
0585 b,a,pt %xcc, fill_fixup;
0586
0587 #define FILL_1_GENERIC_RTRAP \
0588 user_rtt_fill_64bit: \
0589 ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \
0590 ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \
0591 ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \
0592 ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \
0593 ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \
0594 ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \
0595 ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \
0596 ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \
0597 ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \
0598 ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \
0599 ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \
0600 ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \
0601 ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \
0602 ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \
0603 ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \
0604 ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \
0605 ba,pt %xcc, user_rtt_pre_restore; \
0606 restored; \
0607 nop; nop; nop; nop; nop; nop; \
0608 nop; nop; nop; nop; nop; \
0609 ba,a,pt %xcc, user_rtt_fill_fixup_dax; \
0610 ba,a,pt %xcc, user_rtt_fill_fixup_mna; \
0611 ba,a,pt %xcc, user_rtt_fill_fixup;
0612
0613
0614
0615 #define FILL_2_GENERIC(ASI) \
0616 and %sp, 1, %g3; \
0617 brnz,pn %g3, (. - (128 + 4)); \
0618 srl %sp, 0, %sp; \
0619 lduwa [%sp + %g0] ASI, %l0; \
0620 mov 0x04, %g2; \
0621 mov 0x08, %g3; \
0622 lduwa [%sp + %g2] ASI, %l1; \
0623 mov 0x0c, %g5; \
0624 lduwa [%sp + %g3] ASI, %l2; \
0625 lduwa [%sp + %g5] ASI, %l3; \
0626 add %sp, 0x10, %g1; \
0627 lduwa [%g1 + %g0] ASI, %l4; \
0628 lduwa [%g1 + %g2] ASI, %l5; \
0629 lduwa [%g1 + %g3] ASI, %l6; \
0630 lduwa [%g1 + %g5] ASI, %l7; \
0631 add %g1, 0x10, %g1; \
0632 lduwa [%g1 + %g0] ASI, %i0; \
0633 lduwa [%g1 + %g2] ASI, %i1; \
0634 lduwa [%g1 + %g3] ASI, %i2; \
0635 lduwa [%g1 + %g5] ASI, %i3; \
0636 add %g1, 0x10, %g1; \
0637 lduwa [%g1 + %g0] ASI, %i4; \
0638 lduwa [%g1 + %g2] ASI, %i5; \
0639 lduwa [%g1 + %g3] ASI, %i6; \
0640 lduwa [%g1 + %g5] ASI, %i7; \
0641 restored; \
0642 retry; nop; nop; \
0643 b,a,pt %xcc, fill_fixup_dax; \
0644 b,a,pt %xcc, fill_fixup_mna; \
0645 b,a,pt %xcc, fill_fixup;
0646
0647 #define FILL_2_GENERIC_RTRAP \
0648 user_rtt_fill_32bit: \
0649 and %sp, 1, %g3; \
0650 brnz,pn %g3, user_rtt_fill_64bit; \
0651 srl %sp, 0, %sp; \
0652 lduwa [%sp + 0x00] %asi, %l0; \
0653 lduwa [%sp + 0x04] %asi, %l1; \
0654 lduwa [%sp + 0x08] %asi, %l2; \
0655 lduwa [%sp + 0x0c] %asi, %l3; \
0656 lduwa [%sp + 0x10] %asi, %l4; \
0657 lduwa [%sp + 0x14] %asi, %l5; \
0658 lduwa [%sp + 0x18] %asi, %l6; \
0659 lduwa [%sp + 0x1c] %asi, %l7; \
0660 lduwa [%sp + 0x20] %asi, %i0; \
0661 lduwa [%sp + 0x24] %asi, %i1; \
0662 lduwa [%sp + 0x28] %asi, %i2; \
0663 lduwa [%sp + 0x2c] %asi, %i3; \
0664 lduwa [%sp + 0x30] %asi, %i4; \
0665 lduwa [%sp + 0x34] %asi, %i5; \
0666 lduwa [%sp + 0x38] %asi, %i6; \
0667 lduwa [%sp + 0x3c] %asi, %i7; \
0668 ba,pt %xcc, user_rtt_pre_restore; \
0669 restored; \
0670 nop; nop; nop; nop; nop; \
0671 nop; nop; nop; \
0672 ba,a,pt %xcc, user_rtt_fill_fixup_dax; \
0673 ba,a,pt %xcc, user_rtt_fill_fixup_mna; \
0674 ba,a,pt %xcc, user_rtt_fill_fixup;
0675
0676
0677 #define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
0678 #define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
0679 #define FILL_3_NORMAL FILL_0_NORMAL
0680 #define FILL_4_NORMAL FILL_0_NORMAL
0681 #define FILL_5_NORMAL FILL_0_NORMAL
0682 #define FILL_6_NORMAL FILL_0_NORMAL
0683 #define FILL_7_NORMAL FILL_0_NORMAL
0684
0685 #define FILL_0_OTHER FILL_0_NORMAL
0686 #define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS)
0687 #define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS)
0688 #define FILL_3_OTHER FILL_3_NORMAL
0689 #define FILL_4_OTHER FILL_4_NORMAL
0690 #define FILL_5_OTHER FILL_5_NORMAL
0691 #define FILL_6_OTHER FILL_6_NORMAL
0692 #define FILL_7_OTHER FILL_7_NORMAL
0693
0694 #endif