Commit | Line | Data |
---|---|---|
88278ca2 | 1 | /* |
1da177e4 LT |
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> | |
1da177e4 LT |
14 | #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> | |
19fce2b9 | 22 | #include <asm/kdebug.h> |
1da177e4 LT |
23 | #include <asm/winmacro.h> |
24 | #include <asm/thread_info.h> /* TI_UWINMASK */ | |
25 | #include <asm/errno.h> | |
26 | #include <asm/pgtsrmmu.h> /* SRMMU_PGDIR_SHIFT */ | |
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 | |
1da177e4 LT |
35 | cputyp: |
36 | .word 1 | |
37 | ||
38 | .align 4 | |
39 | .globl cputypval | |
40 | cputypval: | |
41 | .asciz "sun4c" | |
42 | .ascii " " | |
43 | ||
44 | cputypvalend: | |
45 | cputypvallen = 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 | */ | |
56 | cputypvar: | |
57 | .asciz "compatability" | |
58 | ||
59 | /* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */ | |
60 | .align 4 | |
61 | cputypvar_sun4m: | |
62 | .asciz "compatible" | |
63 | ||
64 | .align 4 | |
65 | ||
323206a1 SR |
66 | sun4c_notsup: |
67 | .asciz "Sparc-Linux sun4/sun4c support does no longer exist.\n\n" | |
1da177e4 | 68 | .align 4 |
1da177e4 LT |
69 | |
70 | sun4e_notsup: | |
71 | .asciz "Sparc-Linux sun4e support does not exist\n\n" | |
72 | .align 4 | |
73 | ||
1da177e4 | 74 | /* The Sparc trap table, bootloader gives us control at _start. */ |
ce8a7424 | 75 | __HEAD |
b2a39b0d | 76 | .globl _stext, _start, __stext |
1da177e4 LT |
77 | .globl trapbase |
78 | _start: /* danger danger */ | |
79 | __stext: | |
80 | _stext: | |
1da177e4 LT |
81 | trapbase: |
82 | #ifdef CONFIG_SMP | |
83 | trapbase_cpu0: | |
84 | #endif | |
85 | /* We get control passed to us here at t_zero. */ | |
86 | t_zero: b gokernel; nop; nop; nop; | |
306f1231 | 87 | t_tflt: SRMMU_TFAULT /* Inst. Access Exception */ |
1da177e4 LT |
88 | t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */ |
89 | t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */ | |
90 | t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */ | |
91 | t_wovf: WINDOW_SPILL /* Window Overflow */ | |
92 | t_wunf: WINDOW_FILL /* Window Underflow */ | |
93 | t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */ | |
94 | t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */ | |
306f1231 | 95 | t_dflt: SRMMU_DFAULT /* Data Miss Exception */ |
1da177e4 LT |
96 | t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */ |
97 | t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */ | |
98 | t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10) | |
99 | t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */ | |
100 | t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */ | |
101 | t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */ | |
102 | t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */ | |
103 | t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */ | |
104 | t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */ | |
105 | t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */ | |
106 | t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */ | |
107 | t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */ | |
108 | t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */ | |
109 | t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */ | |
110 | t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */ | |
111 | t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */ | |
112 | t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */ | |
113 | .globl t_nmi | |
96061a91 | 114 | t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m) |
2c1cfb2d | 115 | |
1da177e4 LT |
116 | t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */ |
117 | t_iacce:BAD_TRAP(0x21) /* Instr Access Error */ | |
118 | t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23) | |
119 | t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */ | |
120 | t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */ | |
121 | t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27) | |
122 | t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */ | |
306f1231 | 123 | t_dacce:SRMMU_DFAULT /* Data Access Error */ |
1da177e4 LT |
124 | t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */ |
125 | t_dserr:BAD_TRAP(0x2b) /* Data Store Error */ | |
126 | t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */ | |
127 | t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31) | |
128 | t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36) | |
129 | t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b) | |
130 | t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */ | |
131 | t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41) | |
132 | t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46) | |
133 | t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b) | |
134 | t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50) | |
135 | t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55) | |
136 | t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a) | |
137 | t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f) | |
138 | t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64) | |
139 | t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69) | |
140 | t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e) | |
141 | t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73) | |
142 | t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78) | |
143 | t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d) | |
144 | t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f) | |
ec98c6b9 | 145 | t_bad80:BAD_TRAP(0x80) /* SunOS System Call */ |
1da177e4 LT |
146 | t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */ |
147 | t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */ | |
148 | t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */ | |
149 | t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */ | |
150 | t_rchk: BAD_TRAP(0x85) /* Range Check */ | |
151 | t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */ | |
152 | t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */ | |
ec98c6b9 DM |
153 | t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */ |
154 | t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */ | |
1da177e4 LT |
155 | t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e) |
156 | t_bad8f:BAD_TRAP(0x8f) | |
157 | t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */ | |
158 | t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95) | |
159 | t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a) | |
160 | t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f) | |
161 | t_getcc:GETCC_TRAP /* Get Condition Codes */ | |
162 | t_setcc:SETCC_TRAP /* Set Condition Codes */ | |
163 | t_getpsr:GETPSR_TRAP /* Get PSR Register */ | |
164 | t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) | |
ec98c6b9 | 165 | t_bada7:BAD_TRAP(0xa7) |
1da177e4 LT |
166 | t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) |
167 | t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) | |
168 | t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) | |
169 | t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) | |
170 | t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf) | |
171 | t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4) | |
172 | t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9) | |
173 | t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) | |
174 | t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3) | |
175 | t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8) | |
176 | t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd) | |
177 | t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) | |
178 | t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7) | |
179 | t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec) | |
180 | t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) | |
181 | t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) | |
182 | t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) | |
e2fdd7fd DM |
183 | t_badfc:BAD_TRAP(0xfc) |
184 | t_kgdb: KGDB_TRAP(0xfd) | |
1da177e4 LT |
185 | dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */ |
186 | dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */ | |
187 | ||
188 | .globl end_traptable | |
189 | end_traptable: | |
190 | ||
191 | #ifdef CONFIG_SMP | |
192 | /* Trap tables for the other cpus. */ | |
193 | .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3 | |
194 | trapbase_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) | |
ec98c6b9 | 231 | BAD_TRAP(0x80) |
1da177e4 LT |
232 | BREAKPOINT_TRAP |
233 | TRAP_ENTRY(0x82, do_hw_divzero) | |
234 | TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) | |
ec98c6b9 DM |
235 | BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88) |
236 | BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) | |
1da177e4 LT |
237 | BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) |
238 | LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) | |
239 | BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) | |
240 | BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) | |
241 | BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP | |
242 | BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) | |
ec98c6b9 | 243 | BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) |
1da177e4 LT |
244 | BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) |
245 | BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) | |
246 | BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) | |
247 | BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf) | |
248 | BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4) | |
249 | BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9) | |
250 | BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) | |
251 | BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3) | |
252 | BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8) | |
253 | BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd) | |
254 | BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) | |
255 | BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7) | |
256 | BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec) | |
257 | BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) | |
258 | BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) | |
259 | BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) | |
e2fdd7fd | 260 | BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff) |
1da177e4 LT |
261 | |
262 | trapbase_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) | |
ec98c6b9 | 299 | BAD_TRAP(0x80) |
1da177e4 LT |
300 | BREAKPOINT_TRAP |
301 | TRAP_ENTRY(0x82, do_hw_divzero) | |
302 | TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) | |
ec98c6b9 DM |
303 | BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88) |
304 | BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) | |
1da177e4 LT |
305 | BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) |
306 | LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) | |
307 | BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) | |
308 | BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) | |
309 | BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP | |
310 | BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) | |
ec98c6b9 | 311 | BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) |
1da177e4 LT |
312 | BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) |
313 | BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) | |
314 | BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) | |
315 | BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf) | |
316 | BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4) | |
317 | BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9) | |
318 | BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) | |
319 | BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3) | |
320 | BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8) | |
321 | BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd) | |
322 | BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) | |
323 | BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7) | |
324 | BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec) | |
325 | BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) | |
326 | BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) | |
327 | BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) | |
e2fdd7fd | 328 | BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff) |
1da177e4 LT |
329 | |
330 | trapbase_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) | |
ec98c6b9 | 367 | BAD_TRAP(0x80) |
1da177e4 LT |
368 | BREAKPOINT_TRAP |
369 | TRAP_ENTRY(0x82, do_hw_divzero) | |
370 | TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85) | |
ec98c6b9 DM |
371 | BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88) |
372 | BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) | |
1da177e4 LT |
373 | BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f) |
374 | LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) | |
375 | BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) | |
376 | BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) | |
377 | BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP | |
378 | BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6) | |
ec98c6b9 | 379 | BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab) |
1da177e4 LT |
380 | BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0) |
381 | BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5) | |
382 | BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba) | |
383 | BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf) | |
384 | BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4) | |
385 | BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9) | |
386 | BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce) | |
387 | BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3) | |
388 | BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8) | |
389 | BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd) | |
390 | BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2) | |
391 | BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7) | |
392 | BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec) | |
393 | BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1) | |
394 | BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6) | |
395 | BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb) | |
e2fdd7fd | 396 | BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff) |
1da177e4 LT |
397 | |
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 | */ | |
1da177e4 LT |
404 | .globl swapper_pg_dir |
405 | swapper_pg_dir: .skip PAGE_SIZE | |
1b4cb70e | 406 | .globl empty_zero_page |
1da177e4 LT |
407 | empty_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 */ | |
422 | root_flags: | |
423 | .half 1 | |
424 | root_dev: | |
425 | .half 0 | |
426 | ram_flags: | |
427 | .half 0 | |
428 | sparc_ramdisk_image: | |
429 | .word 0 | |
430 | sparc_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 | */ | |
440 | gokernel: | |
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... */ | |
455 | current_pc: | |
456 | call 1f | |
457 | nop | |
458 | ||
459 | 1: | |
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 | ||
485 | already_mapped: | |
486 | mov 0, %l6 | |
487 | ||
488 | /* Copy over the Prom's level 14 clock handler. */ | |
489 | copy_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 | ||
323206a1 SR |
514 | /* DON'T TOUCH %l0 thru %l5 in these remapping routines, |
515 | * we need their values afterwards! | |
1da177e4 | 516 | */ |
323206a1 | 517 | |
1da177e4 LT |
518 | /* Now check whether we are already mapped, if we |
519 | * are we can skip all this garbage coming up. | |
520 | */ | |
521 | copy_prom_done: | |
522 | cmp %l6, 0 | |
523 | be go_to_highmem ! this will be a nop then | |
524 | nop | |
525 | ||
9b4c514a DM |
526 | /* 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 | ||
534 | halt_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 | ||
543 | not_a_sun4: | |
544 | lda [%g0] ASI_M_MMUREGS, %g1 | |
545 | andcc %g1, 1, %g0 | |
546 | be halt_sun4_or_sun4c | |
547 | nop | |
548 | ||
1da177e4 LT |
549 | srmmu_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 | */ | |
640 | srmmu_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 | ||
1da177e4 LT |
654 | |
655 | /* Now do a non-relative jump so that PC is in high-memory */ | |
656 | go_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 | |
a0871e8c | 662 | * short jumps, as branching to .init.text section from .text is usually |
1da177e4 LT |
663 | * 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 | */ | |
668 | execute_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 | ||
1da177e4 LT |
678 | /* Get the machine type via the mysterious romvec node operations. */ |
679 | ||
680 | add %g7, 0x1c, %l1 | |
681 | ld [%l1], %l0 | |
682 | ld [%l0], %l0 | |
683 | call %l0 | |
684 | or %g0, %g0, %o0 ! next_node(0) = first_node | |
685 | or %o0, %g0, %g6 | |
686 | ||
687 | sethi %hi(cputypvar), %o1 ! First node has cpu-arch | |
688 | or %o1, %lo(cputypvar), %o1 | |
689 | sethi %hi(cputypval), %o2 ! information, the string | |
690 | or %o2, %lo(cputypval), %o2 | |
691 | ld [%l1], %l0 ! 'compatibility' tells | |
692 | ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where | |
693 | call %l0 ! x is one of '', 'c', 'm', | |
694 | nop ! 'd' or 'e'. %o2 holds pointer | |
695 | ! to a buf where above string | |
696 | ! will get stored by the prom. | |
697 | ||
698 | subcc %o0, %g0, %g0 | |
699 | bpos got_prop ! Got the property | |
700 | nop | |
701 | ||
702 | or %g6, %g0, %o0 | |
703 | sethi %hi(cputypvar_sun4m), %o1 | |
704 | or %o1, %lo(cputypvar_sun4m), %o1 | |
705 | sethi %hi(cputypval), %o2 | |
706 | or %o2, %lo(cputypval), %o2 | |
707 | ld [%l1], %l0 | |
708 | ld [%l0 + 0xc], %l0 | |
709 | call %l0 | |
710 | nop | |
711 | ||
712 | got_prop: | |
0fd7ef1f KE |
713 | #ifdef CONFIG_SPARC_LEON |
714 | /* no cpu-type check is needed, it is a SPARC-LEON */ | |
8401707f | 715 | |
01dae0f0 | 716 | sethi %hi(boot_cpu_id), %g2 ! boot-cpu index |
8401707f | 717 | |
01dae0f0 DH |
718 | #ifdef CONFIG_SMP |
719 | ldub [%g2 + %lo(boot_cpu_id)], %g1 | |
720 | cmp %g1, 0xff ! unset means first CPU | |
721 | bne leon_smp_cpu_startup ! continue only with master | |
722 | nop | |
723 | #endif | |
724 | /* Get CPU-ID from most significant 4-bit of ASR17 */ | |
725 | rd %asr17, %g1 | |
726 | srl %g1, 28, %g1 | |
8401707f | 727 | |
01dae0f0 DH |
728 | /* Update boot_cpu_id only on boot cpu */ |
729 | stub %g1, [%g2 + %lo(boot_cpu_id)] | |
8401707f | 730 | |
323206a1 | 731 | ba continue_boot |
0fd7ef1f KE |
732 | nop |
733 | #endif | |
1da177e4 LT |
734 | set cputypval, %o2 |
735 | ldub [%o2 + 0x4], %l1 | |
736 | ||
737 | cmp %l1, ' ' | |
323206a1 | 738 | be no_sun4c_here |
1da177e4 | 739 | cmp %l1, 'c' |
323206a1 | 740 | be no_sun4c_here |
1da177e4 LT |
741 | cmp %l1, 'm' |
742 | be 1f | |
743 | cmp %l1, 's' | |
744 | be 1f | |
745 | cmp %l1, 'd' | |
746 | be 1f | |
747 | cmp %l1, 'e' | |
748 | be no_sun4e_here ! Could be a sun4e. | |
749 | nop | |
750 | b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :)) | |
751 | nop | |
752 | ||
753 | 1: set cputypval, %l1 | |
754 | ldub [%l1 + 0x4], %l1 | |
323206a1 | 755 | cmp %l1, 'd' ! Let us see how the beast will die |
1da177e4 LT |
756 | be sun4d_init |
757 | nop | |
758 | ||
323206a1 SR |
759 | /* If not sun4d assume sun4m */ |
760 | b sun4m_init | |
1da177e4 LT |
761 | nop |
762 | ||
763 | /* CPUID in bootbus can be found at PA 0xff0140000 */ | |
764 | #define SUN4D_BOOTBUS_CPUID 0xf0140000 | |
765 | ||
766 | sun4d_init: | |
767 | /* Need to patch call to handler_irq */ | |
768 | set patch_handler_irq, %g4 | |
769 | set sun4d_handler_irq, %g5 | |
770 | sethi %hi(0x40000000), %g3 ! call | |
771 | sub %g5, %g4, %g5 | |
772 | srl %g5, 2, %g5 | |
773 | or %g5, %g3, %g5 | |
774 | st %g5, [%g4] | |
775 | ||
776 | #ifdef CONFIG_SMP | |
777 | /* Get our CPU id out of bootbus */ | |
778 | set SUN4D_BOOTBUS_CPUID, %g3 | |
779 | lduba [%g3] ASI_M_CTL, %g3 | |
780 | and %g3, 0xf8, %g3 | |
781 | srl %g3, 3, %g4 | |
782 | sta %g4, [%g0] ASI_M_VIKING_TMP1 | |
783 | sethi %hi(boot_cpu_id), %g5 | |
784 | stb %g4, [%g5 + %lo(boot_cpu_id)] | |
1da177e4 LT |
785 | #endif |
786 | ||
787 | /* Fall through to sun4m_init */ | |
788 | ||
789 | sun4m_init: | |
790 | /* XXX Fucking Cypress... */ | |
791 | lda [%g0] ASI_M_MMUREGS, %g5 | |
792 | srl %g5, 28, %g4 | |
793 | ||
794 | cmp %g4, 1 | |
795 | bne 1f | |
796 | srl %g5, 24, %g4 | |
797 | ||
798 | and %g4, 0xf, %g4 | |
799 | cmp %g4, 7 /* This would be a HyperSparc. */ | |
800 | ||
801 | bne 2f | |
802 | nop | |
803 | ||
804 | 1: | |
805 | ||
806 | #define PATCH_IT(dst, src) \ | |
807 | set (dst), %g5; \ | |
808 | set (src), %g4; \ | |
809 | ld [%g4], %g3; \ | |
810 | st %g3, [%g5]; \ | |
811 | ld [%g4+0x4], %g3; \ | |
812 | st %g3, [%g5+0x4]; | |
813 | ||
814 | /* Signed multiply. */ | |
815 | PATCH_IT(.mul, .mul_patch) | |
816 | PATCH_IT(.mul+0x08, .mul_patch+0x08) | |
817 | ||
818 | /* Signed remainder. */ | |
819 | PATCH_IT(.rem, .rem_patch) | |
820 | PATCH_IT(.rem+0x08, .rem_patch+0x08) | |
821 | PATCH_IT(.rem+0x10, .rem_patch+0x10) | |
822 | PATCH_IT(.rem+0x18, .rem_patch+0x18) | |
823 | PATCH_IT(.rem+0x20, .rem_patch+0x20) | |
824 | PATCH_IT(.rem+0x28, .rem_patch+0x28) | |
825 | ||
826 | /* Signed division. */ | |
827 | PATCH_IT(.div, .div_patch) | |
828 | PATCH_IT(.div+0x08, .div_patch+0x08) | |
829 | PATCH_IT(.div+0x10, .div_patch+0x10) | |
830 | PATCH_IT(.div+0x18, .div_patch+0x18) | |
831 | PATCH_IT(.div+0x20, .div_patch+0x20) | |
832 | ||
833 | /* Unsigned multiply. */ | |
834 | PATCH_IT(.umul, .umul_patch) | |
835 | PATCH_IT(.umul+0x08, .umul_patch+0x08) | |
836 | ||
837 | /* Unsigned remainder. */ | |
838 | PATCH_IT(.urem, .urem_patch) | |
839 | PATCH_IT(.urem+0x08, .urem_patch+0x08) | |
840 | PATCH_IT(.urem+0x10, .urem_patch+0x10) | |
841 | PATCH_IT(.urem+0x18, .urem_patch+0x18) | |
842 | ||
843 | /* Unsigned division. */ | |
844 | PATCH_IT(.udiv, .udiv_patch) | |
845 | PATCH_IT(.udiv+0x08, .udiv_patch+0x08) | |
846 | PATCH_IT(.udiv+0x10, .udiv_patch+0x10) | |
847 | ||
848 | #undef PATCH_IT | |
849 | ||
850 | /* Ok, the PROM could have done funny things and apple cider could still | |
851 | * be sitting in the fault status/address registers. Read them all to | |
852 | * clear them so we don't get magic faults later on. | |
853 | */ | |
854 | /* This sucks, apparently this makes Vikings call prom panic, will fix later */ | |
855 | 2: | |
856 | rd %psr, %o1 | |
857 | srl %o1, 28, %o1 ! Get a type of the CPU | |
858 | ||
859 | subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC | |
323206a1 | 860 | be continue_boot |
1da177e4 LT |
861 | nop |
862 | ||
863 | set AC_M_SFSR, %o0 | |
864 | lda [%o0] ASI_M_MMUREGS, %g0 | |
865 | set AC_M_SFAR, %o0 | |
866 | lda [%o0] ASI_M_MMUREGS, %g0 | |
867 | ||
868 | /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */ | |
869 | subcc %o1, 0, %g0 | |
323206a1 | 870 | be continue_boot |
1da177e4 LT |
871 | nop |
872 | ||
873 | set AC_M_AFSR, %o0 | |
874 | lda [%o0] ASI_M_MMUREGS, %g0 | |
875 | set AC_M_AFAR, %o0 | |
876 | lda [%o0] ASI_M_MMUREGS, %g0 | |
877 | nop | |
878 | ||
879 | ||
323206a1 | 880 | continue_boot: |
1da177e4 LT |
881 | |
882 | /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's | |
883 | * show-time! | |
884 | */ | |
885 | ||
886 | sethi %hi(cputyp), %o0 | |
887 | st %g4, [%o0 + %lo(cputyp)] | |
888 | ||
889 | /* Turn on Supervisor, EnableFloating, and all the PIL bits. | |
890 | * Also puts us in register window zero with traps off. | |
891 | */ | |
892 | set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2 | |
893 | wr %g2, 0x0, %psr | |
894 | WRITE_PAUSE | |
895 | ||
896 | /* I want a kernel stack NOW! */ | |
897 | set init_thread_union, %g1 | |
898 | set (THREAD_SIZE - STACKFRAME_SZ), %g2 | |
899 | add %g1, %g2, %sp | |
900 | mov 0, %fp /* And for good luck */ | |
901 | ||
902 | /* Zero out our BSS section. */ | |
903 | set __bss_start , %o0 ! First address of BSS | |
86ed40bd | 904 | set _end , %o1 ! Last address of BSS |
1da177e4 LT |
905 | add %o0, 0x1, %o0 |
906 | 1: | |
907 | stb %g0, [%o0] | |
908 | subcc %o0, %o1, %g0 | |
909 | bl 1b | |
910 | add %o0, 0x1, %o0 | |
911 | ||
5fcafb7a DH |
912 | /* If boot_cpu_id has not been setup by machine specific |
913 | * init-code above we default it to zero. | |
914 | */ | |
915 | sethi %hi(boot_cpu_id), %g2 | |
916 | ldub [%g2 + %lo(boot_cpu_id)], %g3 | |
917 | cmp %g3, 0xff | |
918 | bne 1f | |
919 | nop | |
920 | mov %g0, %g3 | |
921 | stub %g3, [%g2 + %lo(boot_cpu_id)] | |
922 | ||
923 | 1: /* boot_cpu_id set. calculate boot_cpu_id4 = boot_cpu_id*4 */ | |
924 | sll %g3, 2, %g3 | |
925 | sethi %hi(boot_cpu_id4), %g2 | |
926 | stub %g3, [%g2 + %lo(boot_cpu_id4)] | |
927 | ||
1da177e4 LT |
928 | /* Initialize the uwinmask value for init task just in case. |
929 | * But first make current_set[boot_cpu_id] point to something useful. | |
930 | */ | |
931 | set init_thread_union, %g6 | |
932 | set current_set, %g2 | |
933 | #ifdef CONFIG_SMP | |
1da177e4 LT |
934 | st %g6, [%g2] |
935 | add %g2, %g3, %g2 | |
936 | #endif | |
937 | st %g6, [%g2] | |
938 | ||
939 | st %g0, [%g6 + TI_UWINMASK] | |
940 | ||
941 | /* Compute NWINDOWS and stash it away. Now uses %wim trick explained | |
942 | * in the V8 manual. Ok, this method seems to work, Sparc is cool... | |
943 | * No, it doesn't work, have to play the save/readCWP/restore trick. | |
944 | */ | |
945 | ||
946 | wr %g0, 0x0, %wim ! so we do not get a trap | |
947 | WRITE_PAUSE | |
948 | ||
949 | save | |
950 | ||
951 | rd %psr, %g3 | |
952 | ||
953 | restore | |
954 | ||
955 | and %g3, 0x1f, %g3 | |
956 | add %g3, 0x1, %g3 | |
957 | ||
958 | mov 2, %g1 | |
959 | wr %g1, 0x0, %wim ! make window 1 invalid | |
960 | WRITE_PAUSE | |
961 | ||
962 | cmp %g3, 0x7 | |
963 | bne 2f | |
964 | nop | |
965 | ||
966 | /* Adjust our window handling routines to | |
967 | * do things correctly on 7 window Sparcs. | |
968 | */ | |
969 | ||
970 | #define PATCH_INSN(src, dest) \ | |
971 | set src, %g5; \ | |
972 | set dest, %g2; \ | |
973 | ld [%g5], %g4; \ | |
974 | st %g4, [%g2]; | |
975 | ||
976 | /* Patch for window spills... */ | |
977 | PATCH_INSN(spnwin_patch1_7win, spnwin_patch1) | |
978 | PATCH_INSN(spnwin_patch2_7win, spnwin_patch2) | |
979 | PATCH_INSN(spnwin_patch3_7win, spnwin_patch3) | |
980 | ||
981 | /* Patch for window fills... */ | |
982 | PATCH_INSN(fnwin_patch1_7win, fnwin_patch1) | |
983 | PATCH_INSN(fnwin_patch2_7win, fnwin_patch2) | |
984 | ||
985 | /* Patch for trap entry setup... */ | |
986 | PATCH_INSN(tsetup_7win_patch1, tsetup_patch1) | |
987 | PATCH_INSN(tsetup_7win_patch2, tsetup_patch2) | |
988 | PATCH_INSN(tsetup_7win_patch3, tsetup_patch3) | |
989 | PATCH_INSN(tsetup_7win_patch4, tsetup_patch4) | |
990 | PATCH_INSN(tsetup_7win_patch5, tsetup_patch5) | |
991 | PATCH_INSN(tsetup_7win_patch6, tsetup_patch6) | |
992 | ||
993 | /* Patch for returning from traps... */ | |
994 | PATCH_INSN(rtrap_7win_patch1, rtrap_patch1) | |
995 | PATCH_INSN(rtrap_7win_patch2, rtrap_patch2) | |
996 | PATCH_INSN(rtrap_7win_patch3, rtrap_patch3) | |
997 | PATCH_INSN(rtrap_7win_patch4, rtrap_patch4) | |
998 | PATCH_INSN(rtrap_7win_patch5, rtrap_patch5) | |
999 | ||
1000 | /* Patch for killing user windows from the register file. */ | |
1001 | PATCH_INSN(kuw_patch1_7win, kuw_patch1) | |
1002 | ||
1003 | /* Now patch the kernel window flush sequences. | |
1004 | * This saves 2 traps on every switch and fork. | |
1005 | */ | |
1006 | set 0x01000000, %g4 | |
1007 | set flush_patch_one, %g5 | |
1008 | st %g4, [%g5 + 0x18] | |
1009 | st %g4, [%g5 + 0x1c] | |
1010 | set flush_patch_two, %g5 | |
1011 | st %g4, [%g5 + 0x18] | |
1012 | st %g4, [%g5 + 0x1c] | |
1013 | set flush_patch_three, %g5 | |
1014 | st %g4, [%g5 + 0x18] | |
1015 | st %g4, [%g5 + 0x1c] | |
1016 | set flush_patch_four, %g5 | |
1017 | st %g4, [%g5 + 0x18] | |
1018 | st %g4, [%g5 + 0x1c] | |
1019 | set flush_patch_exception, %g5 | |
1020 | st %g4, [%g5 + 0x18] | |
1021 | st %g4, [%g5 + 0x1c] | |
1022 | set flush_patch_switch, %g5 | |
1023 | st %g4, [%g5 + 0x18] | |
1024 | st %g4, [%g5 + 0x1c] | |
1025 | ||
1026 | 2: | |
1027 | sethi %hi(nwindows), %g4 | |
1028 | st %g3, [%g4 + %lo(nwindows)] ! store final value | |
1029 | sub %g3, 0x1, %g3 | |
1030 | sethi %hi(nwindowsm1), %g4 | |
1031 | st %g3, [%g4 + %lo(nwindowsm1)] | |
1032 | ||
1033 | /* Here we go, start using Linux's trap table... */ | |
1034 | set trapbase, %g3 | |
1035 | wr %g3, 0x0, %tbr | |
1036 | WRITE_PAUSE | |
1037 | ||
1038 | /* Finally, turn on traps so that we can call c-code. */ | |
1039 | rd %psr, %g3 | |
1040 | wr %g3, 0x0, %psr | |
1041 | WRITE_PAUSE | |
1042 | ||
1043 | wr %g3, PSR_ET, %psr | |
1044 | WRITE_PAUSE | |
1045 | ||
1046 | /* First we call prom_init() to set up PROMLIB, then | |
1047 | * off to start_kernel(). | |
1048 | */ | |
1049 | ||
1050 | sethi %hi(prom_vector_p), %g5 | |
1051 | ld [%g5 + %lo(prom_vector_p)], %o0 | |
1052 | call prom_init | |
1053 | nop | |
1054 | ||
1055 | call start_kernel | |
1056 | nop | |
1057 | ||
1058 | /* We should not get here. */ | |
1059 | call halt_me | |
1060 | nop | |
323206a1 SR |
1061 | no_sun4c_here: |
1062 | ld [%g7 + 0x68], %o1 | |
1063 | set sun4c_notsup, %o0 | |
1064 | call %o1 | |
1da177e4 | 1065 | nop |
323206a1 | 1066 | b halt_me |
1da177e4 | 1067 | nop |
5110bd21 | 1068 | |
1da177e4 LT |
1069 | no_sun4e_here: |
1070 | ld [%g7 + 0x68], %o1 | |
1071 | set sun4e_notsup, %o0 | |
1072 | call %o1 | |
1073 | nop | |
1074 | b halt_me | |
1075 | nop | |
1076 | ||
1077 | __INITDATA | |
1078 | ||
1079 | sun4u_1: | |
1080 | .asciz "finddevice" | |
1081 | .align 4 | |
1082 | sun4u_2: | |
1083 | .asciz "/chosen" | |
1084 | .align 4 | |
1085 | sun4u_3: | |
1086 | .asciz "getprop" | |
1087 | .align 4 | |
1088 | sun4u_4: | |
1089 | .asciz "stdout" | |
1090 | .align 4 | |
1091 | sun4u_5: | |
1092 | .asciz "write" | |
1093 | .align 4 | |
1094 | sun4u_6: | |
1095 | .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r" | |
1096 | sun4u_6e: | |
1097 | .align 4 | |
1098 | sun4u_7: | |
1099 | .asciz "exit" | |
1100 | .align 8 | |
1101 | sun4u_a1: | |
1102 | .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0 | |
1103 | sun4u_r1: | |
1104 | .word 0 | |
1105 | sun4u_a2: | |
1106 | .word 0, sun4u_3, 0, 4, 0, 1, 0 | |
1107 | sun4u_i2: | |
1108 | .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0 | |
1109 | sun4u_r2: | |
1110 | .word 0 | |
1111 | sun4u_a3: | |
1112 | .word 0, sun4u_5, 0, 3, 0, 1, 0 | |
1113 | sun4u_i3: | |
1114 | .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0 | |
1115 | sun4u_r3: | |
1116 | .word 0 | |
1117 | sun4u_a4: | |
1118 | .word 0, sun4u_7, 0, 0, 0, 0 | |
1119 | sun4u_r4: | |
1120 | ||
1121 | __INIT | |
1122 | no_sun4u_here: | |
1123 | set sun4u_a1, %o0 | |
1124 | set current_pc, %l2 | |
1125 | cmp %l2, %g3 | |
1126 | be 1f | |
1127 | mov %o4, %l0 | |
1128 | sub %g3, %l2, %l6 | |
1129 | add %o0, %l6, %o0 | |
1130 | mov %o0, %l4 | |
1131 | mov sun4u_r4 - sun4u_a1, %l3 | |
1132 | ld [%l4], %l5 | |
1133 | 2: | |
1134 | add %l4, 4, %l4 | |
1135 | cmp %l5, %l2 | |
1136 | add %l5, %l6, %l5 | |
1137 | bgeu,a 3f | |
1138 | st %l5, [%l4 - 4] | |
1139 | 3: | |
1140 | subcc %l3, 4, %l3 | |
1141 | bne 2b | |
1142 | ld [%l4], %l5 | |
1143 | 1: | |
1144 | call %l0 | |
1145 | mov %o0, %l1 | |
1146 | ||
1147 | ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1 | |
1148 | add %l1, (sun4u_a2 - sun4u_a1), %o0 | |
1149 | call %l0 | |
1150 | st %o1, [%o0 + (sun4u_i2 - sun4u_a2)] | |
1151 | ||
1152 | ld [%l1 + (sun4u_1 - sun4u_a1)], %o1 | |
1153 | add %l1, (sun4u_a3 - sun4u_a1), %o0 | |
1154 | call %l0 | |
1155 | st %o1, [%o0 + (sun4u_i3 - sun4u_a3)] | |
1156 | ||
1157 | call %l0 | |
1158 | add %l1, (sun4u_a4 - sun4u_a1), %o0 | |
1159 | ||
1160 | /* Not reached */ | |
1161 | halt_me: | |
1162 | ld [%g7 + 0x74], %o0 | |
1163 | call %o0 ! Get us out of here... | |
1164 | nop ! Apparently Solaris is better. | |
1165 | ||
1166 | /* Ok, now we continue in the .data/.text sections */ | |
1167 | ||
1168 | .data | |
1169 | .align 4 | |
1170 | ||
1171 | /* | |
1172 | * Fill up the prom vector, note in particular the kind first element, | |
1173 | * no joke. I don't need all of them in here as the entire prom vector | |
1174 | * gets initialized in c-code so all routines can use it. | |
1175 | */ | |
1176 | ||
1da177e4 LT |
1177 | prom_vector_p: |
1178 | .word 0 | |
1179 | ||
1180 | /* We calculate the following at boot time, window fills/spills and trap entry | |
1181 | * code uses these to keep track of the register windows. | |
1182 | */ | |
1183 | ||
1184 | .align 4 | |
1185 | .globl nwindows | |
1186 | .globl nwindowsm1 | |
1187 | nwindows: | |
1188 | .word 8 | |
1189 | nwindowsm1: | |
1190 | .word 7 | |
1191 | ||
1192 | /* Boot time debugger vector value. We need this later on. */ | |
1193 | ||
1194 | .align 4 | |
1195 | .globl linux_dbvec | |
1196 | linux_dbvec: | |
1197 | .word 0 | |
1198 | .word 0 | |
1199 | ||
1200 | .align 8 | |
1201 | ||
1202 | .globl lvl14_save | |
1203 | lvl14_save: | |
1204 | .word 0 | |
1205 | .word 0 | |
1206 | .word 0 | |
1207 | .word 0 | |
1208 | .word t_irq14 | |
1209 | ||
1210 | .section ".fixup",#alloc,#execinstr | |
1211 | .globl __ret_efault | |
1212 | __ret_efault: | |
1213 | ret | |
1214 | restore %g0, -EFAULT, %o0 |