head_32.S 44 KB

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