head_32.S 44 KB

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