2 * head.S: The initial boot code for the Sparc port of Linux.
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)
10 * CompactPCI platform by Eric Brower, 1999.
13 #include <linux/version.h>
14 #include <linux/init.h>
18 #include <asm/contregs.h>
19 #include <asm/ptrace.h>
22 #include <asm/kdebug.h>
23 #include <asm/winmacro.h>
24 #include <asm/thread_info.h> /* TI_UWINMASK */
25 #include <asm/errno.h>
26 #include <asm/pgtsrmmu.h> /* SRMMU_PGDIR_SHIFT */
29 /* The following are used with the prom_vector node-ops to figure out
42 /* Tested on SS-5, SS-10 */
50 .asciz "Sparc-Linux sun4/sun4c support does no longer exist.\n\n"
54 .asciz "Sparc-Linux sun4e support does not exist\n\n"
57 /* The Sparc trap table, bootloader gives us control at _start. */
59 .globl _stext, _start, __stext
61 _start: /* danger danger */
68 /* We get control passed to us here at t_zero. */
69 t_zero: b gokernel; nop; nop; nop;
70 t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
71 t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
72 t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
73 t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
74 t_wovf: WINDOW_SPILL /* Window Overflow */
75 t_wunf: WINDOW_FILL /* Window Underflow */
76 t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
77 t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
78 t_dflt: SRMMU_DFAULT /* Data Miss Exception */
79 t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
80 t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
81 t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
82 t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
83 t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
84 t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
85 t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
86 t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
87 t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
88 t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
89 t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
90 t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
91 t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
92 t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
93 t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
94 t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
95 t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
97 t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
99 t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
100 t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
101 t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
102 t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
103 t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
104 t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
105 t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
106 t_dacce:SRMMU_DFAULT /* Data Access Error */
107 t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
108 t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
109 t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
110 t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
111 t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
112 t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
113 t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
114 t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
115 t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
116 t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
117 t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
118 t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
119 t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
120 t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
121 t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
122 t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
123 t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
124 t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
125 t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
126 t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
127 t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
128 t_bad80:BAD_TRAP(0x80) /* SunOS System Call */
129 t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
130 t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
131 t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
132 t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
133 t_rchk: BAD_TRAP(0x85) /* Range Check */
134 t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
135 t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
136 t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */
137 t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */
138 t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
139 t_bad8f:BAD_TRAP(0x8f)
140 t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
141 t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
142 t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
143 t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
144 t_getcc:GETCC_TRAP /* Get Condition Codes */
145 t_setcc:SETCC_TRAP /* Set Condition Codes */
146 t_getpsr:GETPSR_TRAP /* Get PSR Register */
147 t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
148 t_bada7:BAD_TRAP(0xa7)
149 t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
150 t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
151 t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
152 t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
153 t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
154 t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
155 t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
156 t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
157 t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
158 t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
159 t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
160 t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
161 t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
162 t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
163 t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
164 t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
165 t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
166 t_badfc:BAD_TRAP(0xfc)
167 t_kgdb: KGDB_TRAP(0xfd)
168 dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
169 dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
175 /* Trap tables for the other cpus. */
176 .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3
178 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
179 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
180 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
181 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
182 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
183 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
184 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
185 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
186 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
187 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
188 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
189 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
190 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
191 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
192 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
193 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
194 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
195 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
196 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
197 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
198 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
199 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
200 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
201 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
202 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
204 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
205 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
206 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
207 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
208 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
209 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
210 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
211 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
212 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
213 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
216 TRAP_ENTRY(0x82, do_hw_divzero)
217 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
218 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
219 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
220 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
221 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
222 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
223 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
224 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
225 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
226 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
227 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
228 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
229 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
230 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
231 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
232 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
233 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
234 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
235 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
236 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
237 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
238 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
239 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
240 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
241 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
242 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
243 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
246 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
247 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
248 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
249 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
250 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
251 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
252 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
253 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
254 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
255 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
256 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
257 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
258 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
259 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
260 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
261 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
262 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
263 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
264 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
265 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
266 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
267 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
268 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
269 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
270 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
272 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
273 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
274 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
275 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
276 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
277 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
278 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
279 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
280 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
281 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
284 TRAP_ENTRY(0x82, do_hw_divzero)
285 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
286 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
287 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
288 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
289 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
290 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
291 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
292 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
293 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
294 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
295 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
296 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
297 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
298 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
299 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
300 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
301 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
302 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
303 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
304 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
305 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
306 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
307 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
308 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
309 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
310 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
311 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
314 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
315 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
316 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
317 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
318 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
319 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
320 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
321 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
322 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
323 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
324 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
325 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
326 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
327 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
328 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
329 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
330 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
331 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
332 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
333 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
334 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
335 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
336 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
337 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
338 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
340 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
341 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
342 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
343 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
344 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
345 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
346 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
347 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
348 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
349 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
352 TRAP_ENTRY(0x82, do_hw_divzero)
353 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
354 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
355 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
356 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
357 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
358 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
359 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
360 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
361 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
362 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
363 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
364 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
365 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
366 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
367 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
368 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
369 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
370 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
371 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
372 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
373 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
374 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
375 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
376 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
377 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
378 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
379 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
384 /* This was the only reasonable way I could think of to properly align
385 * these page-table data structures.
387 .globl swapper_pg_dir
388 swapper_pg_dir: .skip PAGE_SIZE
389 .globl empty_zero_page
390 empty_zero_page: .skip PAGE_SIZE
395 .global sparc_ramdisk_image
396 .global sparc_ramdisk_size
398 /* This stuff has to be in sync with SILO and other potential boot loaders
399 * Fields should be kept upward compatible and whenever any change is made,
400 * HdrS version should be incremented.
403 .word LINUX_VERSION_CODE
404 .half 0x0203 /* HdrS version */
419 /* Cool, here we go. Pick up the romvec pointer in %o0 and stash it in
420 * %g7 and at prom_vector_p. And also quickly check whether we are on
421 * a v0, v2, or v3 prom.
424 /* Ok, it's nice to know, as early as possible, if we
425 * are already mapped where we expect to be in virtual
426 * memory. The Solaris /boot elf format bootloader
427 * will peek into our elf header and load us where
428 * we want to be, otherwise we have to re-map.
430 * Some boot loaders don't place the jmp'rs address
431 * in %o7, so we do a pc-relative call to a local
432 * label, then see what %o7 has.
435 mov %o7, %g4 ! Save %o7
437 /* Jump to it, and pray... */
447 mov %g4, %o7 /* Previous %o7. */
449 mov %o0, %l0 ! stash away romvec
450 mov %o0, %g7 ! put it here too
451 mov %o1, %l1 ! stash away debug_vec too
453 /* Ok, let's check out our run time program counter. */
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.
471 /* Copy over the Prom's level 14 clock handler. */
475 * preserve our linked/calculated instructions
479 sub %g1, %l6, %g1 ! translate to physical
480 sub %g3, %l6, %g3 ! translate to physical
487 andn %g1, 0xfff, %g1 ! proms trap table base
488 or %g0, (0x1e<<4), %g2 ! offset to lvl14 intr
495 std %g4, [%g3 + 0x8] ! Copy proms handler
497 /* DON'T TOUCH %l0 thru %l5 in these remapping routines,
498 * we need their values afterwards!
501 /* Now check whether we are already mapped, if we
502 * are we can skip all this garbage coming up.
506 be go_to_highmem ! this will be a nop then
509 /* Validate that we are in fact running on an
519 set sun4c_notsup, %o0
527 lda [%g0] ASI_M_MMUREGS, %g1
529 be halt_sun4_or_sun4c
533 /* First, check for a viking (TI) module. */
541 /* Figure out what kind of viking we are on.
542 * We need to know if we have to play with the
543 * AC bit and disable traps or not.
546 /* I've only seen MicroSparc's on SparcClassics with this
550 lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg
553 bnz srmmu_nviking ! is in mbus mode
556 rd %psr, %g3 ! DO NOT TOUCH %g3
557 andn %g3, PSR_ET, %g2
561 /* Get context table pointer, then convert to
562 * a physical address, which is 36 bits.
565 lda [%g4] ASI_M_MMUREGS, %g4
566 sll %g4, 0x4, %g4 ! We use this below
569 /* Set the AC bit in the Viking's MMU control reg. */
570 lda [%g0] ASI_M_MMUREGS, %g5 ! DO NOT TOUCH %g5
571 set 0x8000, %g6 ! AC bit mask
572 or %g5, %g6, %g6 ! Or it in...
573 sta %g6, [%g0] ASI_M_MMUREGS ! Close your eyes...
575 /* Grrr, why does it seem like every other load/store
576 * on the sun4m is in some ASI space...
577 * Fine with me, let's get the pointer to the level 1
578 * page table directory and fetch its entry.
580 lda [%g4] ASI_M_BYPASS, %o1 ! This is a level 1 ptr
581 srl %o1, 0x4, %o1 ! Clear low 4 bits
582 sll %o1, 0x8, %o1 ! Make physical
584 /* Ok, pull in the PTD. */
585 lda [%o1] ASI_M_BYPASS, %o2 ! This is the 0x0 16MB pgd
587 /* Calculate to KERNBASE entry. */
588 add %o1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %o3
590 /* Poke the entry into the calculated address. */
591 sta %o2, [%o3] ASI_M_BYPASS
593 /* I don't get it Sun, if you engineered all these
594 * boot loaders and the PROM (thank you for the debugging
595 * features btw) why did you not have them load kernel
596 * images up in high address space, since this is necessary
597 * for ABI compliance anyways? Does this low-mapping provide
598 * enhanced interoperability?
600 * "The PROM is the computer."
603 /* Ok, restore the MMU control register we saved in %g5 */
604 sta %g5, [%g0] ASI_M_MMUREGS ! POW... ouch
606 /* Turn traps back on. We saved it in %g3 earlier. */
607 wr %g3, 0x0, %psr ! tick tock, tick tock
609 /* Now we burn precious CPU cycles due to bad engineering. */
612 /* Wow, all that just to move a 32-bit value from one
613 * place to another... Jump to high memory.
618 /* This works on viking's in Mbus mode and all
619 * other MBUS modules. It is virtually the same as
620 * the above madness sans turning traps off and flipping
625 lda [%g1] ASI_M_MMUREGS, %g1 ! get ctx table ptr
626 sll %g1, 0x4, %g1 ! make physical addr
627 lda [%g1] ASI_M_BYPASS, %g1 ! ptr to level 1 pg_table
629 sll %g1, 0x8, %g1 ! make phys addr for l1 tbl
631 lda [%g1] ASI_M_BYPASS, %g2 ! get level1 entry for 0x0
632 add %g1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %g3
633 sta %g2, [%g3] ASI_M_BYPASS ! place at KERNBASE entry
638 /* Now do a non-relative jump so that PC is in high-memory */
640 set execute_in_high_mem, %g1
644 /* The code above should be at beginning and we have to take care about
645 * short jumps, as branching to .init.text section from .text is usually
648 /* Acquire boot time privileged register values, this will help debugging.
649 * I figure out and store nwindows and nwindowsm1 later on.
652 mov %l0, %o0 ! put back romvec
653 mov %l1, %o1 ! and debug_vec
655 sethi %hi(prom_vector_p), %g1
656 st %o0, [%g1 + %lo(prom_vector_p)]
658 sethi %hi(linux_dbvec), %g1
659 st %o1, [%g1 + %lo(linux_dbvec)]
661 /* Get the machine type via the mysterious romvec node operations. */
667 or %g0, %g0, %o0 ! next_node(0) = first_node
670 sethi %hi(cputypvar), %o1 ! First node has cpu-arch
671 or %o1, %lo(cputypvar), %o1
672 sethi %hi(cputypval), %o2 ! information, the string
673 or %o2, %lo(cputypval), %o2
674 ld [%l1], %l0 ! 'compatible' tells
675 ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where
676 call %l0 ! x is one of 'm', 'd' or 'e'.
677 nop ! %o2 holds pointer
678 ! to a buf where above string
679 ! will get stored by the prom.
681 #ifdef CONFIG_SPARC_LEON
682 /* no cpu-type check is needed, it is a SPARC-LEON */
684 sethi %hi(boot_cpu_id), %g2 ! boot-cpu index
687 ldub [%g2 + %lo(boot_cpu_id)], %g1
688 cmp %g1, 0xff ! unset means first CPU
689 bne leon_smp_cpu_startup ! continue only with master
692 /* Get CPU-ID from most significant 4-bit of ASR17 */
696 /* Update boot_cpu_id only on boot cpu */
697 stub %g1, [%g2 + %lo(boot_cpu_id)]
703 /* Check to cputype. We may be booted on a sun4u (64 bit box),
704 * and sun4d needs special treatment.
708 ldub [%o2 + 0x4], %l1
717 be no_sun4e_here ! Could be a sun4e.
719 b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
722 /* CPUID in bootbus can be found at PA 0xff0140000 */
723 #define SUN4D_BOOTBUS_CPUID 0xf0140000
726 /* Need to patch call to handler_irq */
727 set patch_handler_irq, %g4
728 set sun4d_handler_irq, %g5
729 sethi %hi(0x40000000), %g3 ! call
736 /* Get our CPU id out of bootbus */
737 set SUN4D_BOOTBUS_CPUID, %g3
738 lduba [%g3] ASI_M_CTL, %g3
741 sta %g4, [%g0] ASI_M_VIKING_TMP1
742 sethi %hi(boot_cpu_id), %g5
743 stb %g4, [%g5 + %lo(boot_cpu_id)]
746 /* Fall through to sun4m_init */
749 /* Ok, the PROM could have done funny things and apple cider could still
750 * be sitting in the fault status/address registers. Read them all to
751 * clear them so we don't get magic faults later on.
753 /* This sucks, apparently this makes Vikings call prom panic, will fix later */
756 srl %o1, 28, %o1 ! Get a type of the CPU
758 subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC
763 lda [%o0] ASI_M_MMUREGS, %g0
765 lda [%o0] ASI_M_MMUREGS, %g0
767 /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
773 lda [%o0] ASI_M_MMUREGS, %g0
775 lda [%o0] ASI_M_MMUREGS, %g0
781 /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
785 sethi %hi(cputyp), %o0
786 st %g4, [%o0 + %lo(cputyp)]
788 /* Turn on Supervisor, EnableFloating, and all the PIL bits.
789 * Also puts us in register window zero with traps off.
791 set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
795 /* I want a kernel stack NOW! */
796 set init_thread_union, %g1
797 set (THREAD_SIZE - STACKFRAME_SZ), %g2
799 mov 0, %fp /* And for good luck */
801 /* Zero out our BSS section. */
802 set __bss_start , %o0 ! First address of BSS
803 set _end , %o1 ! Last address of BSS
811 /* If boot_cpu_id has not been setup by machine specific
812 * init-code above we default it to zero.
814 sethi %hi(boot_cpu_id), %g2
815 ldub [%g2 + %lo(boot_cpu_id)], %g3
820 stub %g3, [%g2 + %lo(boot_cpu_id)]
824 /* Initialize the uwinmask value for init task just in case.
825 * But first make current_set[boot_cpu_id] point to something useful.
827 set init_thread_union, %g6
835 st %g0, [%g6 + TI_UWINMASK]
837 /* Compute NWINDOWS and stash it away. Now uses %wim trick explained
838 * in the V8 manual. Ok, this method seems to work, Sparc is cool...
839 * No, it doesn't work, have to play the save/readCWP/restore trick.
842 wr %g0, 0x0, %wim ! so we do not get a trap
855 wr %g1, 0x0, %wim ! make window 1 invalid
862 /* Adjust our window handling routines to
863 * do things correctly on 7 window Sparcs.
866 #define PATCH_INSN(src, dest) \
872 /* Patch for window spills... */
873 PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
874 PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
875 PATCH_INSN(spnwin_patch3_7win, spnwin_patch3)
877 /* Patch for window fills... */
878 PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
879 PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
881 /* Patch for trap entry setup... */
882 PATCH_INSN(tsetup_7win_patch1, tsetup_patch1)
883 PATCH_INSN(tsetup_7win_patch2, tsetup_patch2)
884 PATCH_INSN(tsetup_7win_patch3, tsetup_patch3)
885 PATCH_INSN(tsetup_7win_patch4, tsetup_patch4)
886 PATCH_INSN(tsetup_7win_patch5, tsetup_patch5)
887 PATCH_INSN(tsetup_7win_patch6, tsetup_patch6)
889 /* Patch for returning from traps... */
890 PATCH_INSN(rtrap_7win_patch1, rtrap_patch1)
891 PATCH_INSN(rtrap_7win_patch2, rtrap_patch2)
892 PATCH_INSN(rtrap_7win_patch3, rtrap_patch3)
893 PATCH_INSN(rtrap_7win_patch4, rtrap_patch4)
894 PATCH_INSN(rtrap_7win_patch5, rtrap_patch5)
896 /* Patch for killing user windows from the register file. */
897 PATCH_INSN(kuw_patch1_7win, kuw_patch1)
899 /* Now patch the kernel window flush sequences.
900 * This saves 2 traps on every switch and fork.
903 set flush_patch_one, %g5
906 set flush_patch_two, %g5
909 set flush_patch_three, %g5
912 set flush_patch_four, %g5
915 set flush_patch_exception, %g5
918 set flush_patch_switch, %g5
923 sethi %hi(nwindows), %g4
924 st %g3, [%g4 + %lo(nwindows)] ! store final value
926 sethi %hi(nwindowsm1), %g4
927 st %g3, [%g4 + %lo(nwindowsm1)]
929 /* Here we go, start using Linux's trap table... */
934 /* Finally, turn on traps so that we can call c-code. */
942 /* First we call prom_init() to set up PROMLIB, then
943 * off to start_kernel().
946 sethi %hi(prom_vector_p), %g5
947 ld [%g5 + %lo(prom_vector_p)], %o0
954 /* We should not get here. */
960 set sun4e_notsup, %o0
984 .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r"
991 .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0
995 .word 0, sun4u_3, 0, 4, 0, 1, 0
997 .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0
1001 .word 0, sun4u_5, 0, 3, 0, 1, 0
1003 .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0
1007 .word 0, sun4u_7, 0, 0, 0, 0
1020 mov sun4u_r4 - sun4u_a1, %l3
1036 ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1
1037 add %l1, (sun4u_a2 - sun4u_a1), %o0
1039 st %o1, [%o0 + (sun4u_i2 - sun4u_a2)]
1041 ld [%l1 + (sun4u_1 - sun4u_a1)], %o1
1042 add %l1, (sun4u_a3 - sun4u_a1), %o0
1044 st %o1, [%o0 + (sun4u_i3 - sun4u_a3)]
1047 add %l1, (sun4u_a4 - sun4u_a1), %o0
1051 ld [%g7 + 0x74], %o0
1052 call %o0 ! Get us out of here...
1053 nop ! Apparently Solaris is better.
1055 /* Ok, now we continue in the .data/.text sections */
1061 * Fill up the prom vector, note in particular the kind first element,
1062 * no joke. I don't need all of them in here as the entire prom vector
1063 * gets initialized in c-code so all routines can use it.
1069 /* We calculate the following at boot time, window fills/spills and trap entry
1070 * code uses these to keep track of the register windows.
1081 /* Boot time debugger vector value. We need this later on. */
1099 .section ".fixup",#alloc,#execinstr
1103 restore %g0, -EFAULT, %o0