head.S 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. /* $Id: head.S,v 1.105 2001/08/12 09:08:56 davem Exp $
  2. * head.S: The initial boot code for the Sparc port of Linux.
  3. *
  4. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  5. * Copyright (C) 1995,1999 Pete Zaitcev (zaitcev@yahoo.com)
  6. * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
  7. * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  8. * Copyright (C) 1997 Michael A. Griffith (grif@acm.org)
  9. *
  10. * CompactPCI platform by Eric Brower, 1999.
  11. */
  12. #include <linux/version.h>
  13. #include <linux/config.h>
  14. #include <linux/init.h>
  15. #include <asm/head.h>
  16. #include <asm/asi.h>
  17. #include <asm/contregs.h>
  18. #include <asm/ptrace.h>
  19. #include <asm/psr.h>
  20. #include <asm/page.h>
  21. #include <asm/kdebug.h>
  22. #include <asm/winmacro.h>
  23. #include <asm/thread_info.h> /* TI_UWINMASK */
  24. #include <asm/errno.h>
  25. #include <asm/pgtsrmmu.h> /* SRMMU_PGDIR_SHIFT */
  26. .data
  27. /*
  28. * The following are used with the prom_vector node-ops to figure out
  29. * the cpu-type
  30. */
  31. .align 4
  32. .globl cputyp
  33. cputyp:
  34. .word 1
  35. .align 4
  36. .globl cputypval
  37. cputypval:
  38. .asciz "sun4c"
  39. .ascii " "
  40. cputypvalend:
  41. cputypvallen = cputypvar - cputypval
  42. .align 4
  43. /*
  44. * Sun people can't spell worth damn. "compatability" indeed.
  45. * At least we *know* we can't spell, and use a spell-checker.
  46. */
  47. /* Uh, actually Linus it is I who cannot spell. Too much murky
  48. * Sparc assembly will do this to ya.
  49. */
  50. cputypvar:
  51. .asciz "compatability"
  52. /* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */
  53. .align 4
  54. cputypvar_sun4m:
  55. .asciz "compatible"
  56. .align 4
  57. #ifndef CONFIG_SUN4
  58. sun4_notsup:
  59. .asciz "Sparc-Linux sun4 needs a specially compiled kernel, turn CONFIG_SUN4 on.\n\n"
  60. .align 4
  61. #else
  62. sun4cdm_notsup:
  63. .asciz "Kernel compiled with CONFIG_SUN4 cannot run on SUN4C/SUN4M/SUN4D\nTurn CONFIG_SUN4 off.\n\n"
  64. .align 4
  65. #endif
  66. sun4e_notsup:
  67. .asciz "Sparc-Linux sun4e support does not exist\n\n"
  68. .align 4
  69. #ifndef CONFIG_SUNOS_EMUL
  70. #undef SUNOS_SYSCALL_TRAP
  71. #define SUNOS_SYSCALL_TRAP SUNOS_NO_SYSCALL_TRAP
  72. #endif
  73. /* The Sparc trap table, bootloader gives us control at _start. */
  74. .text
  75. .globl start, _stext, _start, __stext
  76. .globl trapbase
  77. _start: /* danger danger */
  78. __stext:
  79. _stext:
  80. start:
  81. trapbase:
  82. #ifdef CONFIG_SMP
  83. trapbase_cpu0:
  84. #endif
  85. /* We get control passed to us here at t_zero. */
  86. t_zero: b gokernel; nop; nop; nop;
  87. t_tflt: SPARC_TFAULT /* Inst. Access Exception */
  88. t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
  89. t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
  90. t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
  91. t_wovf: WINDOW_SPILL /* Window Overflow */
  92. t_wunf: WINDOW_FILL /* Window Underflow */
  93. t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
  94. t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
  95. t_dflt: SPARC_DFAULT /* Data Miss Exception */
  96. t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
  97. t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
  98. t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  99. t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
  100. t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
  101. t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
  102. t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
  103. t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
  104. t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
  105. t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
  106. t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
  107. t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
  108. t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
  109. t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
  110. t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
  111. t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
  112. t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
  113. .globl t_nmi
  114. #ifndef CONFIG_SMP
  115. t_nmi: NMI_TRAP /* Level 15 (NMI) */
  116. #else
  117. t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  118. #endif
  119. t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
  120. t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
  121. t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
  122. t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
  123. t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
  124. t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
  125. t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
  126. t_dacce:SPARC_DFAULT /* Data Access Error */
  127. t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
  128. t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
  129. t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
  130. t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  131. t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  132. t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  133. t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
  134. t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
  135. t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
  136. t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
  137. t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
  138. t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  139. t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  140. t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  141. t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  142. t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  143. t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  144. t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  145. t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  146. t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  147. t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  148. t_sunos:SUNOS_SYSCALL_TRAP /* SunOS System Call */
  149. t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
  150. t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
  151. t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
  152. t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
  153. t_rchk: BAD_TRAP(0x85) /* Range Check */
  154. t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
  155. t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
  156. t_slowl:SOLARIS_SYSCALL_TRAP /* Slowaris System Call */
  157. t_netbs:NETBSD_SYSCALL_TRAP /* Net-B.S. System Call */
  158. t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
  159. t_bad8f:BAD_TRAP(0x8f)
  160. t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
  161. t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
  162. t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
  163. t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
  164. t_getcc:GETCC_TRAP /* Get Condition Codes */
  165. t_setcc:SETCC_TRAP /* Set Condition Codes */
  166. t_getpsr:GETPSR_TRAP /* Get PSR Register */
  167. t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  168. t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
  169. t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  170. t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  171. t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  172. t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  173. t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  174. t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  175. t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  176. t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  177. t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  178. t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  179. t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  180. t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  181. t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  182. t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  183. t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  184. t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  185. t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  186. t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
  187. dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
  188. dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
  189. .globl end_traptable
  190. end_traptable:
  191. #ifdef CONFIG_SMP
  192. /* Trap tables for the other cpus. */
  193. .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3
  194. trapbase_cpu1:
  195. BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
  196. TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
  197. WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
  198. TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
  199. TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
  200. BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  201. TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
  202. TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
  203. TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
  204. TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
  205. TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
  206. TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
  207. TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
  208. TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  209. TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
  210. BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
  211. BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
  212. SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
  213. BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  214. BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  215. BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  216. BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
  217. BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
  218. BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
  219. BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
  220. BAD_TRAP(0x50)
  221. BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  222. BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  223. BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  224. BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  225. BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  226. BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  227. BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  228. BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  229. BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  230. BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  231. SUNOS_SYSCALL_TRAP
  232. BREAKPOINT_TRAP
  233. TRAP_ENTRY(0x82, do_hw_divzero)
  234. TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
  235. BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
  236. NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
  237. BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
  238. LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
  239. BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
  240. BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
  241. BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
  242. BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  243. INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  244. BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  245. BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  246. BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  247. BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  248. BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  249. BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  250. BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  251. BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  252. BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  253. BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  254. BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  255. BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  256. BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  257. BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  258. BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  259. BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  260. BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
  261. trapbase_cpu2:
  262. BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
  263. TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
  264. WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
  265. TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
  266. TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
  267. BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  268. TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
  269. TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
  270. TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
  271. TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
  272. TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
  273. TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
  274. TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
  275. TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  276. TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
  277. BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
  278. BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
  279. SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
  280. BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  281. BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  282. BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  283. BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
  284. BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
  285. BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
  286. BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
  287. BAD_TRAP(0x50)
  288. BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  289. BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  290. BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  291. BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  292. BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  293. BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  294. BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  295. BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  296. BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  297. BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  298. SUNOS_SYSCALL_TRAP
  299. BREAKPOINT_TRAP
  300. TRAP_ENTRY(0x82, do_hw_divzero)
  301. TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
  302. BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
  303. NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
  304. BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
  305. LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
  306. BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
  307. BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
  308. BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
  309. BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  310. INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  311. BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  312. BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  313. BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  314. BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  315. BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  316. BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  317. BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  318. BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  319. BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  320. BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  321. BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  322. BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  323. BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  324. BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  325. BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  326. BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  327. BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
  328. trapbase_cpu3:
  329. BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
  330. TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
  331. WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
  332. TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
  333. TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
  334. BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  335. TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
  336. TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
  337. TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
  338. TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
  339. TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
  340. TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
  341. TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
  342. TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  343. TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
  344. BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
  345. BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
  346. SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
  347. BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  348. BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  349. BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  350. BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
  351. BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
  352. BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
  353. BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
  354. BAD_TRAP(0x50)
  355. BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  356. BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  357. BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  358. BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  359. BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  360. BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  361. BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  362. BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  363. BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  364. BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  365. SUNOS_SYSCALL_TRAP
  366. BREAKPOINT_TRAP
  367. TRAP_ENTRY(0x82, do_hw_divzero)
  368. TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
  369. BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
  370. NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
  371. BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
  372. LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
  373. BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
  374. BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
  375. BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
  376. BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  377. INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  378. BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  379. BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  380. BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  381. BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  382. BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  383. BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  384. BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  385. BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  386. BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  387. BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  388. BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  389. BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  390. BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  391. BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  392. BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  393. BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  394. BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
  395. #endif
  396. .align PAGE_SIZE
  397. /* This was the only reasonable way I could think of to properly align
  398. * these page-table data structures.
  399. */
  400. .globl pg0, pg1, pg2, pg3
  401. .globl empty_bad_page
  402. .globl empty_bad_page_table
  403. .globl empty_zero_page
  404. .globl swapper_pg_dir
  405. swapper_pg_dir: .skip PAGE_SIZE
  406. pg0: .skip PAGE_SIZE
  407. pg1: .skip PAGE_SIZE
  408. pg2: .skip PAGE_SIZE
  409. pg3: .skip PAGE_SIZE
  410. empty_bad_page: .skip PAGE_SIZE
  411. empty_bad_page_table: .skip PAGE_SIZE
  412. empty_zero_page: .skip PAGE_SIZE
  413. .global root_flags
  414. .global ram_flags
  415. .global root_dev
  416. .global sparc_ramdisk_image
  417. .global sparc_ramdisk_size
  418. /* This stuff has to be in sync with SILO and other potential boot loaders
  419. * Fields should be kept upward compatible and whenever any change is made,
  420. * HdrS version should be incremented.
  421. */
  422. .ascii "HdrS"
  423. .word LINUX_VERSION_CODE
  424. .half 0x0203 /* HdrS version */
  425. root_flags:
  426. .half 1
  427. root_dev:
  428. .half 0
  429. ram_flags:
  430. .half 0
  431. sparc_ramdisk_image:
  432. .word 0
  433. sparc_ramdisk_size:
  434. .word 0
  435. .word reboot_command
  436. .word 0, 0, 0
  437. .word _end
  438. /* Cool, here we go. Pick up the romvec pointer in %o0 and stash it in
  439. * %g7 and at prom_vector_p. And also quickly check whether we are on
  440. * a v0, v2, or v3 prom.
  441. */
  442. gokernel:
  443. /* Ok, it's nice to know, as early as possible, if we
  444. * are already mapped where we expect to be in virtual
  445. * memory. The Solaris /boot elf format bootloader
  446. * will peek into our elf header and load us where
  447. * we want to be, otherwise we have to re-map.
  448. *
  449. * Some boot loaders don't place the jmp'rs address
  450. * in %o7, so we do a pc-relative call to a local
  451. * label, then see what %o7 has.
  452. */
  453. mov %o7, %g4 ! Save %o7
  454. /* Jump to it, and pray... */
  455. current_pc:
  456. call 1f
  457. nop
  458. 1:
  459. mov %o7, %g3
  460. tst %o0
  461. be no_sun4u_here
  462. mov %g4, %o7 /* Previous %o7. */
  463. mov %o0, %l0 ! stash away romvec
  464. mov %o0, %g7 ! put it here too
  465. mov %o1, %l1 ! stash away debug_vec too
  466. /* Ok, let's check out our run time program counter. */
  467. set current_pc, %g5
  468. cmp %g3, %g5
  469. be already_mapped
  470. nop
  471. /* %l6 will hold the offset we have to subtract
  472. * from absolute symbols in order to access areas
  473. * in our own image. If already mapped this is
  474. * just plain zero, else it is KERNBASE.
  475. */
  476. set KERNBASE, %l6
  477. b copy_prom_lvl14
  478. nop
  479. already_mapped:
  480. mov 0, %l6
  481. /* Copy over the Prom's level 14 clock handler. */
  482. copy_prom_lvl14:
  483. #if 1
  484. /* DJHR
  485. * preserve our linked/calculated instructions
  486. */
  487. set lvl14_save, %g1
  488. set t_irq14, %g3
  489. sub %g1, %l6, %g1 ! translate to physical
  490. sub %g3, %l6, %g3 ! translate to physical
  491. ldd [%g3], %g4
  492. std %g4, [%g1]
  493. ldd [%g3+8], %g4
  494. std %g4, [%g1+8]
  495. #endif
  496. rd %tbr, %g1
  497. andn %g1, 0xfff, %g1 ! proms trap table base
  498. or %g0, (0x1e<<4), %g2 ! offset to lvl14 intr
  499. or %g1, %g2, %g2
  500. set t_irq14, %g3
  501. sub %g3, %l6, %g3
  502. ldd [%g2], %g4
  503. std %g4, [%g3]
  504. ldd [%g2 + 0x8], %g4
  505. std %g4, [%g3 + 0x8] ! Copy proms handler
  506. /* Must determine whether we are on a sun4c MMU, SRMMU, or SUN4/400 MUTANT
  507. * MMU so we can remap ourselves properly. DON'T TOUCH %l0 thru %l5 in these
  508. * remapping routines, we need their values afterwards!
  509. */
  510. /* Now check whether we are already mapped, if we
  511. * are we can skip all this garbage coming up.
  512. */
  513. copy_prom_done:
  514. cmp %l6, 0
  515. be go_to_highmem ! this will be a nop then
  516. nop
  517. set LOAD_ADDR, %g6
  518. cmp %g7, %g6
  519. bne remap_not_a_sun4 ! This is not a Sun4
  520. nop
  521. or %g0, 0x1, %g1
  522. lduba [%g1] ASI_CONTROL, %g1 ! Only safe to try on Sun4.
  523. subcc %g1, 0x24, %g0 ! Is this a mutant Sun4/400???
  524. be sun4_mutant_remap ! Ugh, it is...
  525. nop
  526. b sun4_normal_remap ! regular sun4, 2 level mmu
  527. nop
  528. remap_not_a_sun4:
  529. lda [%g0] ASI_M_MMUREGS, %g1 ! same as ASI_PTE on sun4c
  530. and %g1, 0x1, %g1 ! Test SRMMU Enable bit ;-)
  531. cmp %g1, 0x0
  532. be sun4c_remap ! A sun4c MMU or normal Sun4
  533. nop
  534. srmmu_remap:
  535. /* First, check for a viking (TI) module. */
  536. set 0x40000000, %g2
  537. rd %psr, %g3
  538. and %g2, %g3, %g3
  539. subcc %g3, 0x0, %g0
  540. bz srmmu_nviking
  541. nop
  542. /* Figure out what kind of viking we are on.
  543. * We need to know if we have to play with the
  544. * AC bit and disable traps or not.
  545. */
  546. /* I've only seen MicroSparc's on SparcClassics with this
  547. * bit set.
  548. */
  549. set 0x800, %g2
  550. lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg
  551. and %g2, %g3, %g3
  552. subcc %g3, 0x0, %g0
  553. bnz srmmu_nviking ! is in mbus mode
  554. nop
  555. rd %psr, %g3 ! DO NOT TOUCH %g3
  556. andn %g3, PSR_ET, %g2
  557. wr %g2, 0x0, %psr
  558. WRITE_PAUSE
  559. /* Get context table pointer, then convert to
  560. * a physical address, which is 36 bits.
  561. */
  562. set AC_M_CTPR, %g4
  563. lda [%g4] ASI_M_MMUREGS, %g4
  564. sll %g4, 0x4, %g4 ! We use this below
  565. ! DO NOT TOUCH %g4
  566. /* Set the AC bit in the Viking's MMU control reg. */
  567. lda [%g0] ASI_M_MMUREGS, %g5 ! DO NOT TOUCH %g5
  568. set 0x8000, %g6 ! AC bit mask
  569. or %g5, %g6, %g6 ! Or it in...
  570. sta %g6, [%g0] ASI_M_MMUREGS ! Close your eyes...
  571. /* Grrr, why does it seem like every other load/store
  572. * on the sun4m is in some ASI space...
  573. * Fine with me, let's get the pointer to the level 1
  574. * page table directory and fetch its entry.
  575. */
  576. lda [%g4] ASI_M_BYPASS, %o1 ! This is a level 1 ptr
  577. srl %o1, 0x4, %o1 ! Clear low 4 bits
  578. sll %o1, 0x8, %o1 ! Make physical
  579. /* Ok, pull in the PTD. */
  580. lda [%o1] ASI_M_BYPASS, %o2 ! This is the 0x0 16MB pgd
  581. /* Calculate to KERNBASE entry. */
  582. add %o1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %o3
  583. /* Poke the entry into the calculated address. */
  584. sta %o2, [%o3] ASI_M_BYPASS
  585. /* I don't get it Sun, if you engineered all these
  586. * boot loaders and the PROM (thank you for the debugging
  587. * features btw) why did you not have them load kernel
  588. * images up in high address space, since this is necessary
  589. * for ABI compliance anyways? Does this low-mapping provide
  590. * enhanced interoperability?
  591. *
  592. * "The PROM is the computer."
  593. */
  594. /* Ok, restore the MMU control register we saved in %g5 */
  595. sta %g5, [%g0] ASI_M_MMUREGS ! POW... ouch
  596. /* Turn traps back on. We saved it in %g3 earlier. */
  597. wr %g3, 0x0, %psr ! tick tock, tick tock
  598. /* Now we burn precious CPU cycles due to bad engineering. */
  599. WRITE_PAUSE
  600. /* Wow, all that just to move a 32-bit value from one
  601. * place to another... Jump to high memory.
  602. */
  603. b go_to_highmem
  604. nop
  605. /* This works on viking's in Mbus mode and all
  606. * other MBUS modules. It is virtually the same as
  607. * the above madness sans turning traps off and flipping
  608. * the AC bit.
  609. */
  610. srmmu_nviking:
  611. set AC_M_CTPR, %g1
  612. lda [%g1] ASI_M_MMUREGS, %g1 ! get ctx table ptr
  613. sll %g1, 0x4, %g1 ! make physical addr
  614. lda [%g1] ASI_M_BYPASS, %g1 ! ptr to level 1 pg_table
  615. srl %g1, 0x4, %g1
  616. sll %g1, 0x8, %g1 ! make phys addr for l1 tbl
  617. lda [%g1] ASI_M_BYPASS, %g2 ! get level1 entry for 0x0
  618. add %g1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %g3
  619. sta %g2, [%g3] ASI_M_BYPASS ! place at KERNBASE entry
  620. b go_to_highmem
  621. nop ! wheee....
  622. /* This remaps the kernel on Sun4/4xx machines
  623. * that have the Sun Mutant Three Level MMU.
  624. * It's like a platypus, Sun didn't have the
  625. * SRMMU in conception so they kludged the three
  626. * level logic in the regular Sun4 MMU probably.
  627. *
  628. * Basically, you take each entry in the top level
  629. * directory that maps the low 3MB starting at
  630. * address zero and put the mapping in the KERNBASE
  631. * slots. These top level pgd's are called regmaps.
  632. */
  633. sun4_mutant_remap:
  634. or %g0, %g0, %g3 ! source base
  635. sethi %hi(KERNBASE), %g4 ! destination base
  636. or %g4, %lo(KERNBASE), %g4
  637. sethi %hi(0x300000), %g5
  638. or %g5, %lo(0x300000), %g5 ! upper bound 3MB
  639. or %g0, 0x1, %l6
  640. sll %l6, 24, %l6 ! Regmap mapping size
  641. add %g3, 0x2, %g3 ! Base magic
  642. add %g4, 0x2, %g4 ! Base magic
  643. /* Main remapping loop on Sun4-Mutant-MMU.
  644. * "I am not an animal..." -Famous Mutant Person
  645. */
  646. sun4_mutant_loop:
  647. lduha [%g3] ASI_REGMAP, %g2 ! Get lower entry
  648. stha %g2, [%g4] ASI_REGMAP ! Store in high entry
  649. add %g4, %l6, %g4 ! Move up high memory ptr
  650. subcc %g3, %g5, %g0 ! Reached our limit?
  651. blu sun4_mutant_loop ! Nope, loop again
  652. add %g3, %l6, %g3 ! delay, Move up low ptr
  653. b go_to_highmem ! Jump to high memory.
  654. nop
  655. /* The following is for non-4/4xx sun4 MMU's. */
  656. sun4_normal_remap:
  657. mov 0, %g3 ! source base
  658. set KERNBASE, %g4 ! destination base
  659. set 0x300000, %g5 ! upper bound 3MB
  660. mov 1, %l6
  661. sll %l6, 18, %l6 ! sun4 mmu segmap size
  662. sun4_normal_loop:
  663. lduha [%g3] ASI_SEGMAP, %g6 ! load phys_seg
  664. stha %g6, [%g4] ASI_SEGMAP ! stort new virt mapping
  665. add %g3, %l6, %g3 ! increment source pointer
  666. subcc %g3, %g5, %g0 ! reached limit?
  667. blu sun4_normal_loop ! nope, loop again
  668. add %g4, %l6, %g4 ! delay, increment dest ptr
  669. b go_to_highmem
  670. nop
  671. /* The following works for Sun4c MMU's */
  672. sun4c_remap:
  673. mov 0, %g3 ! source base
  674. set KERNBASE, %g4 ! destination base
  675. set 0x300000, %g5 ! upper bound 3MB
  676. mov 1, %l6
  677. sll %l6, 18, %l6 ! sun4c mmu segmap size
  678. sun4c_remap_loop:
  679. lda [%g3] ASI_SEGMAP, %g6 ! load phys_seg
  680. sta %g6, [%g4] ASI_SEGMAP ! store new virt mapping
  681. add %g3, %l6, %g3 ! Increment source ptr
  682. subcc %g3, %g5, %g0 ! Reached limit?
  683. bl sun4c_remap_loop ! Nope, loop again
  684. add %g4, %l6, %g4 ! delay, Increment dest ptr
  685. /* Now do a non-relative jump so that PC is in high-memory */
  686. go_to_highmem:
  687. set execute_in_high_mem, %g1
  688. jmpl %g1, %g0
  689. nop
  690. /* The code above should be at beginning and we have to take care about
  691. * short jumps, as branching to .text.init section from .text is usually
  692. * impossible */
  693. __INIT
  694. /* Acquire boot time privileged register values, this will help debugging.
  695. * I figure out and store nwindows and nwindowsm1 later on.
  696. */
  697. execute_in_high_mem:
  698. mov %l0, %o0 ! put back romvec
  699. mov %l1, %o1 ! and debug_vec
  700. sethi %hi(prom_vector_p), %g1
  701. st %o0, [%g1 + %lo(prom_vector_p)]
  702. sethi %hi(linux_dbvec), %g1
  703. st %o1, [%g1 + %lo(linux_dbvec)]
  704. ld [%o0 + 0x4], %o3
  705. and %o3, 0x3, %o5 ! get the version
  706. cmp %o3, 0x2 ! a v2 prom?
  707. be found_version
  708. nop
  709. /* paul@sfe.com.au */
  710. cmp %o3, 0x3 ! a v3 prom?
  711. be found_version
  712. nop
  713. /* Old sun4's pass our load address into %o0 instead of the prom
  714. * pointer. On sun4's you have to hard code the romvec pointer into
  715. * your code. Sun probably still does that because they don't even
  716. * trust their own "OpenBoot" specifications.
  717. */
  718. set LOAD_ADDR, %g6
  719. cmp %o0, %g6 ! an old sun4?
  720. be sun4_init
  721. nop
  722. found_version:
  723. #ifdef CONFIG_SUN4
  724. /* For people who try sun4 kernels, even if Configure.help advises them. */
  725. ld [%g7 + 0x68], %o1
  726. set sun4cdm_notsup, %o0
  727. call %o1
  728. nop
  729. b halt_me
  730. nop
  731. #endif
  732. /* Get the machine type via the mysterious romvec node operations. */
  733. add %g7, 0x1c, %l1
  734. ld [%l1], %l0
  735. ld [%l0], %l0
  736. call %l0
  737. or %g0, %g0, %o0 ! next_node(0) = first_node
  738. or %o0, %g0, %g6
  739. sethi %hi(cputypvar), %o1 ! First node has cpu-arch
  740. or %o1, %lo(cputypvar), %o1
  741. sethi %hi(cputypval), %o2 ! information, the string
  742. or %o2, %lo(cputypval), %o2
  743. ld [%l1], %l0 ! 'compatibility' tells
  744. ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where
  745. call %l0 ! x is one of '', 'c', 'm',
  746. nop ! 'd' or 'e'. %o2 holds pointer
  747. ! to a buf where above string
  748. ! will get stored by the prom.
  749. subcc %o0, %g0, %g0
  750. bpos got_prop ! Got the property
  751. nop
  752. or %g6, %g0, %o0
  753. sethi %hi(cputypvar_sun4m), %o1
  754. or %o1, %lo(cputypvar_sun4m), %o1
  755. sethi %hi(cputypval), %o2
  756. or %o2, %lo(cputypval), %o2
  757. ld [%l1], %l0
  758. ld [%l0 + 0xc], %l0
  759. call %l0
  760. nop
  761. got_prop:
  762. set cputypval, %o2
  763. ldub [%o2 + 0x4], %l1
  764. cmp %l1, ' '
  765. be 1f
  766. cmp %l1, 'c'
  767. be 1f
  768. cmp %l1, 'm'
  769. be 1f
  770. cmp %l1, 's'
  771. be 1f
  772. cmp %l1, 'd'
  773. be 1f
  774. cmp %l1, 'e'
  775. be no_sun4e_here ! Could be a sun4e.
  776. nop
  777. b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
  778. nop
  779. 1: set cputypval, %l1
  780. ldub [%l1 + 0x4], %l1
  781. cmp %l1, 'm' ! Test for sun4d, sun4e ?
  782. be sun4m_init
  783. cmp %l1, 's' ! Treat sun4s as sun4m
  784. be sun4m_init
  785. cmp %l1, 'd' ! Let us see how the beast will die
  786. be sun4d_init
  787. nop
  788. /* Jump into mmu context zero. */
  789. set AC_CONTEXT, %g1
  790. stba %g0, [%g1] ASI_CONTROL
  791. b sun4c_continue_boot
  792. nop
  793. /* CPUID in bootbus can be found at PA 0xff0140000 */
  794. #define SUN4D_BOOTBUS_CPUID 0xf0140000
  795. sun4d_init:
  796. /* Need to patch call to handler_irq */
  797. set patch_handler_irq, %g4
  798. set sun4d_handler_irq, %g5
  799. sethi %hi(0x40000000), %g3 ! call
  800. sub %g5, %g4, %g5
  801. srl %g5, 2, %g5
  802. or %g5, %g3, %g5
  803. st %g5, [%g4]
  804. #ifdef CONFIG_SMP
  805. /* Get our CPU id out of bootbus */
  806. set SUN4D_BOOTBUS_CPUID, %g3
  807. lduba [%g3] ASI_M_CTL, %g3
  808. and %g3, 0xf8, %g3
  809. srl %g3, 3, %g4
  810. sta %g4, [%g0] ASI_M_VIKING_TMP1
  811. sethi %hi(boot_cpu_id), %g5
  812. stb %g4, [%g5 + %lo(boot_cpu_id)]
  813. sll %g4, 2, %g4
  814. sethi %hi(boot_cpu_id4), %g5
  815. stb %g4, [%g5 + %lo(boot_cpu_id4)]
  816. #endif
  817. /* Fall through to sun4m_init */
  818. sun4m_init:
  819. /* XXX Fucking Cypress... */
  820. lda [%g0] ASI_M_MMUREGS, %g5
  821. srl %g5, 28, %g4
  822. cmp %g4, 1
  823. bne 1f
  824. srl %g5, 24, %g4
  825. and %g4, 0xf, %g4
  826. cmp %g4, 7 /* This would be a HyperSparc. */
  827. bne 2f
  828. nop
  829. 1:
  830. #define PATCH_IT(dst, src) \
  831. set (dst), %g5; \
  832. set (src), %g4; \
  833. ld [%g4], %g3; \
  834. st %g3, [%g5]; \
  835. ld [%g4+0x4], %g3; \
  836. st %g3, [%g5+0x4];
  837. /* Signed multiply. */
  838. PATCH_IT(.mul, .mul_patch)
  839. PATCH_IT(.mul+0x08, .mul_patch+0x08)
  840. /* Signed remainder. */
  841. PATCH_IT(.rem, .rem_patch)
  842. PATCH_IT(.rem+0x08, .rem_patch+0x08)
  843. PATCH_IT(.rem+0x10, .rem_patch+0x10)
  844. PATCH_IT(.rem+0x18, .rem_patch+0x18)
  845. PATCH_IT(.rem+0x20, .rem_patch+0x20)
  846. PATCH_IT(.rem+0x28, .rem_patch+0x28)
  847. /* Signed division. */
  848. PATCH_IT(.div, .div_patch)
  849. PATCH_IT(.div+0x08, .div_patch+0x08)
  850. PATCH_IT(.div+0x10, .div_patch+0x10)
  851. PATCH_IT(.div+0x18, .div_patch+0x18)
  852. PATCH_IT(.div+0x20, .div_patch+0x20)
  853. /* Unsigned multiply. */
  854. PATCH_IT(.umul, .umul_patch)
  855. PATCH_IT(.umul+0x08, .umul_patch+0x08)
  856. /* Unsigned remainder. */
  857. PATCH_IT(.urem, .urem_patch)
  858. PATCH_IT(.urem+0x08, .urem_patch+0x08)
  859. PATCH_IT(.urem+0x10, .urem_patch+0x10)
  860. PATCH_IT(.urem+0x18, .urem_patch+0x18)
  861. /* Unsigned division. */
  862. PATCH_IT(.udiv, .udiv_patch)
  863. PATCH_IT(.udiv+0x08, .udiv_patch+0x08)
  864. PATCH_IT(.udiv+0x10, .udiv_patch+0x10)
  865. #undef PATCH_IT
  866. /* Ok, the PROM could have done funny things and apple cider could still
  867. * be sitting in the fault status/address registers. Read them all to
  868. * clear them so we don't get magic faults later on.
  869. */
  870. /* This sucks, apparently this makes Vikings call prom panic, will fix later */
  871. 2:
  872. rd %psr, %o1
  873. srl %o1, 28, %o1 ! Get a type of the CPU
  874. subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC
  875. be sun4c_continue_boot
  876. nop
  877. set AC_M_SFSR, %o0
  878. lda [%o0] ASI_M_MMUREGS, %g0
  879. set AC_M_SFAR, %o0
  880. lda [%o0] ASI_M_MMUREGS, %g0
  881. /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
  882. subcc %o1, 0, %g0
  883. be sun4c_continue_boot
  884. nop
  885. set AC_M_AFSR, %o0
  886. lda [%o0] ASI_M_MMUREGS, %g0
  887. set AC_M_AFAR, %o0
  888. lda [%o0] ASI_M_MMUREGS, %g0
  889. nop
  890. sun4c_continue_boot:
  891. /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
  892. * show-time!
  893. */
  894. sethi %hi(cputyp), %o0
  895. st %g4, [%o0 + %lo(cputyp)]
  896. /* Turn on Supervisor, EnableFloating, and all the PIL bits.
  897. * Also puts us in register window zero with traps off.
  898. */
  899. set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
  900. wr %g2, 0x0, %psr
  901. WRITE_PAUSE
  902. /* I want a kernel stack NOW! */
  903. set init_thread_union, %g1
  904. set (THREAD_SIZE - STACKFRAME_SZ), %g2
  905. add %g1, %g2, %sp
  906. mov 0, %fp /* And for good luck */
  907. /* Zero out our BSS section. */
  908. set __bss_start , %o0 ! First address of BSS
  909. set end , %o1 ! Last address of BSS
  910. add %o0, 0x1, %o0
  911. 1:
  912. stb %g0, [%o0]
  913. subcc %o0, %o1, %g0
  914. bl 1b
  915. add %o0, 0x1, %o0
  916. /* Initialize the uwinmask value for init task just in case.
  917. * But first make current_set[boot_cpu_id] point to something useful.
  918. */
  919. set init_thread_union, %g6
  920. set current_set, %g2
  921. #ifdef CONFIG_SMP
  922. sethi %hi(boot_cpu_id4), %g3
  923. ldub [%g3 + %lo(boot_cpu_id4)], %g3
  924. st %g6, [%g2]
  925. add %g2, %g3, %g2
  926. #endif
  927. st %g6, [%g2]
  928. st %g0, [%g6 + TI_UWINMASK]
  929. /* Compute NWINDOWS and stash it away. Now uses %wim trick explained
  930. * in the V8 manual. Ok, this method seems to work, Sparc is cool...
  931. * No, it doesn't work, have to play the save/readCWP/restore trick.
  932. */
  933. wr %g0, 0x0, %wim ! so we do not get a trap
  934. WRITE_PAUSE
  935. save
  936. rd %psr, %g3
  937. restore
  938. and %g3, 0x1f, %g3
  939. add %g3, 0x1, %g3
  940. mov 2, %g1
  941. wr %g1, 0x0, %wim ! make window 1 invalid
  942. WRITE_PAUSE
  943. cmp %g3, 0x7
  944. bne 2f
  945. nop
  946. /* Adjust our window handling routines to
  947. * do things correctly on 7 window Sparcs.
  948. */
  949. #define PATCH_INSN(src, dest) \
  950. set src, %g5; \
  951. set dest, %g2; \
  952. ld [%g5], %g4; \
  953. st %g4, [%g2];
  954. /* Patch for window spills... */
  955. PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
  956. PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
  957. PATCH_INSN(spnwin_patch3_7win, spnwin_patch3)
  958. /* Patch for window fills... */
  959. PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
  960. PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
  961. /* Patch for trap entry setup... */
  962. PATCH_INSN(tsetup_7win_patch1, tsetup_patch1)
  963. PATCH_INSN(tsetup_7win_patch2, tsetup_patch2)
  964. PATCH_INSN(tsetup_7win_patch3, tsetup_patch3)
  965. PATCH_INSN(tsetup_7win_patch4, tsetup_patch4)
  966. PATCH_INSN(tsetup_7win_patch5, tsetup_patch5)
  967. PATCH_INSN(tsetup_7win_patch6, tsetup_patch6)
  968. /* Patch for returning from traps... */
  969. PATCH_INSN(rtrap_7win_patch1, rtrap_patch1)
  970. PATCH_INSN(rtrap_7win_patch2, rtrap_patch2)
  971. PATCH_INSN(rtrap_7win_patch3, rtrap_patch3)
  972. PATCH_INSN(rtrap_7win_patch4, rtrap_patch4)
  973. PATCH_INSN(rtrap_7win_patch5, rtrap_patch5)
  974. /* Patch for killing user windows from the register file. */
  975. PATCH_INSN(kuw_patch1_7win, kuw_patch1)
  976. /* Now patch the kernel window flush sequences.
  977. * This saves 2 traps on every switch and fork.
  978. */
  979. set 0x01000000, %g4
  980. set flush_patch_one, %g5
  981. st %g4, [%g5 + 0x18]
  982. st %g4, [%g5 + 0x1c]
  983. set flush_patch_two, %g5
  984. st %g4, [%g5 + 0x18]
  985. st %g4, [%g5 + 0x1c]
  986. set flush_patch_three, %g5
  987. st %g4, [%g5 + 0x18]
  988. st %g4, [%g5 + 0x1c]
  989. set flush_patch_four, %g5
  990. st %g4, [%g5 + 0x18]
  991. st %g4, [%g5 + 0x1c]
  992. set flush_patch_exception, %g5
  993. st %g4, [%g5 + 0x18]
  994. st %g4, [%g5 + 0x1c]
  995. set flush_patch_switch, %g5
  996. st %g4, [%g5 + 0x18]
  997. st %g4, [%g5 + 0x1c]
  998. 2:
  999. sethi %hi(nwindows), %g4
  1000. st %g3, [%g4 + %lo(nwindows)] ! store final value
  1001. sub %g3, 0x1, %g3
  1002. sethi %hi(nwindowsm1), %g4
  1003. st %g3, [%g4 + %lo(nwindowsm1)]
  1004. /* Here we go, start using Linux's trap table... */
  1005. set trapbase, %g3
  1006. wr %g3, 0x0, %tbr
  1007. WRITE_PAUSE
  1008. /* Finally, turn on traps so that we can call c-code. */
  1009. rd %psr, %g3
  1010. wr %g3, 0x0, %psr
  1011. WRITE_PAUSE
  1012. wr %g3, PSR_ET, %psr
  1013. WRITE_PAUSE
  1014. /* First we call prom_init() to set up PROMLIB, then
  1015. * off to start_kernel().
  1016. */
  1017. sethi %hi(prom_vector_p), %g5
  1018. ld [%g5 + %lo(prom_vector_p)], %o0
  1019. call prom_init
  1020. nop
  1021. call start_kernel
  1022. nop
  1023. /* We should not get here. */
  1024. call halt_me
  1025. nop
  1026. sun4_init:
  1027. #ifdef CONFIG_SUN4
  1028. /* There, happy now Adrian? */
  1029. set cputypval, %o2 ! Let everyone know we
  1030. set ' ', %o0 ! are a "sun4 " architecture
  1031. stb %o0, [%o2 + 0x4]
  1032. b got_prop
  1033. nop
  1034. #else
  1035. sethi %hi(SUN4_PROM_VECTOR+0x84), %o1
  1036. ld [%o1 + %lo(SUN4_PROM_VECTOR+0x84)], %o1
  1037. set sun4_notsup, %o0
  1038. call %o1 /* printf */
  1039. nop
  1040. sethi %hi(SUN4_PROM_VECTOR+0xc4), %o1
  1041. ld [%o1 + %lo(SUN4_PROM_VECTOR+0xc4)], %o1
  1042. call %o1 /* exittomon */
  1043. nop
  1044. 1: ba 1b ! Cannot exit into KMON
  1045. nop
  1046. #endif
  1047. no_sun4e_here:
  1048. ld [%g7 + 0x68], %o1
  1049. set sun4e_notsup, %o0
  1050. call %o1
  1051. nop
  1052. b halt_me
  1053. nop
  1054. __INITDATA
  1055. sun4u_1:
  1056. .asciz "finddevice"
  1057. .align 4
  1058. sun4u_2:
  1059. .asciz "/chosen"
  1060. .align 4
  1061. sun4u_3:
  1062. .asciz "getprop"
  1063. .align 4
  1064. sun4u_4:
  1065. .asciz "stdout"
  1066. .align 4
  1067. sun4u_5:
  1068. .asciz "write"
  1069. .align 4
  1070. sun4u_6:
  1071. .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r"
  1072. sun4u_6e:
  1073. .align 4
  1074. sun4u_7:
  1075. .asciz "exit"
  1076. .align 8
  1077. sun4u_a1:
  1078. .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0
  1079. sun4u_r1:
  1080. .word 0
  1081. sun4u_a2:
  1082. .word 0, sun4u_3, 0, 4, 0, 1, 0
  1083. sun4u_i2:
  1084. .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0
  1085. sun4u_r2:
  1086. .word 0
  1087. sun4u_a3:
  1088. .word 0, sun4u_5, 0, 3, 0, 1, 0
  1089. sun4u_i3:
  1090. .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0
  1091. sun4u_r3:
  1092. .word 0
  1093. sun4u_a4:
  1094. .word 0, sun4u_7, 0, 0, 0, 0
  1095. sun4u_r4:
  1096. __INIT
  1097. no_sun4u_here:
  1098. set sun4u_a1, %o0
  1099. set current_pc, %l2
  1100. cmp %l2, %g3
  1101. be 1f
  1102. mov %o4, %l0
  1103. sub %g3, %l2, %l6
  1104. add %o0, %l6, %o0
  1105. mov %o0, %l4
  1106. mov sun4u_r4 - sun4u_a1, %l3
  1107. ld [%l4], %l5
  1108. 2:
  1109. add %l4, 4, %l4
  1110. cmp %l5, %l2
  1111. add %l5, %l6, %l5
  1112. bgeu,a 3f
  1113. st %l5, [%l4 - 4]
  1114. 3:
  1115. subcc %l3, 4, %l3
  1116. bne 2b
  1117. ld [%l4], %l5
  1118. 1:
  1119. call %l0
  1120. mov %o0, %l1
  1121. ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1
  1122. add %l1, (sun4u_a2 - sun4u_a1), %o0
  1123. call %l0
  1124. st %o1, [%o0 + (sun4u_i2 - sun4u_a2)]
  1125. ld [%l1 + (sun4u_1 - sun4u_a1)], %o1
  1126. add %l1, (sun4u_a3 - sun4u_a1), %o0
  1127. call %l0
  1128. st %o1, [%o0 + (sun4u_i3 - sun4u_a3)]
  1129. call %l0
  1130. add %l1, (sun4u_a4 - sun4u_a1), %o0
  1131. /* Not reached */
  1132. halt_me:
  1133. ld [%g7 + 0x74], %o0
  1134. call %o0 ! Get us out of here...
  1135. nop ! Apparently Solaris is better.
  1136. /* Ok, now we continue in the .data/.text sections */
  1137. .data
  1138. .align 4
  1139. /*
  1140. * Fill up the prom vector, note in particular the kind first element,
  1141. * no joke. I don't need all of them in here as the entire prom vector
  1142. * gets initialized in c-code so all routines can use it.
  1143. */
  1144. .globl prom_vector_p
  1145. prom_vector_p:
  1146. .word 0
  1147. /* We calculate the following at boot time, window fills/spills and trap entry
  1148. * code uses these to keep track of the register windows.
  1149. */
  1150. .align 4
  1151. .globl nwindows
  1152. .globl nwindowsm1
  1153. nwindows:
  1154. .word 8
  1155. nwindowsm1:
  1156. .word 7
  1157. /* Boot time debugger vector value. We need this later on. */
  1158. .align 4
  1159. .globl linux_dbvec
  1160. linux_dbvec:
  1161. .word 0
  1162. .word 0
  1163. .align 8
  1164. .globl lvl14_save
  1165. lvl14_save:
  1166. .word 0
  1167. .word 0
  1168. .word 0
  1169. .word 0
  1170. .word t_irq14
  1171. .section ".fixup",#alloc,#execinstr
  1172. .globl __ret_efault
  1173. __ret_efault:
  1174. ret
  1175. restore %g0, -EFAULT, %o0