head.S 44 KB

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