ttable.h 19 KB

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