blob: 10830b5a9f4a936366530d759201561c34a56447 [file] [log] [blame]
Adrian Bunk88278ca2008-05-19 16:53:02 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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
13#include <linux/version.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/init.h>
15
16#include <asm/head.h>
17#include <asm/asi.h>
18#include <asm/contregs.h>
19#include <asm/ptrace.h>
20#include <asm/psr.h>
21#include <asm/page.h>
Robert Reif19fce2b2007-05-14 03:22:08 -070022#include <asm/kdebug.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#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 */
27
28 .data
29/*
30 * The following are used with the prom_vector node-ops to figure out
31 * the cpu-type
32 */
33
34 .align 4
Linus Torvalds1da177e2005-04-16 15:20:36 -070035cputyp:
36 .word 1
37
38 .align 4
39 .globl cputypval
40cputypval:
41 .asciz "sun4c"
42 .ascii " "
43
44cputypvalend:
45cputypvallen = cputypvar - cputypval
46
47 .align 4
48/*
49 * Sun people can't spell worth damn. "compatability" indeed.
50 * At least we *know* we can't spell, and use a spell-checker.
51 */
52
53/* Uh, actually Linus it is I who cannot spell. Too much murky
54 * Sparc assembly will do this to ya.
55 */
56cputypvar:
57 .asciz "compatability"
58
59/* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */
60 .align 4
61cputypvar_sun4m:
62 .asciz "compatible"
63
64 .align 4
65
Sam Ravnborg323206a2012-05-11 11:35:15 +000066sun4c_notsup:
67 .asciz "Sparc-Linux sun4/sun4c support does no longer exist.\n\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 .align 4
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70sun4e_notsup:
71 .asciz "Sparc-Linux sun4e support does not exist\n\n"
72 .align 4
73
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 /* The Sparc trap table, bootloader gives us control at _start. */
Tim Abbottce8a7422009-04-25 22:11:08 -040075 __HEAD
Sam Ravnborgb2a39b02011-01-04 11:39:12 +000076 .globl _stext, _start, __stext
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 .globl trapbase
78_start: /* danger danger */
79__stext:
80_stext:
Linus Torvalds1da177e2005-04-16 15:20:36 -070081trapbase:
82#ifdef CONFIG_SMP
83trapbase_cpu0:
84#endif
85/* We get control passed to us here at t_zero. */
86t_zero: b gokernel; nop; nop; nop;
Sam Ravnborg306f1232012-05-11 11:35:06 +000087t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
Linus Torvalds1da177e2005-04-16 15:20:36 -070088t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
89t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
90t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
91t_wovf: WINDOW_SPILL /* Window Overflow */
92t_wunf: WINDOW_FILL /* Window Underflow */
93t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
94t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
Sam Ravnborg306f1232012-05-11 11:35:06 +000095t_dflt: SRMMU_DFAULT /* Data Miss Exception */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
97t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
98t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
99t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
100t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
101t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
102t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
103t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
104t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
105t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
106t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
107t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
108t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
109t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
110t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
111t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
112t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
113 .globl t_nmi
David S. Miller96061a92012-05-11 21:23:05 -0700114t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
Sam Ravnborg2c1cfb22012-05-11 11:35:04 +0000115
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
117t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
118t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
119t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
120t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
121t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
122t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
Sam Ravnborg306f1232012-05-11 11:35:06 +0000123t_dacce:SRMMU_DFAULT /* Data Access Error */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
125t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
126t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
127t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
128t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
129t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
130t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
131t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
132t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
133t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
134t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
135t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
136t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
137t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
138t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
139t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
140t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
141t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
142t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
143t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
144t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
David S. Millerec98c6b2008-04-20 02:14:23 -0700145t_bad80:BAD_TRAP(0x80) /* SunOS System Call */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
147t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
148t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
149t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
150t_rchk: BAD_TRAP(0x85) /* Range Check */
151t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
152t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
David S. Millerec98c6b2008-04-20 02:14:23 -0700153t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */
154t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
156t_bad8f:BAD_TRAP(0x8f)
157t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
158t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
159t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
160t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
161t_getcc:GETCC_TRAP /* Get Condition Codes */
162t_setcc:SETCC_TRAP /* Set Condition Codes */
163t_getpsr:GETPSR_TRAP /* Get PSR Register */
164t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
David S. Millerec98c6b2008-04-20 02:14:23 -0700165t_bada7:BAD_TRAP(0xa7)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
167t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
168t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
169t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
170t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
171t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
172t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
173t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
174t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
175t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
176t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
177t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
178t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
179t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
180t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
181t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
182t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
David S. Millere2fdd7f2008-04-29 02:38:50 -0700183t_badfc:BAD_TRAP(0xfc)
184t_kgdb: KGDB_TRAP(0xfd)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
186dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
187
188 .globl end_traptable
189end_traptable:
190
191#ifdef CONFIG_SMP
192 /* Trap tables for the other cpus. */
193 .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3
194trapbase_cpu1:
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)
220 BAD_TRAP(0x50)
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)
David S. Millerec98c6b2008-04-20 02:14:23 -0700231 BAD_TRAP(0x80)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 BREAKPOINT_TRAP
233 TRAP_ENTRY(0x82, do_hw_divzero)
234 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
David S. Millerec98c6b2008-04-20 02:14:23 -0700235 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
236 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 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)
David S. Millerec98c6b2008-04-20 02:14:23 -0700243 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 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)
David S. Millere2fdd7f2008-04-29 02:38:50 -0700260 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261
262trapbase_cpu2:
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)
288 BAD_TRAP(0x50)
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)
David S. Millerec98c6b2008-04-20 02:14:23 -0700299 BAD_TRAP(0x80)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300 BREAKPOINT_TRAP
301 TRAP_ENTRY(0x82, do_hw_divzero)
302 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
David S. Millerec98c6b2008-04-20 02:14:23 -0700303 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
304 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 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)
David S. Millerec98c6b2008-04-20 02:14:23 -0700311 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 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)
David S. Millere2fdd7f2008-04-29 02:38:50 -0700328 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329
330trapbase_cpu3:
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)
356 BAD_TRAP(0x50)
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)
David S. Millerec98c6b2008-04-20 02:14:23 -0700367 BAD_TRAP(0x80)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 BREAKPOINT_TRAP
369 TRAP_ENTRY(0x82, do_hw_divzero)
370 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
David S. Millerec98c6b2008-04-20 02:14:23 -0700371 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
372 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 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)
David S. Millerec98c6b2008-04-20 02:14:23 -0700379 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 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)
David S. Millere2fdd7f2008-04-29 02:38:50 -0700396 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397
398#endif
399 .align PAGE_SIZE
400
401/* This was the only reasonable way I could think of to properly align
402 * these page-table data structures.
403 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 .globl swapper_pg_dir
405swapper_pg_dir: .skip PAGE_SIZE
Sam Ravnborg1b4cb702012-05-12 01:43:46 +0000406 .globl empty_zero_page
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407empty_zero_page: .skip PAGE_SIZE
408
409 .global root_flags
410 .global ram_flags
411 .global root_dev
412 .global sparc_ramdisk_image
413 .global sparc_ramdisk_size
414
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.
418 */
419 .ascii "HdrS"
420 .word LINUX_VERSION_CODE
421 .half 0x0203 /* HdrS version */
422root_flags:
423 .half 1
424root_dev:
425 .half 0
426ram_flags:
427 .half 0
428sparc_ramdisk_image:
429 .word 0
430sparc_ramdisk_size:
431 .word 0
432 .word reboot_command
433 .word 0, 0, 0
434 .word _end
435
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.
439 */
440gokernel:
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.
446 *
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.
450 */
451
452 mov %o7, %g4 ! Save %o7
453
454 /* Jump to it, and pray... */
455current_pc:
456 call 1f
457 nop
458
4591:
460 mov %o7, %g3
461
462 tst %o0
463 be no_sun4u_here
464 mov %g4, %o7 /* Previous %o7. */
465
466 mov %o0, %l0 ! stash away romvec
467 mov %o0, %g7 ! put it here too
468 mov %o1, %l1 ! stash away debug_vec too
469
470 /* Ok, let's check out our run time program counter. */
471 set current_pc, %g5
472 cmp %g3, %g5
473 be already_mapped
474 nop
475
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.
480 */
481 set KERNBASE, %l6
482 b copy_prom_lvl14
483 nop
484
485already_mapped:
486 mov 0, %l6
487
488 /* Copy over the Prom's level 14 clock handler. */
489copy_prom_lvl14:
490#if 1
491 /* DJHR
492 * preserve our linked/calculated instructions
493 */
494 set lvl14_save, %g1
495 set t_irq14, %g3
496 sub %g1, %l6, %g1 ! translate to physical
497 sub %g3, %l6, %g3 ! translate to physical
498 ldd [%g3], %g4
499 std %g4, [%g1]
500 ldd [%g3+8], %g4
501 std %g4, [%g1+8]
502#endif
503 rd %tbr, %g1
504 andn %g1, 0xfff, %g1 ! proms trap table base
505 or %g0, (0x1e<<4), %g2 ! offset to lvl14 intr
506 or %g1, %g2, %g2
507 set t_irq14, %g3
508 sub %g3, %l6, %g3
509 ldd [%g2], %g4
510 std %g4, [%g3]
511 ldd [%g2 + 0x8], %g4
512 std %g4, [%g3 + 0x8] ! Copy proms handler
513
Sam Ravnborg323206a2012-05-11 11:35:15 +0000514/* DON'T TOUCH %l0 thru %l5 in these remapping routines,
515 * we need their values afterwards!
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 */
Sam Ravnborg323206a2012-05-11 11:35:15 +0000517
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 /* Now check whether we are already mapped, if we
519 * are we can skip all this garbage coming up.
520 */
521copy_prom_done:
522 cmp %l6, 0
523 be go_to_highmem ! this will be a nop then
524 nop
525
David S. Miller9b4c5142012-05-12 01:02:11 -0700526 /* Validate that we are in fact running on an
527 * SRMMU based cpu.
528 */
529 set 0x4000, %g6
530 cmp %g7, %g6
531 bne not_a_sun4
532 nop
533
534halt_sun4_or_sun4c:
535 ld [%g7 + 0x68], %o1
536 set sun4c_notsup, %o0
537 sub %o0, %l6, %o0
538 call %o1
539 nop
540 ba halt_me
541 nop
542
543not_a_sun4:
544 lda [%g0] ASI_M_MMUREGS, %g1
545 andcc %g1, 1, %g0
546 be halt_sun4_or_sun4c
547 nop
548
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549srmmu_remap:
550 /* First, check for a viking (TI) module. */
551 set 0x40000000, %g2
552 rd %psr, %g3
553 and %g2, %g3, %g3
554 subcc %g3, 0x0, %g0
555 bz srmmu_nviking
556 nop
557
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.
561 */
562
563 /* I've only seen MicroSparc's on SparcClassics with this
564 * bit set.
565 */
566 set 0x800, %g2
567 lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg
568 and %g2, %g3, %g3
569 subcc %g3, 0x0, %g0
570 bnz srmmu_nviking ! is in mbus mode
571 nop
572
573 rd %psr, %g3 ! DO NOT TOUCH %g3
574 andn %g3, PSR_ET, %g2
575 wr %g2, 0x0, %psr
576 WRITE_PAUSE
577
578 /* Get context table pointer, then convert to
579 * a physical address, which is 36 bits.
580 */
581 set AC_M_CTPR, %g4
582 lda [%g4] ASI_M_MMUREGS, %g4
583 sll %g4, 0x4, %g4 ! We use this below
584 ! DO NOT TOUCH %g4
585
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...
591
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.
596 */
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
600
601 /* Ok, pull in the PTD. */
602 lda [%o1] ASI_M_BYPASS, %o2 ! This is the 0x0 16MB pgd
603
604 /* Calculate to KERNBASE entry. */
605 add %o1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %o3
606
607 /* Poke the entry into the calculated address. */
608 sta %o2, [%o3] ASI_M_BYPASS
609
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?
616 *
617 * "The PROM is the computer."
618 */
619
620 /* Ok, restore the MMU control register we saved in %g5 */
621 sta %g5, [%g0] ASI_M_MMUREGS ! POW... ouch
622
623 /* Turn traps back on. We saved it in %g3 earlier. */
624 wr %g3, 0x0, %psr ! tick tock, tick tock
625
626 /* Now we burn precious CPU cycles due to bad engineering. */
627 WRITE_PAUSE
628
629 /* Wow, all that just to move a 32-bit value from one
630 * place to another... Jump to high memory.
631 */
632 b go_to_highmem
633 nop
634
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
638 * the AC bit.
639 */
640srmmu_nviking:
641 set AC_M_CTPR, %g1
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
645 srl %g1, 0x4, %g1
646 sll %g1, 0x8, %g1 ! make phys addr for l1 tbl
647
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
651 b go_to_highmem
652 nop ! wheee....
653
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654
655/* Now do a non-relative jump so that PC is in high-memory */
656go_to_highmem:
657 set execute_in_high_mem, %g1
658 jmpl %g1, %g0
659 nop
660
661/* The code above should be at beginning and we have to take care about
Tim Abbotta0871e82009-04-27 14:02:26 -0400662 * short jumps, as branching to .init.text section from .text is usually
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 * impossible */
664 __INIT
665/* Acquire boot time privileged register values, this will help debugging.
666 * I figure out and store nwindows and nwindowsm1 later on.
667 */
668execute_in_high_mem:
669 mov %l0, %o0 ! put back romvec
670 mov %l1, %o1 ! and debug_vec
671
672 sethi %hi(prom_vector_p), %g1
673 st %o0, [%g1 + %lo(prom_vector_p)]
674
675 sethi %hi(linux_dbvec), %g1
676 st %o1, [%g1 + %lo(linux_dbvec)]
677
678 ld [%o0 + 0x4], %o3
679 and %o3, 0x3, %o5 ! get the version
680
681 cmp %o3, 0x2 ! a v2 prom?
682 be found_version
683 nop
684
685 /* paul@sfe.com.au */
686 cmp %o3, 0x3 ! a v3 prom?
687 be found_version
688 nop
689
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690found_version:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691/* Get the machine type via the mysterious romvec node operations. */
692
693 add %g7, 0x1c, %l1
694 ld [%l1], %l0
695 ld [%l0], %l0
696 call %l0
697 or %g0, %g0, %o0 ! next_node(0) = first_node
698 or %o0, %g0, %g6
699
700 sethi %hi(cputypvar), %o1 ! First node has cpu-arch
701 or %o1, %lo(cputypvar), %o1
702 sethi %hi(cputypval), %o2 ! information, the string
703 or %o2, %lo(cputypval), %o2
704 ld [%l1], %l0 ! 'compatibility' tells
705 ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where
706 call %l0 ! x is one of '', 'c', 'm',
707 nop ! 'd' or 'e'. %o2 holds pointer
708 ! to a buf where above string
709 ! will get stored by the prom.
710
711 subcc %o0, %g0, %g0
712 bpos got_prop ! Got the property
713 nop
714
715 or %g6, %g0, %o0
716 sethi %hi(cputypvar_sun4m), %o1
717 or %o1, %lo(cputypvar_sun4m), %o1
718 sethi %hi(cputypval), %o2
719 or %o2, %lo(cputypval), %o2
720 ld [%l1], %l0
721 ld [%l0 + 0xc], %l0
722 call %l0
723 nop
724
725got_prop:
Konrad Eisele0fd7ef12009-08-17 00:13:31 +0000726#ifdef CONFIG_SPARC_LEON
727 /* no cpu-type check is needed, it is a SPARC-LEON */
Daniel Hellstrom01dae0f2011-04-21 04:20:24 +0000728
729 sethi %hi(boot_cpu_id), %g2 ! boot-cpu index
730
Konrad Eisele84017072009-08-31 22:08:13 +0000731#ifdef CONFIG_SMP
Daniel Hellstrom01dae0f2011-04-21 04:20:24 +0000732 ldub [%g2 + %lo(boot_cpu_id)], %g1
733 cmp %g1, 0xff ! unset means first CPU
734 bne leon_smp_cpu_startup ! continue only with master
Konrad Eisele0fd7ef12009-08-17 00:13:31 +0000735 nop
736#endif
Daniel Hellstrom01dae0f2011-04-21 04:20:24 +0000737 /* Get CPU-ID from most significant 4-bit of ASR17 */
738 rd %asr17, %g1
739 srl %g1, 28, %g1
740
741 /* Update boot_cpu_id only on boot cpu */
742 stub %g1, [%g2 + %lo(boot_cpu_id)]
743
Sam Ravnborg323206a2012-05-11 11:35:15 +0000744 ba continue_boot
Daniel Hellstrom01dae0f2011-04-21 04:20:24 +0000745 nop
Konrad Eisele84017072009-08-31 22:08:13 +0000746#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 set cputypval, %o2
748 ldub [%o2 + 0x4], %l1
749
750 cmp %l1, ' '
Sam Ravnborg323206a2012-05-11 11:35:15 +0000751 be no_sun4c_here
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 cmp %l1, 'c'
Sam Ravnborg323206a2012-05-11 11:35:15 +0000753 be no_sun4c_here
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754 cmp %l1, 'm'
755 be 1f
756 cmp %l1, 's'
757 be 1f
758 cmp %l1, 'd'
759 be 1f
760 cmp %l1, 'e'
761 be no_sun4e_here ! Could be a sun4e.
762 nop
763 b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
764 nop
765
7661: set cputypval, %l1
767 ldub [%l1 + 0x4], %l1
Sam Ravnborg323206a2012-05-11 11:35:15 +0000768 cmp %l1, 'd' ! Let us see how the beast will die
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769 be sun4d_init
770 nop
771
Sam Ravnborg323206a2012-05-11 11:35:15 +0000772 /* If not sun4d assume sun4m */
773 b sun4m_init
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774 nop
775
776/* CPUID in bootbus can be found at PA 0xff0140000 */
777#define SUN4D_BOOTBUS_CPUID 0xf0140000
778
779sun4d_init:
780 /* Need to patch call to handler_irq */
781 set patch_handler_irq, %g4
782 set sun4d_handler_irq, %g5
783 sethi %hi(0x40000000), %g3 ! call
784 sub %g5, %g4, %g5
785 srl %g5, 2, %g5
786 or %g5, %g3, %g5
787 st %g5, [%g4]
788
789#ifdef CONFIG_SMP
790 /* Get our CPU id out of bootbus */
791 set SUN4D_BOOTBUS_CPUID, %g3
792 lduba [%g3] ASI_M_CTL, %g3
793 and %g3, 0xf8, %g3
794 srl %g3, 3, %g4
795 sta %g4, [%g0] ASI_M_VIKING_TMP1
796 sethi %hi(boot_cpu_id), %g5
797 stb %g4, [%g5 + %lo(boot_cpu_id)]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798#endif
799
800 /* Fall through to sun4m_init */
801
802sun4m_init:
803 /* XXX Fucking Cypress... */
804 lda [%g0] ASI_M_MMUREGS, %g5
805 srl %g5, 28, %g4
806
807 cmp %g4, 1
808 bne 1f
809 srl %g5, 24, %g4
810
811 and %g4, 0xf, %g4
812 cmp %g4, 7 /* This would be a HyperSparc. */
813
814 bne 2f
815 nop
816
8171:
818
819#define PATCH_IT(dst, src) \
820 set (dst), %g5; \
821 set (src), %g4; \
822 ld [%g4], %g3; \
823 st %g3, [%g5]; \
824 ld [%g4+0x4], %g3; \
825 st %g3, [%g5+0x4];
826
827 /* Signed multiply. */
828 PATCH_IT(.mul, .mul_patch)
829 PATCH_IT(.mul+0x08, .mul_patch+0x08)
830
831 /* Signed remainder. */
832 PATCH_IT(.rem, .rem_patch)
833 PATCH_IT(.rem+0x08, .rem_patch+0x08)
834 PATCH_IT(.rem+0x10, .rem_patch+0x10)
835 PATCH_IT(.rem+0x18, .rem_patch+0x18)
836 PATCH_IT(.rem+0x20, .rem_patch+0x20)
837 PATCH_IT(.rem+0x28, .rem_patch+0x28)
838
839 /* Signed division. */
840 PATCH_IT(.div, .div_patch)
841 PATCH_IT(.div+0x08, .div_patch+0x08)
842 PATCH_IT(.div+0x10, .div_patch+0x10)
843 PATCH_IT(.div+0x18, .div_patch+0x18)
844 PATCH_IT(.div+0x20, .div_patch+0x20)
845
846 /* Unsigned multiply. */
847 PATCH_IT(.umul, .umul_patch)
848 PATCH_IT(.umul+0x08, .umul_patch+0x08)
849
850 /* Unsigned remainder. */
851 PATCH_IT(.urem, .urem_patch)
852 PATCH_IT(.urem+0x08, .urem_patch+0x08)
853 PATCH_IT(.urem+0x10, .urem_patch+0x10)
854 PATCH_IT(.urem+0x18, .urem_patch+0x18)
855
856 /* Unsigned division. */
857 PATCH_IT(.udiv, .udiv_patch)
858 PATCH_IT(.udiv+0x08, .udiv_patch+0x08)
859 PATCH_IT(.udiv+0x10, .udiv_patch+0x10)
860
861#undef PATCH_IT
862
863/* Ok, the PROM could have done funny things and apple cider could still
864 * be sitting in the fault status/address registers. Read them all to
865 * clear them so we don't get magic faults later on.
866 */
867/* This sucks, apparently this makes Vikings call prom panic, will fix later */
8682:
869 rd %psr, %o1
870 srl %o1, 28, %o1 ! Get a type of the CPU
871
872 subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC
Sam Ravnborg323206a2012-05-11 11:35:15 +0000873 be continue_boot
Linus Torvalds1da177e2005-04-16 15:20:36 -0700874 nop
875
876 set AC_M_SFSR, %o0
877 lda [%o0] ASI_M_MMUREGS, %g0
878 set AC_M_SFAR, %o0
879 lda [%o0] ASI_M_MMUREGS, %g0
880
881 /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
882 subcc %o1, 0, %g0
Sam Ravnborg323206a2012-05-11 11:35:15 +0000883 be continue_boot
Linus Torvalds1da177e2005-04-16 15:20:36 -0700884 nop
885
886 set AC_M_AFSR, %o0
887 lda [%o0] ASI_M_MMUREGS, %g0
888 set AC_M_AFAR, %o0
889 lda [%o0] ASI_M_MMUREGS, %g0
890 nop
891
892
Sam Ravnborg323206a2012-05-11 11:35:15 +0000893continue_boot:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894
895/* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
896 * show-time!
897 */
898
899 sethi %hi(cputyp), %o0
900 st %g4, [%o0 + %lo(cputyp)]
901
902 /* Turn on Supervisor, EnableFloating, and all the PIL bits.
903 * Also puts us in register window zero with traps off.
904 */
905 set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
906 wr %g2, 0x0, %psr
907 WRITE_PAUSE
908
909 /* I want a kernel stack NOW! */
910 set init_thread_union, %g1
911 set (THREAD_SIZE - STACKFRAME_SZ), %g2
912 add %g1, %g2, %sp
913 mov 0, %fp /* And for good luck */
914
915 /* Zero out our BSS section. */
916 set __bss_start , %o0 ! First address of BSS
Sam Ravnborg86ed40b2008-12-27 00:35:12 -0800917 set _end , %o1 ! Last address of BSS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700918 add %o0, 0x1, %o0
9191:
920 stb %g0, [%o0]
921 subcc %o0, %o1, %g0
922 bl 1b
923 add %o0, 0x1, %o0
924
Daniel Hellstrom5fcafb72011-04-21 04:20:23 +0000925 /* If boot_cpu_id has not been setup by machine specific
926 * init-code above we default it to zero.
927 */
928 sethi %hi(boot_cpu_id), %g2
929 ldub [%g2 + %lo(boot_cpu_id)], %g3
930 cmp %g3, 0xff
931 bne 1f
932 nop
933 mov %g0, %g3
934 stub %g3, [%g2 + %lo(boot_cpu_id)]
935
9361: /* boot_cpu_id set. calculate boot_cpu_id4 = boot_cpu_id*4 */
937 sll %g3, 2, %g3
938 sethi %hi(boot_cpu_id4), %g2
939 stub %g3, [%g2 + %lo(boot_cpu_id4)]
940
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941 /* Initialize the uwinmask value for init task just in case.
942 * But first make current_set[boot_cpu_id] point to something useful.
943 */
944 set init_thread_union, %g6
945 set current_set, %g2
946#ifdef CONFIG_SMP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947 st %g6, [%g2]
948 add %g2, %g3, %g2
949#endif
950 st %g6, [%g2]
951
952 st %g0, [%g6 + TI_UWINMASK]
953
954/* Compute NWINDOWS and stash it away. Now uses %wim trick explained
955 * in the V8 manual. Ok, this method seems to work, Sparc is cool...
956 * No, it doesn't work, have to play the save/readCWP/restore trick.
957 */
958
959 wr %g0, 0x0, %wim ! so we do not get a trap
960 WRITE_PAUSE
961
962 save
963
964 rd %psr, %g3
965
966 restore
967
968 and %g3, 0x1f, %g3
969 add %g3, 0x1, %g3
970
971 mov 2, %g1
972 wr %g1, 0x0, %wim ! make window 1 invalid
973 WRITE_PAUSE
974
975 cmp %g3, 0x7
976 bne 2f
977 nop
978
979 /* Adjust our window handling routines to
980 * do things correctly on 7 window Sparcs.
981 */
982
983#define PATCH_INSN(src, dest) \
984 set src, %g5; \
985 set dest, %g2; \
986 ld [%g5], %g4; \
987 st %g4, [%g2];
988
989 /* Patch for window spills... */
990 PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
991 PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
992 PATCH_INSN(spnwin_patch3_7win, spnwin_patch3)
993
994 /* Patch for window fills... */
995 PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
996 PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
997
998 /* Patch for trap entry setup... */
999 PATCH_INSN(tsetup_7win_patch1, tsetup_patch1)
1000 PATCH_INSN(tsetup_7win_patch2, tsetup_patch2)
1001 PATCH_INSN(tsetup_7win_patch3, tsetup_patch3)
1002 PATCH_INSN(tsetup_7win_patch4, tsetup_patch4)
1003 PATCH_INSN(tsetup_7win_patch5, tsetup_patch5)
1004 PATCH_INSN(tsetup_7win_patch6, tsetup_patch6)
1005
1006 /* Patch for returning from traps... */
1007 PATCH_INSN(rtrap_7win_patch1, rtrap_patch1)
1008 PATCH_INSN(rtrap_7win_patch2, rtrap_patch2)
1009 PATCH_INSN(rtrap_7win_patch3, rtrap_patch3)
1010 PATCH_INSN(rtrap_7win_patch4, rtrap_patch4)
1011 PATCH_INSN(rtrap_7win_patch5, rtrap_patch5)
1012
1013 /* Patch for killing user windows from the register file. */
1014 PATCH_INSN(kuw_patch1_7win, kuw_patch1)
1015
1016 /* Now patch the kernel window flush sequences.
1017 * This saves 2 traps on every switch and fork.
1018 */
1019 set 0x01000000, %g4
1020 set flush_patch_one, %g5
1021 st %g4, [%g5 + 0x18]
1022 st %g4, [%g5 + 0x1c]
1023 set flush_patch_two, %g5
1024 st %g4, [%g5 + 0x18]
1025 st %g4, [%g5 + 0x1c]
1026 set flush_patch_three, %g5
1027 st %g4, [%g5 + 0x18]
1028 st %g4, [%g5 + 0x1c]
1029 set flush_patch_four, %g5
1030 st %g4, [%g5 + 0x18]
1031 st %g4, [%g5 + 0x1c]
1032 set flush_patch_exception, %g5
1033 st %g4, [%g5 + 0x18]
1034 st %g4, [%g5 + 0x1c]
1035 set flush_patch_switch, %g5
1036 st %g4, [%g5 + 0x18]
1037 st %g4, [%g5 + 0x1c]
1038
10392:
1040 sethi %hi(nwindows), %g4
1041 st %g3, [%g4 + %lo(nwindows)] ! store final value
1042 sub %g3, 0x1, %g3
1043 sethi %hi(nwindowsm1), %g4
1044 st %g3, [%g4 + %lo(nwindowsm1)]
1045
1046 /* Here we go, start using Linux's trap table... */
1047 set trapbase, %g3
1048 wr %g3, 0x0, %tbr
1049 WRITE_PAUSE
1050
1051 /* Finally, turn on traps so that we can call c-code. */
1052 rd %psr, %g3
1053 wr %g3, 0x0, %psr
1054 WRITE_PAUSE
1055
1056 wr %g3, PSR_ET, %psr
1057 WRITE_PAUSE
1058
1059 /* First we call prom_init() to set up PROMLIB, then
1060 * off to start_kernel().
1061 */
1062
1063 sethi %hi(prom_vector_p), %g5
1064 ld [%g5 + %lo(prom_vector_p)], %o0
1065 call prom_init
1066 nop
1067
1068 call start_kernel
1069 nop
1070
1071 /* We should not get here. */
1072 call halt_me
1073 nop
Sam Ravnborg323206a2012-05-11 11:35:15 +00001074no_sun4c_here:
1075 ld [%g7 + 0x68], %o1
1076 set sun4c_notsup, %o0
1077 call %o1
Linus Torvalds1da177e2005-04-16 15:20:36 -07001078 nop
Sam Ravnborg323206a2012-05-11 11:35:15 +00001079 b halt_me
Linus Torvalds1da177e2005-04-16 15:20:36 -07001080 nop
Adrian Bunk5110bd22008-08-31 20:59:37 -07001081
Linus Torvalds1da177e2005-04-16 15:20:36 -07001082no_sun4e_here:
1083 ld [%g7 + 0x68], %o1
1084 set sun4e_notsup, %o0
1085 call %o1
1086 nop
1087 b halt_me
1088 nop
1089
1090 __INITDATA
1091
1092sun4u_1:
1093 .asciz "finddevice"
1094 .align 4
1095sun4u_2:
1096 .asciz "/chosen"
1097 .align 4
1098sun4u_3:
1099 .asciz "getprop"
1100 .align 4
1101sun4u_4:
1102 .asciz "stdout"
1103 .align 4
1104sun4u_5:
1105 .asciz "write"
1106 .align 4
1107sun4u_6:
1108 .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r"
1109sun4u_6e:
1110 .align 4
1111sun4u_7:
1112 .asciz "exit"
1113 .align 8
1114sun4u_a1:
1115 .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0
1116sun4u_r1:
1117 .word 0
1118sun4u_a2:
1119 .word 0, sun4u_3, 0, 4, 0, 1, 0
1120sun4u_i2:
1121 .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0
1122sun4u_r2:
1123 .word 0
1124sun4u_a3:
1125 .word 0, sun4u_5, 0, 3, 0, 1, 0
1126sun4u_i3:
1127 .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0
1128sun4u_r3:
1129 .word 0
1130sun4u_a4:
1131 .word 0, sun4u_7, 0, 0, 0, 0
1132sun4u_r4:
1133
1134 __INIT
1135no_sun4u_here:
1136 set sun4u_a1, %o0
1137 set current_pc, %l2
1138 cmp %l2, %g3
1139 be 1f
1140 mov %o4, %l0
1141 sub %g3, %l2, %l6
1142 add %o0, %l6, %o0
1143 mov %o0, %l4
1144 mov sun4u_r4 - sun4u_a1, %l3
1145 ld [%l4], %l5
11462:
1147 add %l4, 4, %l4
1148 cmp %l5, %l2
1149 add %l5, %l6, %l5
1150 bgeu,a 3f
1151 st %l5, [%l4 - 4]
11523:
1153 subcc %l3, 4, %l3
1154 bne 2b
1155 ld [%l4], %l5
11561:
1157 call %l0
1158 mov %o0, %l1
1159
1160 ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1
1161 add %l1, (sun4u_a2 - sun4u_a1), %o0
1162 call %l0
1163 st %o1, [%o0 + (sun4u_i2 - sun4u_a2)]
1164
1165 ld [%l1 + (sun4u_1 - sun4u_a1)], %o1
1166 add %l1, (sun4u_a3 - sun4u_a1), %o0
1167 call %l0
1168 st %o1, [%o0 + (sun4u_i3 - sun4u_a3)]
1169
1170 call %l0
1171 add %l1, (sun4u_a4 - sun4u_a1), %o0
1172
1173 /* Not reached */
1174halt_me:
1175 ld [%g7 + 0x74], %o0
1176 call %o0 ! Get us out of here...
1177 nop ! Apparently Solaris is better.
1178
1179/* Ok, now we continue in the .data/.text sections */
1180
1181 .data
1182 .align 4
1183
1184/*
1185 * Fill up the prom vector, note in particular the kind first element,
1186 * no joke. I don't need all of them in here as the entire prom vector
1187 * gets initialized in c-code so all routines can use it.
1188 */
1189
Linus Torvalds1da177e2005-04-16 15:20:36 -07001190prom_vector_p:
1191 .word 0
1192
1193/* We calculate the following at boot time, window fills/spills and trap entry
1194 * code uses these to keep track of the register windows.
1195 */
1196
1197 .align 4
1198 .globl nwindows
1199 .globl nwindowsm1
1200nwindows:
1201 .word 8
1202nwindowsm1:
1203 .word 7
1204
1205/* Boot time debugger vector value. We need this later on. */
1206
1207 .align 4
1208 .globl linux_dbvec
1209linux_dbvec:
1210 .word 0
1211 .word 0
1212
1213 .align 8
1214
1215 .globl lvl14_save
1216lvl14_save:
1217 .word 0
1218 .word 0
1219 .word 0
1220 .word 0
1221 .word t_irq14
1222
1223 .section ".fixup",#alloc,#execinstr
1224 .globl __ret_efault
1225__ret_efault:
1226 ret
1227 restore %g0, -EFAULT, %o0