head.S 44 KB

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