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