ttable.h 19 KB

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