head.S 44 KB

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