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 */
30 * The following are used with the prom_vector node-ops to figure out
45 cputypvallen = cputypvar - cputypval
49 * Sun people can't spell worth damn. "compatability" indeed.
50 * At least we *know* we can't spell, and use a spell-checker.
53 /* Uh, actually Linus it is I who cannot spell. Too much murky
54 * Sparc assembly will do this to ya.
57 .asciz "compatability"
59 /* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */
67 .asciz "Sparc-Linux sun4/sun4c support does no longer exist.\n\n"
71 .asciz "Sparc-Linux sun4e support does not exist\n\n"
74 /* The Sparc trap table, bootloader gives us control at _start. */
76 .globl _stext, _start, __stext
78 _start: /* danger danger */
85 /* We get control passed to us here at t_zero. */
86 t_zero: b gokernel; nop; nop; nop;
87 t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
88 t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
89 t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
90 t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
91 t_wovf: WINDOW_SPILL /* Window Overflow */
92 t_wunf: WINDOW_FILL /* Window Underflow */
93 t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
94 t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
95 t_dflt: SRMMU_DFAULT /* Data Miss Exception */
96 t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
97 t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
98 t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
99 t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
100 t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
101 t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
102 t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
103 t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
104 t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
105 t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
106 t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
107 t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
108 t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
109 t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
110 t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
111 t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
112 t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
114 t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
116 t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
117 t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
118 t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
119 t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
120 t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
121 t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
122 t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
123 t_dacce:SRMMU_DFAULT /* Data Access Error */
124 t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
125 t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
126 t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
127 t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
128 t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
129 t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
130 t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
131 t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
132 t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
133 t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
134 t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
135 t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
136 t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
137 t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
138 t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
139 t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
140 t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
141 t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
142 t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
143 t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
144 t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
145 t_bad80:BAD_TRAP(0x80) /* SunOS System Call */
146 t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
147 t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
148 t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
149 t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
150 t_rchk: BAD_TRAP(0x85) /* Range Check */
151 t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
152 t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
153 t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */
154 t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */
155 t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
156 t_bad8f:BAD_TRAP(0x8f)
157 t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
158 t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
159 t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
160 t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
161 t_getcc:GETCC_TRAP /* Get Condition Codes */
162 t_setcc:SETCC_TRAP /* Set Condition Codes */
163 t_getpsr:GETPSR_TRAP /* Get PSR Register */
164 t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
165 t_bada7:BAD_TRAP(0xa7)
166 t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
167 t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
168 t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
169 t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
170 t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
171 t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
172 t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
173 t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
174 t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
175 t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
176 t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
177 t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
178 t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
179 t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
180 t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
181 t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
182 t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
183 t_badfc:BAD_TRAP(0xfc)
184 t_kgdb: KGDB_TRAP(0xfd)
185 dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
186 dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
192 /* Trap tables for the other cpus. */
193 .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3
195 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
196 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
197 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
198 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
199 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
200 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
201 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
202 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
203 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
204 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
205 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
206 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
207 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
208 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
209 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
210 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
211 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
212 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
213 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
214 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
215 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
216 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
217 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
218 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
219 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
221 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
222 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
223 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
224 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
225 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
226 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
227 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
228 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
229 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
230 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
233 TRAP_ENTRY(0x82, do_hw_divzero)
234 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
235 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
236 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
237 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
238 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
239 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
240 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
241 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
242 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
243 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
244 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
245 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
246 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
247 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
248 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
249 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
250 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
251 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
252 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
253 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
254 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
255 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
256 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
257 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
258 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
259 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
260 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
263 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
264 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
265 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
266 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
267 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
268 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
269 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
270 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
271 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
272 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
273 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
274 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
275 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
276 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
277 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
278 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
279 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
280 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
281 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
282 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
283 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
284 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
285 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
286 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
287 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
289 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
290 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
291 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
292 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
293 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
294 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
295 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
296 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
297 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
298 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
301 TRAP_ENTRY(0x82, do_hw_divzero)
302 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
303 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
304 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
305 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
306 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
307 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
308 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
309 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
310 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
311 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
312 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
313 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
314 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
315 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
316 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
317 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
318 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
319 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
320 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
321 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
322 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
323 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
324 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
325 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
326 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
327 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
328 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
331 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
332 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
333 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
334 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
335 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
336 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
337 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
338 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
339 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
340 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
341 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
342 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
343 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
344 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
345 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
346 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
347 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
348 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
349 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
350 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
351 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
352 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
353 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
354 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
355 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
357 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
358 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
359 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
360 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
361 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
362 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
363 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
364 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
365 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
366 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
369 TRAP_ENTRY(0x82, do_hw_divzero)
370 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
371 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
372 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
373 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
374 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
375 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
376 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
377 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
378 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
379 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
380 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
381 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
382 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
383 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
384 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
385 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
386 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
387 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
388 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
389 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
390 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
391 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
392 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
393 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
394 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
395 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
396 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
401 /* This was the only reasonable way I could think of to properly align
402 * these page-table data structures.
404 .globl swapper_pg_dir
405 swapper_pg_dir: .skip PAGE_SIZE
406 .globl empty_zero_page
407 empty_zero_page: .skip PAGE_SIZE
412 .global sparc_ramdisk_image
413 .global sparc_ramdisk_size
415 /* This stuff has to be in sync with SILO and other potential boot loaders
416 * Fields should be kept upward compatible and whenever any change is made,
417 * HdrS version should be incremented.
420 .word LINUX_VERSION_CODE
421 .half 0x0203 /* HdrS version */
436 /* Cool, here we go. Pick up the romvec pointer in %o0 and stash it in
437 * %g7 and at prom_vector_p. And also quickly check whether we are on
438 * a v0, v2, or v3 prom.
441 /* Ok, it's nice to know, as early as possible, if we
442 * are already mapped where we expect to be in virtual
443 * memory. The Solaris /boot elf format bootloader
444 * will peek into our elf header and load us where
445 * we want to be, otherwise we have to re-map.
447 * Some boot loaders don't place the jmp'rs address
448 * in %o7, so we do a pc-relative call to a local
449 * label, then see what %o7 has.
452 mov %o7, %g4 ! Save %o7
454 /* Jump to it, and pray... */
464 mov %g4, %o7 /* Previous %o7. */
466 mov %o0, %l0 ! stash away romvec
467 mov %o0, %g7 ! put it here too
468 mov %o1, %l1 ! stash away debug_vec too
470 /* Ok, let's check out our run time program counter. */
476 /* %l6 will hold the offset we have to subtract
477 * from absolute symbols in order to access areas
478 * in our own image. If already mapped this is
479 * just plain zero, else it is KERNBASE.
488 /* Copy over the Prom's level 14 clock handler. */
492 * preserve our linked/calculated instructions
496 sub %g1, %l6, %g1 ! translate to physical
497 sub %g3, %l6, %g3 ! translate to physical
504 andn %g1, 0xfff, %g1 ! proms trap table base
505 or %g0, (0x1e<<4), %g2 ! offset to lvl14 intr
512 std %g4, [%g3 + 0x8] ! Copy proms handler
514 /* DON'T TOUCH %l0 thru %l5 in these remapping routines,
515 * we need their values afterwards!
518 /* Now check whether we are already mapped, if we
519 * are we can skip all this garbage coming up.
523 be go_to_highmem ! this will be a nop then
526 /* Validate that we are in fact running on an
536 set sun4c_notsup, %o0
544 lda [%g0] ASI_M_MMUREGS, %g1
546 be halt_sun4_or_sun4c
550 /* First, check for a viking (TI) module. */
558 /* Figure out what kind of viking we are on.
559 * We need to know if we have to play with the
560 * AC bit and disable traps or not.
563 /* I've only seen MicroSparc's on SparcClassics with this
567 lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg
570 bnz srmmu_nviking ! is in mbus mode
573 rd %psr, %g3 ! DO NOT TOUCH %g3
574 andn %g3, PSR_ET, %g2
578 /* Get context table pointer, then convert to
579 * a physical address, which is 36 bits.
582 lda [%g4] ASI_M_MMUREGS, %g4
583 sll %g4, 0x4, %g4 ! We use this below
586 /* Set the AC bit in the Viking's MMU control reg. */
587 lda [%g0] ASI_M_MMUREGS, %g5 ! DO NOT TOUCH %g5
588 set 0x8000, %g6 ! AC bit mask
589 or %g5, %g6, %g6 ! Or it in...
590 sta %g6, [%g0] ASI_M_MMUREGS ! Close your eyes...
592 /* Grrr, why does it seem like every other load/store
593 * on the sun4m is in some ASI space...
594 * Fine with me, let's get the pointer to the level 1
595 * page table directory and fetch its entry.
597 lda [%g4] ASI_M_BYPASS, %o1 ! This is a level 1 ptr
598 srl %o1, 0x4, %o1 ! Clear low 4 bits
599 sll %o1, 0x8, %o1 ! Make physical
601 /* Ok, pull in the PTD. */
602 lda [%o1] ASI_M_BYPASS, %o2 ! This is the 0x0 16MB pgd
604 /* Calculate to KERNBASE entry. */
605 add %o1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %o3
607 /* Poke the entry into the calculated address. */
608 sta %o2, [%o3] ASI_M_BYPASS
610 /* I don't get it Sun, if you engineered all these
611 * boot loaders and the PROM (thank you for the debugging
612 * features btw) why did you not have them load kernel
613 * images up in high address space, since this is necessary
614 * for ABI compliance anyways? Does this low-mapping provide
615 * enhanced interoperability?
617 * "The PROM is the computer."
620 /* Ok, restore the MMU control register we saved in %g5 */
621 sta %g5, [%g0] ASI_M_MMUREGS ! POW... ouch
623 /* Turn traps back on. We saved it in %g3 earlier. */
624 wr %g3, 0x0, %psr ! tick tock, tick tock
626 /* Now we burn precious CPU cycles due to bad engineering. */
629 /* Wow, all that just to move a 32-bit value from one
630 * place to another... Jump to high memory.
635 /* This works on viking's in Mbus mode and all
636 * other MBUS modules. It is virtually the same as
637 * the above madness sans turning traps off and flipping
642 lda [%g1] ASI_M_MMUREGS, %g1 ! get ctx table ptr
643 sll %g1, 0x4, %g1 ! make physical addr
644 lda [%g1] ASI_M_BYPASS, %g1 ! ptr to level 1 pg_table
646 sll %g1, 0x8, %g1 ! make phys addr for l1 tbl
648 lda [%g1] ASI_M_BYPASS, %g2 ! get level1 entry for 0x0
649 add %g1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %g3
650 sta %g2, [%g3] ASI_M_BYPASS ! place at KERNBASE entry
655 /* Now do a non-relative jump so that PC is in high-memory */
657 set execute_in_high_mem, %g1
661 /* The code above should be at beginning and we have to take care about
662 * short jumps, as branching to .init.text section from .text is usually
665 /* Acquire boot time privileged register values, this will help debugging.
666 * I figure out and store nwindows and nwindowsm1 later on.
669 mov %l0, %o0 ! put back romvec
670 mov %l1, %o1 ! and debug_vec
672 sethi %hi(prom_vector_p), %g1
673 st %o0, [%g1 + %lo(prom_vector_p)]
675 sethi %hi(linux_dbvec), %g1
676 st %o1, [%g1 + %lo(linux_dbvec)]
678 /* Get the machine type via the mysterious romvec node operations. */
684 or %g0, %g0, %o0 ! next_node(0) = first_node
687 sethi %hi(cputypvar), %o1 ! First node has cpu-arch
688 or %o1, %lo(cputypvar), %o1
689 sethi %hi(cputypval), %o2 ! information, the string
690 or %o2, %lo(cputypval), %o2
691 ld [%l1], %l0 ! 'compatibility' tells
692 ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where
693 call %l0 ! x is one of '', 'c', 'm',
694 nop ! 'd' or 'e'. %o2 holds pointer
695 ! to a buf where above string
696 ! will get stored by the prom.
699 bpos got_prop ! Got the property
703 sethi %hi(cputypvar_sun4m), %o1
704 or %o1, %lo(cputypvar_sun4m), %o1
705 sethi %hi(cputypval), %o2
706 or %o2, %lo(cputypval), %o2
713 #ifdef CONFIG_SPARC_LEON
714 /* no cpu-type check is needed, it is a SPARC-LEON */
716 sethi %hi(boot_cpu_id), %g2 ! boot-cpu index
719 ldub [%g2 + %lo(boot_cpu_id)], %g1
720 cmp %g1, 0xff ! unset means first CPU
721 bne leon_smp_cpu_startup ! continue only with master
724 /* Get CPU-ID from most significant 4-bit of ASR17 */
728 /* Update boot_cpu_id only on boot cpu */
729 stub %g1, [%g2 + %lo(boot_cpu_id)]
735 ldub [%o2 + 0x4], %l1
748 be no_sun4e_here ! Could be a sun4e.
750 b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
753 1: set cputypval, %l1
754 ldub [%l1 + 0x4], %l1
755 cmp %l1, 'd' ! Let us see how the beast will die
759 /* If not sun4d assume sun4m */
763 /* CPUID in bootbus can be found at PA 0xff0140000 */
764 #define SUN4D_BOOTBUS_CPUID 0xf0140000
767 /* Need to patch call to handler_irq */
768 set patch_handler_irq, %g4
769 set sun4d_handler_irq, %g5
770 sethi %hi(0x40000000), %g3 ! call
777 /* Get our CPU id out of bootbus */
778 set SUN4D_BOOTBUS_CPUID, %g3
779 lduba [%g3] ASI_M_CTL, %g3
782 sta %g4, [%g0] ASI_M_VIKING_TMP1
783 sethi %hi(boot_cpu_id), %g5
784 stb %g4, [%g5 + %lo(boot_cpu_id)]
787 /* Fall through to sun4m_init */
790 /* XXX Fucking Cypress... */
791 lda [%g0] ASI_M_MMUREGS, %g5
799 cmp %g4, 7 /* This would be a HyperSparc. */
806 #define PATCH_IT(dst, src) \
814 /* Signed multiply. */
815 PATCH_IT(.mul, .mul_patch)
816 PATCH_IT(.mul+0x08, .mul_patch+0x08)
818 /* Signed remainder. */
819 PATCH_IT(.rem, .rem_patch)
820 PATCH_IT(.rem+0x08, .rem_patch+0x08)
821 PATCH_IT(.rem+0x10, .rem_patch+0x10)
822 PATCH_IT(.rem+0x18, .rem_patch+0x18)
823 PATCH_IT(.rem+0x20, .rem_patch+0x20)
824 PATCH_IT(.rem+0x28, .rem_patch+0x28)
826 /* Signed division. */
827 PATCH_IT(.div, .div_patch)
828 PATCH_IT(.div+0x08, .div_patch+0x08)
829 PATCH_IT(.div+0x10, .div_patch+0x10)
830 PATCH_IT(.div+0x18, .div_patch+0x18)
831 PATCH_IT(.div+0x20, .div_patch+0x20)
833 /* Unsigned multiply. */
834 PATCH_IT(.umul, .umul_patch)
835 PATCH_IT(.umul+0x08, .umul_patch+0x08)
837 /* Unsigned remainder. */
838 PATCH_IT(.urem, .urem_patch)
839 PATCH_IT(.urem+0x08, .urem_patch+0x08)
840 PATCH_IT(.urem+0x10, .urem_patch+0x10)
841 PATCH_IT(.urem+0x18, .urem_patch+0x18)
843 /* Unsigned division. */
844 PATCH_IT(.udiv, .udiv_patch)
845 PATCH_IT(.udiv+0x08, .udiv_patch+0x08)
846 PATCH_IT(.udiv+0x10, .udiv_patch+0x10)
850 /* Ok, the PROM could have done funny things and apple cider could still
851 * be sitting in the fault status/address registers. Read them all to
852 * clear them so we don't get magic faults later on.
854 /* This sucks, apparently this makes Vikings call prom panic, will fix later */
857 srl %o1, 28, %o1 ! Get a type of the CPU
859 subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC
864 lda [%o0] ASI_M_MMUREGS, %g0
866 lda [%o0] ASI_M_MMUREGS, %g0
868 /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
874 lda [%o0] ASI_M_MMUREGS, %g0
876 lda [%o0] ASI_M_MMUREGS, %g0
882 /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
886 sethi %hi(cputyp), %o0
887 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.
892 set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
896 /* I want a kernel stack NOW! */
897 set init_thread_union, %g1
898 set (THREAD_SIZE - STACKFRAME_SZ), %g2
900 mov 0, %fp /* And for good luck */
902 /* Zero out our BSS section. */
903 set __bss_start , %o0 ! First address of BSS
904 set _end , %o1 ! Last address of BSS
912 /* If boot_cpu_id has not been setup by machine specific
913 * init-code above we default it to zero.
915 sethi %hi(boot_cpu_id), %g2
916 ldub [%g2 + %lo(boot_cpu_id)], %g3
921 stub %g3, [%g2 + %lo(boot_cpu_id)]
923 1: /* boot_cpu_id set. calculate boot_cpu_id4 = boot_cpu_id*4 */
925 sethi %hi(boot_cpu_id4), %g2
926 stub %g3, [%g2 + %lo(boot_cpu_id4)]
928 /* Initialize the uwinmask value for init task just in case.
929 * But first make current_set[boot_cpu_id] point to something useful.
931 set init_thread_union, %g6
939 st %g0, [%g6 + TI_UWINMASK]
941 /* Compute NWINDOWS and stash it away. Now uses %wim trick explained
942 * in the V8 manual. Ok, this method seems to work, Sparc is cool...
943 * No, it doesn't work, have to play the save/readCWP/restore trick.
946 wr %g0, 0x0, %wim ! so we do not get a trap
959 wr %g1, 0x0, %wim ! make window 1 invalid
966 /* Adjust our window handling routines to
967 * do things correctly on 7 window Sparcs.
970 #define PATCH_INSN(src, dest) \
976 /* Patch for window spills... */
977 PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
978 PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
979 PATCH_INSN(spnwin_patch3_7win, spnwin_patch3)
981 /* Patch for window fills... */
982 PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
983 PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
985 /* Patch for trap entry setup... */
986 PATCH_INSN(tsetup_7win_patch1, tsetup_patch1)
987 PATCH_INSN(tsetup_7win_patch2, tsetup_patch2)
988 PATCH_INSN(tsetup_7win_patch3, tsetup_patch3)
989 PATCH_INSN(tsetup_7win_patch4, tsetup_patch4)
990 PATCH_INSN(tsetup_7win_patch5, tsetup_patch5)
991 PATCH_INSN(tsetup_7win_patch6, tsetup_patch6)
993 /* Patch for returning from traps... */
994 PATCH_INSN(rtrap_7win_patch1, rtrap_patch1)
995 PATCH_INSN(rtrap_7win_patch2, rtrap_patch2)
996 PATCH_INSN(rtrap_7win_patch3, rtrap_patch3)
997 PATCH_INSN(rtrap_7win_patch4, rtrap_patch4)
998 PATCH_INSN(rtrap_7win_patch5, rtrap_patch5)
1000 /* Patch for killing user windows from the register file. */
1001 PATCH_INSN(kuw_patch1_7win, kuw_patch1)
1003 /* Now patch the kernel window flush sequences.
1004 * This saves 2 traps on every switch and fork.
1007 set flush_patch_one, %g5
1008 st %g4, [%g5 + 0x18]
1009 st %g4, [%g5 + 0x1c]
1010 set flush_patch_two, %g5
1011 st %g4, [%g5 + 0x18]
1012 st %g4, [%g5 + 0x1c]
1013 set flush_patch_three, %g5
1014 st %g4, [%g5 + 0x18]
1015 st %g4, [%g5 + 0x1c]
1016 set flush_patch_four, %g5
1017 st %g4, [%g5 + 0x18]
1018 st %g4, [%g5 + 0x1c]
1019 set flush_patch_exception, %g5
1020 st %g4, [%g5 + 0x18]
1021 st %g4, [%g5 + 0x1c]
1022 set flush_patch_switch, %g5
1023 st %g4, [%g5 + 0x18]
1024 st %g4, [%g5 + 0x1c]
1027 sethi %hi(nwindows), %g4
1028 st %g3, [%g4 + %lo(nwindows)] ! store final value
1030 sethi %hi(nwindowsm1), %g4
1031 st %g3, [%g4 + %lo(nwindowsm1)]
1033 /* Here we go, start using Linux's trap table... */
1038 /* Finally, turn on traps so that we can call c-code. */
1043 wr %g3, PSR_ET, %psr
1046 /* First we call prom_init() to set up PROMLIB, then
1047 * off to start_kernel().
1050 sethi %hi(prom_vector_p), %g5
1051 ld [%g5 + %lo(prom_vector_p)], %o0
1058 /* We should not get here. */
1062 ld [%g7 + 0x68], %o1
1063 set sun4c_notsup, %o0
1070 ld [%g7 + 0x68], %o1
1071 set sun4e_notsup, %o0
1095 .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r"
1102 .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0
1106 .word 0, sun4u_3, 0, 4, 0, 1, 0
1108 .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0
1112 .word 0, sun4u_5, 0, 3, 0, 1, 0
1114 .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0
1118 .word 0, sun4u_7, 0, 0, 0, 0
1131 mov sun4u_r4 - sun4u_a1, %l3
1147 ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1
1148 add %l1, (sun4u_a2 - sun4u_a1), %o0
1150 st %o1, [%o0 + (sun4u_i2 - sun4u_a2)]
1152 ld [%l1 + (sun4u_1 - sun4u_a1)], %o1
1153 add %l1, (sun4u_a3 - sun4u_a1), %o0
1155 st %o1, [%o0 + (sun4u_i3 - sun4u_a3)]
1158 add %l1, (sun4u_a4 - sun4u_a1), %o0
1162 ld [%g7 + 0x74], %o0
1163 call %o0 ! Get us out of here...
1164 nop ! Apparently Solaris is better.
1166 /* Ok, now we continue in the .data/.text sections */
1172 * Fill up the prom vector, note in particular the kind first element,
1173 * no joke. I don't need all of them in here as the entire prom vector
1174 * gets initialized in c-code so all routines can use it.
1180 /* We calculate the following at boot time, window fills/spills and trap entry
1181 * code uses these to keep track of the register windows.
1192 /* Boot time debugger vector value. We need this later on. */
1210 .section ".fixup",#alloc,#execinstr
1214 restore %g0, -EFAULT, %o0