head_32.S 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
  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. .section .text.head,"ax"
  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. current_pc:
  445. call 1f
  446. nop
  447. 1:
  448. mov %o7, %g3
  449. tst %o0
  450. be no_sun4u_here
  451. mov %g4, %o7 /* Previous %o7. */
  452. mov %o0, %l0 ! stash away romvec
  453. mov %o0, %g7 ! put it here too
  454. mov %o1, %l1 ! stash away debug_vec too
  455. /* Ok, let's check out our run time program counter. */
  456. set current_pc, %g5
  457. cmp %g3, %g5
  458. be already_mapped
  459. nop
  460. /* %l6 will hold the offset we have to subtract
  461. * from absolute symbols in order to access areas
  462. * in our own image. If already mapped this is
  463. * just plain zero, else it is KERNBASE.
  464. */
  465. set KERNBASE, %l6
  466. b copy_prom_lvl14
  467. nop
  468. already_mapped:
  469. mov 0, %l6
  470. /* Copy over the Prom's level 14 clock handler. */
  471. copy_prom_lvl14:
  472. #if 1
  473. /* DJHR
  474. * preserve our linked/calculated instructions
  475. */
  476. set lvl14_save, %g1
  477. set t_irq14, %g3
  478. sub %g1, %l6, %g1 ! translate to physical
  479. sub %g3, %l6, %g3 ! translate to physical
  480. ldd [%g3], %g4
  481. std %g4, [%g1]
  482. ldd [%g3+8], %g4
  483. std %g4, [%g1+8]
  484. #endif
  485. rd %tbr, %g1
  486. andn %g1, 0xfff, %g1 ! proms trap table base
  487. or %g0, (0x1e<<4), %g2 ! offset to lvl14 intr
  488. or %g1, %g2, %g2
  489. set t_irq14, %g3
  490. sub %g3, %l6, %g3
  491. ldd [%g2], %g4
  492. std %g4, [%g3]
  493. ldd [%g2 + 0x8], %g4
  494. std %g4, [%g3 + 0x8] ! Copy proms handler
  495. /* Must determine whether we are on a sun4c MMU, SRMMU, or SUN4/400 MUTANT
  496. * MMU so we can remap ourselves properly. DON'T TOUCH %l0 thru %l5 in these
  497. * remapping routines, we need their values afterwards!
  498. */
  499. /* Now check whether we are already mapped, if we
  500. * are we can skip all this garbage coming up.
  501. */
  502. copy_prom_done:
  503. cmp %l6, 0
  504. be go_to_highmem ! this will be a nop then
  505. nop
  506. set LOAD_ADDR, %g6
  507. cmp %g7, %g6
  508. bne remap_not_a_sun4 ! This is not a Sun4
  509. nop
  510. or %g0, 0x1, %g1
  511. lduba [%g1] ASI_CONTROL, %g1 ! Only safe to try on Sun4.
  512. subcc %g1, 0x24, %g0 ! Is this a mutant Sun4/400???
  513. be sun4_mutant_remap ! Ugh, it is...
  514. nop
  515. b sun4_normal_remap ! regular sun4, 2 level mmu
  516. nop
  517. remap_not_a_sun4:
  518. lda [%g0] ASI_M_MMUREGS, %g1 ! same as ASI_PTE on sun4c
  519. and %g1, 0x1, %g1 ! Test SRMMU Enable bit ;-)
  520. cmp %g1, 0x0
  521. be sun4c_remap ! A sun4c MMU or normal Sun4
  522. nop
  523. srmmu_remap:
  524. /* First, check for a viking (TI) module. */
  525. set 0x40000000, %g2
  526. rd %psr, %g3
  527. and %g2, %g3, %g3
  528. subcc %g3, 0x0, %g0
  529. bz srmmu_nviking
  530. nop
  531. /* Figure out what kind of viking we are on.
  532. * We need to know if we have to play with the
  533. * AC bit and disable traps or not.
  534. */
  535. /* I've only seen MicroSparc's on SparcClassics with this
  536. * bit set.
  537. */
  538. set 0x800, %g2
  539. lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg
  540. and %g2, %g3, %g3
  541. subcc %g3, 0x0, %g0
  542. bnz srmmu_nviking ! is in mbus mode
  543. nop
  544. rd %psr, %g3 ! DO NOT TOUCH %g3
  545. andn %g3, PSR_ET, %g2
  546. wr %g2, 0x0, %psr
  547. WRITE_PAUSE
  548. /* Get context table pointer, then convert to
  549. * a physical address, which is 36 bits.
  550. */
  551. set AC_M_CTPR, %g4
  552. lda [%g4] ASI_M_MMUREGS, %g4
  553. sll %g4, 0x4, %g4 ! We use this below
  554. ! DO NOT TOUCH %g4
  555. /* Set the AC bit in the Viking's MMU control reg. */
  556. lda [%g0] ASI_M_MMUREGS, %g5 ! DO NOT TOUCH %g5
  557. set 0x8000, %g6 ! AC bit mask
  558. or %g5, %g6, %g6 ! Or it in...
  559. sta %g6, [%g0] ASI_M_MMUREGS ! Close your eyes...
  560. /* Grrr, why does it seem like every other load/store
  561. * on the sun4m is in some ASI space...
  562. * Fine with me, let's get the pointer to the level 1
  563. * page table directory and fetch its entry.
  564. */
  565. lda [%g4] ASI_M_BYPASS, %o1 ! This is a level 1 ptr
  566. srl %o1, 0x4, %o1 ! Clear low 4 bits
  567. sll %o1, 0x8, %o1 ! Make physical
  568. /* Ok, pull in the PTD. */
  569. lda [%o1] ASI_M_BYPASS, %o2 ! This is the 0x0 16MB pgd
  570. /* Calculate to KERNBASE entry. */
  571. add %o1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %o3
  572. /* Poke the entry into the calculated address. */
  573. sta %o2, [%o3] ASI_M_BYPASS
  574. /* I don't get it Sun, if you engineered all these
  575. * boot loaders and the PROM (thank you for the debugging
  576. * features btw) why did you not have them load kernel
  577. * images up in high address space, since this is necessary
  578. * for ABI compliance anyways? Does this low-mapping provide
  579. * enhanced interoperability?
  580. *
  581. * "The PROM is the computer."
  582. */
  583. /* Ok, restore the MMU control register we saved in %g5 */
  584. sta %g5, [%g0] ASI_M_MMUREGS ! POW... ouch
  585. /* Turn traps back on. We saved it in %g3 earlier. */
  586. wr %g3, 0x0, %psr ! tick tock, tick tock
  587. /* Now we burn precious CPU cycles due to bad engineering. */
  588. WRITE_PAUSE
  589. /* Wow, all that just to move a 32-bit value from one
  590. * place to another... Jump to high memory.
  591. */
  592. b go_to_highmem
  593. nop
  594. /* This works on viking's in Mbus mode and all
  595. * other MBUS modules. It is virtually the same as
  596. * the above madness sans turning traps off and flipping
  597. * the AC bit.
  598. */
  599. srmmu_nviking:
  600. set AC_M_CTPR, %g1
  601. lda [%g1] ASI_M_MMUREGS, %g1 ! get ctx table ptr
  602. sll %g1, 0x4, %g1 ! make physical addr
  603. lda [%g1] ASI_M_BYPASS, %g1 ! ptr to level 1 pg_table
  604. srl %g1, 0x4, %g1
  605. sll %g1, 0x8, %g1 ! make phys addr for l1 tbl
  606. lda [%g1] ASI_M_BYPASS, %g2 ! get level1 entry for 0x0
  607. add %g1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %g3
  608. sta %g2, [%g3] ASI_M_BYPASS ! place at KERNBASE entry
  609. b go_to_highmem
  610. nop ! wheee....
  611. /* This remaps the kernel on Sun4/4xx machines
  612. * that have the Sun Mutant Three Level MMU.
  613. * It's like a platypus, Sun didn't have the
  614. * SRMMU in conception so they kludged the three
  615. * level logic in the regular Sun4 MMU probably.
  616. *
  617. * Basically, you take each entry in the top level
  618. * directory that maps the low 3MB starting at
  619. * address zero and put the mapping in the KERNBASE
  620. * slots. These top level pgd's are called regmaps.
  621. */
  622. sun4_mutant_remap:
  623. or %g0, %g0, %g3 ! source base
  624. sethi %hi(KERNBASE), %g4 ! destination base
  625. or %g4, %lo(KERNBASE), %g4
  626. sethi %hi(0x300000), %g5
  627. or %g5, %lo(0x300000), %g5 ! upper bound 3MB
  628. or %g0, 0x1, %l6
  629. sll %l6, 24, %l6 ! Regmap mapping size
  630. add %g3, 0x2, %g3 ! Base magic
  631. add %g4, 0x2, %g4 ! Base magic
  632. /* Main remapping loop on Sun4-Mutant-MMU.
  633. * "I am not an animal..." -Famous Mutant Person
  634. */
  635. sun4_mutant_loop:
  636. lduha [%g3] ASI_REGMAP, %g2 ! Get lower entry
  637. stha %g2, [%g4] ASI_REGMAP ! Store in high entry
  638. add %g4, %l6, %g4 ! Move up high memory ptr
  639. subcc %g3, %g5, %g0 ! Reached our limit?
  640. blu sun4_mutant_loop ! Nope, loop again
  641. add %g3, %l6, %g3 ! delay, Move up low ptr
  642. b go_to_highmem ! Jump to high memory.
  643. nop
  644. /* The following is for non-4/4xx sun4 MMU's. */
  645. sun4_normal_remap:
  646. mov 0, %g3 ! source base
  647. set KERNBASE, %g4 ! destination base
  648. set 0x300000, %g5 ! upper bound 3MB
  649. mov 1, %l6
  650. sll %l6, 18, %l6 ! sun4 mmu segmap size
  651. sun4_normal_loop:
  652. lduha [%g3] ASI_SEGMAP, %g6 ! load phys_seg
  653. stha %g6, [%g4] ASI_SEGMAP ! stort new virt mapping
  654. add %g3, %l6, %g3 ! increment source pointer
  655. subcc %g3, %g5, %g0 ! reached limit?
  656. blu sun4_normal_loop ! nope, loop again
  657. add %g4, %l6, %g4 ! delay, increment dest ptr
  658. b go_to_highmem
  659. nop
  660. /* The following works for Sun4c MMU's */
  661. sun4c_remap:
  662. mov 0, %g3 ! source base
  663. set KERNBASE, %g4 ! destination base
  664. set 0x300000, %g5 ! upper bound 3MB
  665. mov 1, %l6
  666. sll %l6, 18, %l6 ! sun4c mmu segmap size
  667. sun4c_remap_loop:
  668. lda [%g3] ASI_SEGMAP, %g6 ! load phys_seg
  669. sta %g6, [%g4] ASI_SEGMAP ! store new virt mapping
  670. add %g3, %l6, %g3 ! Increment source ptr
  671. subcc %g3, %g5, %g0 ! Reached limit?
  672. bl sun4c_remap_loop ! Nope, loop again
  673. add %g4, %l6, %g4 ! delay, Increment dest ptr
  674. /* Now do a non-relative jump so that PC is in high-memory */
  675. go_to_highmem:
  676. set execute_in_high_mem, %g1
  677. jmpl %g1, %g0
  678. nop
  679. /* The code above should be at beginning and we have to take care about
  680. * short jumps, as branching to .text.init section from .text is usually
  681. * impossible */
  682. __INIT
  683. /* Acquire boot time privileged register values, this will help debugging.
  684. * I figure out and store nwindows and nwindowsm1 later on.
  685. */
  686. execute_in_high_mem:
  687. mov %l0, %o0 ! put back romvec
  688. mov %l1, %o1 ! and debug_vec
  689. sethi %hi(prom_vector_p), %g1
  690. st %o0, [%g1 + %lo(prom_vector_p)]
  691. sethi %hi(linux_dbvec), %g1
  692. st %o1, [%g1 + %lo(linux_dbvec)]
  693. ld [%o0 + 0x4], %o3
  694. and %o3, 0x3, %o5 ! get the version
  695. cmp %o3, 0x2 ! a v2 prom?
  696. be found_version
  697. nop
  698. /* paul@sfe.com.au */
  699. cmp %o3, 0x3 ! a v3 prom?
  700. be found_version
  701. nop
  702. /* Old sun4's pass our load address into %o0 instead of the prom
  703. * pointer. On sun4's you have to hard code the romvec pointer into
  704. * your code. Sun probably still does that because they don't even
  705. * trust their own "OpenBoot" specifications.
  706. */
  707. set LOAD_ADDR, %g6
  708. cmp %o0, %g6 ! an old sun4?
  709. be sun4_init
  710. nop
  711. found_version:
  712. /* Get the machine type via the mysterious romvec node operations. */
  713. add %g7, 0x1c, %l1
  714. ld [%l1], %l0
  715. ld [%l0], %l0
  716. call %l0
  717. or %g0, %g0, %o0 ! next_node(0) = first_node
  718. or %o0, %g0, %g6
  719. sethi %hi(cputypvar), %o1 ! First node has cpu-arch
  720. or %o1, %lo(cputypvar), %o1
  721. sethi %hi(cputypval), %o2 ! information, the string
  722. or %o2, %lo(cputypval), %o2
  723. ld [%l1], %l0 ! 'compatibility' tells
  724. ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where
  725. call %l0 ! x is one of '', 'c', 'm',
  726. nop ! 'd' or 'e'. %o2 holds pointer
  727. ! to a buf where above string
  728. ! will get stored by the prom.
  729. subcc %o0, %g0, %g0
  730. bpos got_prop ! Got the property
  731. nop
  732. or %g6, %g0, %o0
  733. sethi %hi(cputypvar_sun4m), %o1
  734. or %o1, %lo(cputypvar_sun4m), %o1
  735. sethi %hi(cputypval), %o2
  736. or %o2, %lo(cputypval), %o2
  737. ld [%l1], %l0
  738. ld [%l0 + 0xc], %l0
  739. call %l0
  740. nop
  741. got_prop:
  742. set cputypval, %o2
  743. ldub [%o2 + 0x4], %l1
  744. cmp %l1, ' '
  745. be 1f
  746. cmp %l1, 'c'
  747. be 1f
  748. cmp %l1, 'm'
  749. be 1f
  750. cmp %l1, 's'
  751. be 1f
  752. cmp %l1, 'd'
  753. be 1f
  754. cmp %l1, 'e'
  755. be no_sun4e_here ! Could be a sun4e.
  756. nop
  757. b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
  758. nop
  759. 1: set cputypval, %l1
  760. ldub [%l1 + 0x4], %l1
  761. cmp %l1, 'm' ! Test for sun4d, sun4e ?
  762. be sun4m_init
  763. cmp %l1, 's' ! Treat sun4s as sun4m
  764. be sun4m_init
  765. cmp %l1, 'd' ! Let us see how the beast will die
  766. be sun4d_init
  767. nop
  768. /* Jump into mmu context zero. */
  769. set AC_CONTEXT, %g1
  770. stba %g0, [%g1] ASI_CONTROL
  771. b sun4c_continue_boot
  772. nop
  773. /* CPUID in bootbus can be found at PA 0xff0140000 */
  774. #define SUN4D_BOOTBUS_CPUID 0xf0140000
  775. sun4d_init:
  776. /* Need to patch call to handler_irq */
  777. set patch_handler_irq, %g4
  778. set sun4d_handler_irq, %g5
  779. sethi %hi(0x40000000), %g3 ! call
  780. sub %g5, %g4, %g5
  781. srl %g5, 2, %g5
  782. or %g5, %g3, %g5
  783. st %g5, [%g4]
  784. #ifdef CONFIG_SMP
  785. /* Get our CPU id out of bootbus */
  786. set SUN4D_BOOTBUS_CPUID, %g3
  787. lduba [%g3] ASI_M_CTL, %g3
  788. and %g3, 0xf8, %g3
  789. srl %g3, 3, %g4
  790. sta %g4, [%g0] ASI_M_VIKING_TMP1
  791. sethi %hi(boot_cpu_id), %g5
  792. stb %g4, [%g5 + %lo(boot_cpu_id)]
  793. sll %g4, 2, %g4
  794. sethi %hi(boot_cpu_id4), %g5
  795. stb %g4, [%g5 + %lo(boot_cpu_id4)]
  796. #endif
  797. /* Fall through to sun4m_init */
  798. sun4m_init:
  799. /* XXX Fucking Cypress... */
  800. lda [%g0] ASI_M_MMUREGS, %g5
  801. srl %g5, 28, %g4
  802. cmp %g4, 1
  803. bne 1f
  804. srl %g5, 24, %g4
  805. and %g4, 0xf, %g4
  806. cmp %g4, 7 /* This would be a HyperSparc. */
  807. bne 2f
  808. nop
  809. 1:
  810. #define PATCH_IT(dst, src) \
  811. set (dst), %g5; \
  812. set (src), %g4; \
  813. ld [%g4], %g3; \
  814. st %g3, [%g5]; \
  815. ld [%g4+0x4], %g3; \
  816. st %g3, [%g5+0x4];
  817. /* Signed multiply. */
  818. PATCH_IT(.mul, .mul_patch)
  819. PATCH_IT(.mul+0x08, .mul_patch+0x08)
  820. /* Signed remainder. */
  821. PATCH_IT(.rem, .rem_patch)
  822. PATCH_IT(.rem+0x08, .rem_patch+0x08)
  823. PATCH_IT(.rem+0x10, .rem_patch+0x10)
  824. PATCH_IT(.rem+0x18, .rem_patch+0x18)
  825. PATCH_IT(.rem+0x20, .rem_patch+0x20)
  826. PATCH_IT(.rem+0x28, .rem_patch+0x28)
  827. /* Signed division. */
  828. PATCH_IT(.div, .div_patch)
  829. PATCH_IT(.div+0x08, .div_patch+0x08)
  830. PATCH_IT(.div+0x10, .div_patch+0x10)
  831. PATCH_IT(.div+0x18, .div_patch+0x18)
  832. PATCH_IT(.div+0x20, .div_patch+0x20)
  833. /* Unsigned multiply. */
  834. PATCH_IT(.umul, .umul_patch)
  835. PATCH_IT(.umul+0x08, .umul_patch+0x08)
  836. /* Unsigned remainder. */
  837. PATCH_IT(.urem, .urem_patch)
  838. PATCH_IT(.urem+0x08, .urem_patch+0x08)
  839. PATCH_IT(.urem+0x10, .urem_patch+0x10)
  840. PATCH_IT(.urem+0x18, .urem_patch+0x18)
  841. /* Unsigned division. */
  842. PATCH_IT(.udiv, .udiv_patch)
  843. PATCH_IT(.udiv+0x08, .udiv_patch+0x08)
  844. PATCH_IT(.udiv+0x10, .udiv_patch+0x10)
  845. #undef PATCH_IT
  846. /* Ok, the PROM could have done funny things and apple cider could still
  847. * be sitting in the fault status/address registers. Read them all to
  848. * clear them so we don't get magic faults later on.
  849. */
  850. /* This sucks, apparently this makes Vikings call prom panic, will fix later */
  851. 2:
  852. rd %psr, %o1
  853. srl %o1, 28, %o1 ! Get a type of the CPU
  854. subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC
  855. be sun4c_continue_boot
  856. nop
  857. set AC_M_SFSR, %o0
  858. lda [%o0] ASI_M_MMUREGS, %g0
  859. set AC_M_SFAR, %o0
  860. lda [%o0] ASI_M_MMUREGS, %g0
  861. /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
  862. subcc %o1, 0, %g0
  863. be sun4c_continue_boot
  864. nop
  865. set AC_M_AFSR, %o0
  866. lda [%o0] ASI_M_MMUREGS, %g0
  867. set AC_M_AFAR, %o0
  868. lda [%o0] ASI_M_MMUREGS, %g0
  869. nop
  870. sun4c_continue_boot:
  871. /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
  872. * show-time!
  873. */
  874. sethi %hi(cputyp), %o0
  875. st %g4, [%o0 + %lo(cputyp)]
  876. /* Turn on Supervisor, EnableFloating, and all the PIL bits.
  877. * Also puts us in register window zero with traps off.
  878. */
  879. set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
  880. wr %g2, 0x0, %psr
  881. WRITE_PAUSE
  882. /* I want a kernel stack NOW! */
  883. set init_thread_union, %g1
  884. set (THREAD_SIZE - STACKFRAME_SZ), %g2
  885. add %g1, %g2, %sp
  886. mov 0, %fp /* And for good luck */
  887. /* Zero out our BSS section. */
  888. set __bss_start , %o0 ! First address of BSS
  889. set _end , %o1 ! Last address of BSS
  890. add %o0, 0x1, %o0
  891. 1:
  892. stb %g0, [%o0]
  893. subcc %o0, %o1, %g0
  894. bl 1b
  895. add %o0, 0x1, %o0
  896. /* Initialize the uwinmask value for init task just in case.
  897. * But first make current_set[boot_cpu_id] point to something useful.
  898. */
  899. set init_thread_union, %g6
  900. set current_set, %g2
  901. #ifdef CONFIG_SMP
  902. sethi %hi(boot_cpu_id4), %g3
  903. ldub [%g3 + %lo(boot_cpu_id4)], %g3
  904. st %g6, [%g2]
  905. add %g2, %g3, %g2
  906. #endif
  907. st %g6, [%g2]
  908. st %g0, [%g6 + TI_UWINMASK]
  909. /* Compute NWINDOWS and stash it away. Now uses %wim trick explained
  910. * in the V8 manual. Ok, this method seems to work, Sparc is cool...
  911. * No, it doesn't work, have to play the save/readCWP/restore trick.
  912. */
  913. wr %g0, 0x0, %wim ! so we do not get a trap
  914. WRITE_PAUSE
  915. save
  916. rd %psr, %g3
  917. restore
  918. and %g3, 0x1f, %g3
  919. add %g3, 0x1, %g3
  920. mov 2, %g1
  921. wr %g1, 0x0, %wim ! make window 1 invalid
  922. WRITE_PAUSE
  923. cmp %g3, 0x7
  924. bne 2f
  925. nop
  926. /* Adjust our window handling routines to
  927. * do things correctly on 7 window Sparcs.
  928. */
  929. #define PATCH_INSN(src, dest) \
  930. set src, %g5; \
  931. set dest, %g2; \
  932. ld [%g5], %g4; \
  933. st %g4, [%g2];
  934. /* Patch for window spills... */
  935. PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
  936. PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
  937. PATCH_INSN(spnwin_patch3_7win, spnwin_patch3)
  938. /* Patch for window fills... */
  939. PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
  940. PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
  941. /* Patch for trap entry setup... */
  942. PATCH_INSN(tsetup_7win_patch1, tsetup_patch1)
  943. PATCH_INSN(tsetup_7win_patch2, tsetup_patch2)
  944. PATCH_INSN(tsetup_7win_patch3, tsetup_patch3)
  945. PATCH_INSN(tsetup_7win_patch4, tsetup_patch4)
  946. PATCH_INSN(tsetup_7win_patch5, tsetup_patch5)
  947. PATCH_INSN(tsetup_7win_patch6, tsetup_patch6)
  948. /* Patch for returning from traps... */
  949. PATCH_INSN(rtrap_7win_patch1, rtrap_patch1)
  950. PATCH_INSN(rtrap_7win_patch2, rtrap_patch2)
  951. PATCH_INSN(rtrap_7win_patch3, rtrap_patch3)
  952. PATCH_INSN(rtrap_7win_patch4, rtrap_patch4)
  953. PATCH_INSN(rtrap_7win_patch5, rtrap_patch5)
  954. /* Patch for killing user windows from the register file. */
  955. PATCH_INSN(kuw_patch1_7win, kuw_patch1)
  956. /* Now patch the kernel window flush sequences.
  957. * This saves 2 traps on every switch and fork.
  958. */
  959. set 0x01000000, %g4
  960. set flush_patch_one, %g5
  961. st %g4, [%g5 + 0x18]
  962. st %g4, [%g5 + 0x1c]
  963. set flush_patch_two, %g5
  964. st %g4, [%g5 + 0x18]
  965. st %g4, [%g5 + 0x1c]
  966. set flush_patch_three, %g5
  967. st %g4, [%g5 + 0x18]
  968. st %g4, [%g5 + 0x1c]
  969. set flush_patch_four, %g5
  970. st %g4, [%g5 + 0x18]
  971. st %g4, [%g5 + 0x1c]
  972. set flush_patch_exception, %g5
  973. st %g4, [%g5 + 0x18]
  974. st %g4, [%g5 + 0x1c]
  975. set flush_patch_switch, %g5
  976. st %g4, [%g5 + 0x18]
  977. st %g4, [%g5 + 0x1c]
  978. 2:
  979. sethi %hi(nwindows), %g4
  980. st %g3, [%g4 + %lo(nwindows)] ! store final value
  981. sub %g3, 0x1, %g3
  982. sethi %hi(nwindowsm1), %g4
  983. st %g3, [%g4 + %lo(nwindowsm1)]
  984. /* Here we go, start using Linux's trap table... */
  985. set trapbase, %g3
  986. wr %g3, 0x0, %tbr
  987. WRITE_PAUSE
  988. /* Finally, turn on traps so that we can call c-code. */
  989. rd %psr, %g3
  990. wr %g3, 0x0, %psr
  991. WRITE_PAUSE
  992. wr %g3, PSR_ET, %psr
  993. WRITE_PAUSE
  994. /* First we call prom_init() to set up PROMLIB, then
  995. * off to start_kernel().
  996. */
  997. sethi %hi(prom_vector_p), %g5
  998. ld [%g5 + %lo(prom_vector_p)], %o0
  999. call prom_init
  1000. nop
  1001. call start_kernel
  1002. nop
  1003. /* We should not get here. */
  1004. call halt_me
  1005. nop
  1006. sun4_init:
  1007. sethi %hi(SUN4_PROM_VECTOR+0x84), %o1
  1008. ld [%o1 + %lo(SUN4_PROM_VECTOR+0x84)], %o1
  1009. set sun4_notsup, %o0
  1010. call %o1 /* printf */
  1011. nop
  1012. sethi %hi(SUN4_PROM_VECTOR+0xc4), %o1
  1013. ld [%o1 + %lo(SUN4_PROM_VECTOR+0xc4)], %o1
  1014. call %o1 /* exittomon */
  1015. nop
  1016. 1: ba 1b ! Cannot exit into KMON
  1017. nop
  1018. no_sun4e_here:
  1019. ld [%g7 + 0x68], %o1
  1020. set sun4e_notsup, %o0
  1021. call %o1
  1022. nop
  1023. b halt_me
  1024. nop
  1025. __INITDATA
  1026. sun4u_1:
  1027. .asciz "finddevice"
  1028. .align 4
  1029. sun4u_2:
  1030. .asciz "/chosen"
  1031. .align 4
  1032. sun4u_3:
  1033. .asciz "getprop"
  1034. .align 4
  1035. sun4u_4:
  1036. .asciz "stdout"
  1037. .align 4
  1038. sun4u_5:
  1039. .asciz "write"
  1040. .align 4
  1041. sun4u_6:
  1042. .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r"
  1043. sun4u_6e:
  1044. .align 4
  1045. sun4u_7:
  1046. .asciz "exit"
  1047. .align 8
  1048. sun4u_a1:
  1049. .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0
  1050. sun4u_r1:
  1051. .word 0
  1052. sun4u_a2:
  1053. .word 0, sun4u_3, 0, 4, 0, 1, 0
  1054. sun4u_i2:
  1055. .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0
  1056. sun4u_r2:
  1057. .word 0
  1058. sun4u_a3:
  1059. .word 0, sun4u_5, 0, 3, 0, 1, 0
  1060. sun4u_i3:
  1061. .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0
  1062. sun4u_r3:
  1063. .word 0
  1064. sun4u_a4:
  1065. .word 0, sun4u_7, 0, 0, 0, 0
  1066. sun4u_r4:
  1067. __INIT
  1068. no_sun4u_here:
  1069. set sun4u_a1, %o0
  1070. set current_pc, %l2
  1071. cmp %l2, %g3
  1072. be 1f
  1073. mov %o4, %l0
  1074. sub %g3, %l2, %l6
  1075. add %o0, %l6, %o0
  1076. mov %o0, %l4
  1077. mov sun4u_r4 - sun4u_a1, %l3
  1078. ld [%l4], %l5
  1079. 2:
  1080. add %l4, 4, %l4
  1081. cmp %l5, %l2
  1082. add %l5, %l6, %l5
  1083. bgeu,a 3f
  1084. st %l5, [%l4 - 4]
  1085. 3:
  1086. subcc %l3, 4, %l3
  1087. bne 2b
  1088. ld [%l4], %l5
  1089. 1:
  1090. call %l0
  1091. mov %o0, %l1
  1092. ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1
  1093. add %l1, (sun4u_a2 - sun4u_a1), %o0
  1094. call %l0
  1095. st %o1, [%o0 + (sun4u_i2 - sun4u_a2)]
  1096. ld [%l1 + (sun4u_1 - sun4u_a1)], %o1
  1097. add %l1, (sun4u_a3 - sun4u_a1), %o0
  1098. call %l0
  1099. st %o1, [%o0 + (sun4u_i3 - sun4u_a3)]
  1100. call %l0
  1101. add %l1, (sun4u_a4 - sun4u_a1), %o0
  1102. /* Not reached */
  1103. halt_me:
  1104. ld [%g7 + 0x74], %o0
  1105. call %o0 ! Get us out of here...
  1106. nop ! Apparently Solaris is better.
  1107. /* Ok, now we continue in the .data/.text sections */
  1108. .data
  1109. .align 4
  1110. /*
  1111. * Fill up the prom vector, note in particular the kind first element,
  1112. * no joke. I don't need all of them in here as the entire prom vector
  1113. * gets initialized in c-code so all routines can use it.
  1114. */
  1115. prom_vector_p:
  1116. .word 0
  1117. /* We calculate the following at boot time, window fills/spills and trap entry
  1118. * code uses these to keep track of the register windows.
  1119. */
  1120. .align 4
  1121. .globl nwindows
  1122. .globl nwindowsm1
  1123. nwindows:
  1124. .word 8
  1125. nwindowsm1:
  1126. .word 7
  1127. /* Boot time debugger vector value. We need this later on. */
  1128. .align 4
  1129. .globl linux_dbvec
  1130. linux_dbvec:
  1131. .word 0
  1132. .word 0
  1133. .align 8
  1134. .globl lvl14_save
  1135. lvl14_save:
  1136. .word 0
  1137. .word 0
  1138. .word 0
  1139. .word 0
  1140. .word t_irq14
  1141. .section ".fixup",#alloc,#execinstr
  1142. .globl __ret_efault
  1143. __ret_efault:
  1144. ret
  1145. restore %g0, -EFAULT, %o0