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 | */ | |
404 | .globl pg0, pg1, pg2, pg3 | |
405 | .globl empty_bad_page | |
406 | .globl empty_bad_page_table | |
407 | .globl empty_zero_page | |
408 | .globl swapper_pg_dir | |
409 | swapper_pg_dir: .skip PAGE_SIZE | |
410 | pg0: .skip PAGE_SIZE | |
411 | pg1: .skip PAGE_SIZE | |
412 | pg2: .skip PAGE_SIZE | |
413 | pg3: .skip PAGE_SIZE | |
414 | empty_bad_page: .skip PAGE_SIZE | |
415 | empty_bad_page_table: .skip PAGE_SIZE | |
416 | empty_zero_page: .skip PAGE_SIZE | |
417 | ||
418 | .global root_flags | |
419 | .global ram_flags | |
420 | .global root_dev | |
421 | .global sparc_ramdisk_image | |
422 | .global sparc_ramdisk_size | |
423 | ||
424 | /* This stuff has to be in sync with SILO and other potential boot loaders | |
425 | * Fields should be kept upward compatible and whenever any change is made, | |
426 | * HdrS version should be incremented. | |
427 | */ | |
428 | .ascii "HdrS" | |
429 | .word LINUX_VERSION_CODE | |
430 | .half 0x0203 /* HdrS version */ | |
431 | root_flags: | |
432 | .half 1 | |
433 | root_dev: | |
434 | .half 0 | |
435 | ram_flags: | |
436 | .half 0 | |
437 | sparc_ramdisk_image: | |
438 | .word 0 | |
439 | sparc_ramdisk_size: | |
440 | .word 0 | |
441 | .word reboot_command | |
442 | .word 0, 0, 0 | |
443 | .word _end | |
444 | ||
445 | /* Cool, here we go. Pick up the romvec pointer in %o0 and stash it in | |
446 | * %g7 and at prom_vector_p. And also quickly check whether we are on | |
447 | * a v0, v2, or v3 prom. | |
448 | */ | |
449 | gokernel: | |
450 | /* Ok, it's nice to know, as early as possible, if we | |
451 | * are already mapped where we expect to be in virtual | |
452 | * memory. The Solaris /boot elf format bootloader | |
453 | * will peek into our elf header and load us where | |
454 | * we want to be, otherwise we have to re-map. | |
455 | * | |
456 | * Some boot loaders don't place the jmp'rs address | |
457 | * in %o7, so we do a pc-relative call to a local | |
458 | * label, then see what %o7 has. | |
459 | */ | |
460 | ||
461 | mov %o7, %g4 ! Save %o7 | |
462 | ||
463 | /* Jump to it, and pray... */ | |
464 | current_pc: | |
465 | call 1f | |
466 | nop | |
467 | ||
468 | 1: | |
469 | mov %o7, %g3 | |
470 | ||
471 | tst %o0 | |
472 | be no_sun4u_here | |
473 | mov %g4, %o7 /* Previous %o7. */ | |
474 | ||
475 | mov %o0, %l0 ! stash away romvec | |
476 | mov %o0, %g7 ! put it here too | |
477 | mov %o1, %l1 ! stash away debug_vec too | |
478 | ||
479 | /* Ok, let's check out our run time program counter. */ | |
480 | set current_pc, %g5 | |
481 | cmp %g3, %g5 | |
482 | be already_mapped | |
483 | nop | |
484 | ||
485 | /* %l6 will hold the offset we have to subtract | |
486 | * from absolute symbols in order to access areas | |
487 | * in our own image. If already mapped this is | |
488 | * just plain zero, else it is KERNBASE. | |
489 | */ | |
490 | set KERNBASE, %l6 | |
491 | b copy_prom_lvl14 | |
492 | nop | |
493 | ||
494 | already_mapped: | |
495 | mov 0, %l6 | |
496 | ||
497 | /* Copy over the Prom's level 14 clock handler. */ | |
498 | copy_prom_lvl14: | |
499 | #if 1 | |
500 | /* DJHR | |
501 | * preserve our linked/calculated instructions | |
502 | */ | |
503 | set lvl14_save, %g1 | |
504 | set t_irq14, %g3 | |
505 | sub %g1, %l6, %g1 ! translate to physical | |
506 | sub %g3, %l6, %g3 ! translate to physical | |
507 | ldd [%g3], %g4 | |
508 | std %g4, [%g1] | |
509 | ldd [%g3+8], %g4 | |
510 | std %g4, [%g1+8] | |
511 | #endif | |
512 | rd %tbr, %g1 | |
513 | andn %g1, 0xfff, %g1 ! proms trap table base | |
514 | or %g0, (0x1e<<4), %g2 ! offset to lvl14 intr | |
515 | or %g1, %g2, %g2 | |
516 | set t_irq14, %g3 | |
517 | sub %g3, %l6, %g3 | |
518 | ldd [%g2], %g4 | |
519 | std %g4, [%g3] | |
520 | ldd [%g2 + 0x8], %g4 | |
521 | std %g4, [%g3 + 0x8] ! Copy proms handler | |
522 | ||
323206a1 SR |
523 | /* DON'T TOUCH %l0 thru %l5 in these remapping routines, |
524 | * we need their values afterwards! | |
1da177e4 | 525 | */ |
323206a1 | 526 | |
1da177e4 LT |
527 | /* Now check whether we are already mapped, if we |
528 | * are we can skip all this garbage coming up. | |
529 | */ | |
530 | copy_prom_done: | |
531 | cmp %l6, 0 | |
532 | be go_to_highmem ! this will be a nop then | |
533 | nop | |
534 | ||
1da177e4 LT |
535 | srmmu_remap: |
536 | /* First, check for a viking (TI) module. */ | |
537 | set 0x40000000, %g2 | |
538 | rd %psr, %g3 | |
539 | and %g2, %g3, %g3 | |
540 | subcc %g3, 0x0, %g0 | |
541 | bz srmmu_nviking | |
542 | nop | |
543 | ||
544 | /* Figure out what kind of viking we are on. | |
545 | * We need to know if we have to play with the | |
546 | * AC bit and disable traps or not. | |
547 | */ | |
548 | ||
549 | /* I've only seen MicroSparc's on SparcClassics with this | |
550 | * bit set. | |
551 | */ | |
552 | set 0x800, %g2 | |
553 | lda [%g0] ASI_M_MMUREGS, %g3 ! peek in the control reg | |
554 | and %g2, %g3, %g3 | |
555 | subcc %g3, 0x0, %g0 | |
556 | bnz srmmu_nviking ! is in mbus mode | |
557 | nop | |
558 | ||
559 | rd %psr, %g3 ! DO NOT TOUCH %g3 | |
560 | andn %g3, PSR_ET, %g2 | |
561 | wr %g2, 0x0, %psr | |
562 | WRITE_PAUSE | |
563 | ||
564 | /* Get context table pointer, then convert to | |
565 | * a physical address, which is 36 bits. | |
566 | */ | |
567 | set AC_M_CTPR, %g4 | |
568 | lda [%g4] ASI_M_MMUREGS, %g4 | |
569 | sll %g4, 0x4, %g4 ! We use this below | |
570 | ! DO NOT TOUCH %g4 | |
571 | ||
572 | /* Set the AC bit in the Viking's MMU control reg. */ | |
573 | lda [%g0] ASI_M_MMUREGS, %g5 ! DO NOT TOUCH %g5 | |
574 | set 0x8000, %g6 ! AC bit mask | |
575 | or %g5, %g6, %g6 ! Or it in... | |
576 | sta %g6, [%g0] ASI_M_MMUREGS ! Close your eyes... | |
577 | ||
578 | /* Grrr, why does it seem like every other load/store | |
579 | * on the sun4m is in some ASI space... | |
580 | * Fine with me, let's get the pointer to the level 1 | |
581 | * page table directory and fetch its entry. | |
582 | */ | |
583 | lda [%g4] ASI_M_BYPASS, %o1 ! This is a level 1 ptr | |
584 | srl %o1, 0x4, %o1 ! Clear low 4 bits | |
585 | sll %o1, 0x8, %o1 ! Make physical | |
586 | ||
587 | /* Ok, pull in the PTD. */ | |
588 | lda [%o1] ASI_M_BYPASS, %o2 ! This is the 0x0 16MB pgd | |
589 | ||
590 | /* Calculate to KERNBASE entry. */ | |
591 | add %o1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %o3 | |
592 | ||
593 | /* Poke the entry into the calculated address. */ | |
594 | sta %o2, [%o3] ASI_M_BYPASS | |
595 | ||
596 | /* I don't get it Sun, if you engineered all these | |
597 | * boot loaders and the PROM (thank you for the debugging | |
598 | * features btw) why did you not have them load kernel | |
599 | * images up in high address space, since this is necessary | |
600 | * for ABI compliance anyways? Does this low-mapping provide | |
601 | * enhanced interoperability? | |
602 | * | |
603 | * "The PROM is the computer." | |
604 | */ | |
605 | ||
606 | /* Ok, restore the MMU control register we saved in %g5 */ | |
607 | sta %g5, [%g0] ASI_M_MMUREGS ! POW... ouch | |
608 | ||
609 | /* Turn traps back on. We saved it in %g3 earlier. */ | |
610 | wr %g3, 0x0, %psr ! tick tock, tick tock | |
611 | ||
612 | /* Now we burn precious CPU cycles due to bad engineering. */ | |
613 | WRITE_PAUSE | |
614 | ||
615 | /* Wow, all that just to move a 32-bit value from one | |
616 | * place to another... Jump to high memory. | |
617 | */ | |
618 | b go_to_highmem | |
619 | nop | |
620 | ||
621 | /* This works on viking's in Mbus mode and all | |
622 | * other MBUS modules. It is virtually the same as | |
623 | * the above madness sans turning traps off and flipping | |
624 | * the AC bit. | |
625 | */ | |
626 | srmmu_nviking: | |
627 | set AC_M_CTPR, %g1 | |
628 | lda [%g1] ASI_M_MMUREGS, %g1 ! get ctx table ptr | |
629 | sll %g1, 0x4, %g1 ! make physical addr | |
630 | lda [%g1] ASI_M_BYPASS, %g1 ! ptr to level 1 pg_table | |
631 | srl %g1, 0x4, %g1 | |
632 | sll %g1, 0x8, %g1 ! make phys addr for l1 tbl | |
633 | ||
634 | lda [%g1] ASI_M_BYPASS, %g2 ! get level1 entry for 0x0 | |
635 | add %g1, KERNBASE >> (SRMMU_PGDIR_SHIFT - 2), %g3 | |
636 | sta %g2, [%g3] ASI_M_BYPASS ! place at KERNBASE entry | |
637 | b go_to_highmem | |
638 | nop ! wheee.... | |
639 | ||
1da177e4 LT |
640 | |
641 | /* Now do a non-relative jump so that PC is in high-memory */ | |
642 | go_to_highmem: | |
643 | set execute_in_high_mem, %g1 | |
644 | jmpl %g1, %g0 | |
645 | nop | |
646 | ||
647 | /* The code above should be at beginning and we have to take care about | |
a0871e8c | 648 | * short jumps, as branching to .init.text section from .text is usually |
1da177e4 LT |
649 | * impossible */ |
650 | __INIT | |
651 | /* Acquire boot time privileged register values, this will help debugging. | |
652 | * I figure out and store nwindows and nwindowsm1 later on. | |
653 | */ | |
654 | execute_in_high_mem: | |
655 | mov %l0, %o0 ! put back romvec | |
656 | mov %l1, %o1 ! and debug_vec | |
657 | ||
658 | sethi %hi(prom_vector_p), %g1 | |
659 | st %o0, [%g1 + %lo(prom_vector_p)] | |
660 | ||
661 | sethi %hi(linux_dbvec), %g1 | |
662 | st %o1, [%g1 + %lo(linux_dbvec)] | |
663 | ||
664 | ld [%o0 + 0x4], %o3 | |
665 | and %o3, 0x3, %o5 ! get the version | |
666 | ||
667 | cmp %o3, 0x2 ! a v2 prom? | |
668 | be found_version | |
669 | nop | |
670 | ||
671 | /* paul@sfe.com.au */ | |
672 | cmp %o3, 0x3 ! a v3 prom? | |
673 | be found_version | |
674 | nop | |
675 | ||
1da177e4 | 676 | found_version: |
1da177e4 LT |
677 | /* Get the machine type via the mysterious romvec node operations. */ |
678 | ||
679 | add %g7, 0x1c, %l1 | |
680 | ld [%l1], %l0 | |
681 | ld [%l0], %l0 | |
682 | call %l0 | |
683 | or %g0, %g0, %o0 ! next_node(0) = first_node | |
684 | or %o0, %g0, %g6 | |
685 | ||
686 | sethi %hi(cputypvar), %o1 ! First node has cpu-arch | |
687 | or %o1, %lo(cputypvar), %o1 | |
688 | sethi %hi(cputypval), %o2 ! information, the string | |
689 | or %o2, %lo(cputypval), %o2 | |
690 | ld [%l1], %l0 ! 'compatibility' tells | |
691 | ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where | |
692 | call %l0 ! x is one of '', 'c', 'm', | |
693 | nop ! 'd' or 'e'. %o2 holds pointer | |
694 | ! to a buf where above string | |
695 | ! will get stored by the prom. | |
696 | ||
697 | subcc %o0, %g0, %g0 | |
698 | bpos got_prop ! Got the property | |
699 | nop | |
700 | ||
701 | or %g6, %g0, %o0 | |
702 | sethi %hi(cputypvar_sun4m), %o1 | |
703 | or %o1, %lo(cputypvar_sun4m), %o1 | |
704 | sethi %hi(cputypval), %o2 | |
705 | or %o2, %lo(cputypval), %o2 | |
706 | ld [%l1], %l0 | |
707 | ld [%l0 + 0xc], %l0 | |
708 | call %l0 | |
709 | nop | |
710 | ||
711 | got_prop: | |
0fd7ef1f KE |
712 | #ifdef CONFIG_SPARC_LEON |
713 | /* no cpu-type check is needed, it is a SPARC-LEON */ | |
8401707f | 714 | |
01dae0f0 | 715 | sethi %hi(boot_cpu_id), %g2 ! boot-cpu index |
8401707f | 716 | |
01dae0f0 DH |
717 | #ifdef CONFIG_SMP |
718 | ldub [%g2 + %lo(boot_cpu_id)], %g1 | |
719 | cmp %g1, 0xff ! unset means first CPU | |
720 | bne leon_smp_cpu_startup ! continue only with master | |
721 | nop | |
722 | #endif | |
723 | /* Get CPU-ID from most significant 4-bit of ASR17 */ | |
724 | rd %asr17, %g1 | |
725 | srl %g1, 28, %g1 | |
8401707f | 726 | |
01dae0f0 DH |
727 | /* Update boot_cpu_id only on boot cpu */ |
728 | stub %g1, [%g2 + %lo(boot_cpu_id)] | |
8401707f | 729 | |
323206a1 | 730 | ba continue_boot |
0fd7ef1f KE |
731 | nop |
732 | #endif | |
1da177e4 LT |
733 | set cputypval, %o2 |
734 | ldub [%o2 + 0x4], %l1 | |
735 | ||
736 | cmp %l1, ' ' | |
323206a1 | 737 | be no_sun4c_here |
1da177e4 | 738 | cmp %l1, 'c' |
323206a1 | 739 | be no_sun4c_here |
1da177e4 LT |
740 | cmp %l1, 'm' |
741 | be 1f | |
742 | cmp %l1, 's' | |
743 | be 1f | |
744 | cmp %l1, 'd' | |
745 | be 1f | |
746 | cmp %l1, 'e' | |
747 | be no_sun4e_here ! Could be a sun4e. | |
748 | nop | |
749 | b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :)) | |
750 | nop | |
751 | ||
752 | 1: set cputypval, %l1 | |
753 | ldub [%l1 + 0x4], %l1 | |
323206a1 | 754 | cmp %l1, 'd' ! Let us see how the beast will die |
1da177e4 LT |
755 | be sun4d_init |
756 | nop | |
757 | ||
323206a1 SR |
758 | /* If not sun4d assume sun4m */ |
759 | b sun4m_init | |
1da177e4 LT |
760 | nop |
761 | ||
762 | /* CPUID in bootbus can be found at PA 0xff0140000 */ | |
763 | #define SUN4D_BOOTBUS_CPUID 0xf0140000 | |
764 | ||
765 | sun4d_init: | |
766 | /* Need to patch call to handler_irq */ | |
767 | set patch_handler_irq, %g4 | |
768 | set sun4d_handler_irq, %g5 | |
769 | sethi %hi(0x40000000), %g3 ! call | |
770 | sub %g5, %g4, %g5 | |
771 | srl %g5, 2, %g5 | |
772 | or %g5, %g3, %g5 | |
773 | st %g5, [%g4] | |
774 | ||
775 | #ifdef CONFIG_SMP | |
776 | /* Get our CPU id out of bootbus */ | |
777 | set SUN4D_BOOTBUS_CPUID, %g3 | |
778 | lduba [%g3] ASI_M_CTL, %g3 | |
779 | and %g3, 0xf8, %g3 | |
780 | srl %g3, 3, %g4 | |
781 | sta %g4, [%g0] ASI_M_VIKING_TMP1 | |
782 | sethi %hi(boot_cpu_id), %g5 | |
783 | stb %g4, [%g5 + %lo(boot_cpu_id)] | |
1da177e4 LT |
784 | #endif |
785 | ||
786 | /* Fall through to sun4m_init */ | |
787 | ||
788 | sun4m_init: | |
789 | /* XXX Fucking Cypress... */ | |
790 | lda [%g0] ASI_M_MMUREGS, %g5 | |
791 | srl %g5, 28, %g4 | |
792 | ||
793 | cmp %g4, 1 | |
794 | bne 1f | |
795 | srl %g5, 24, %g4 | |
796 | ||
797 | and %g4, 0xf, %g4 | |
798 | cmp %g4, 7 /* This would be a HyperSparc. */ | |
799 | ||
800 | bne 2f | |
801 | nop | |
802 | ||
803 | 1: | |
804 | ||
805 | #define PATCH_IT(dst, src) \ | |
806 | set (dst), %g5; \ | |
807 | set (src), %g4; \ | |
808 | ld [%g4], %g3; \ | |
809 | st %g3, [%g5]; \ | |
810 | ld [%g4+0x4], %g3; \ | |
811 | st %g3, [%g5+0x4]; | |
812 | ||
813 | /* Signed multiply. */ | |
814 | PATCH_IT(.mul, .mul_patch) | |
815 | PATCH_IT(.mul+0x08, .mul_patch+0x08) | |
816 | ||
817 | /* Signed remainder. */ | |
818 | PATCH_IT(.rem, .rem_patch) | |
819 | PATCH_IT(.rem+0x08, .rem_patch+0x08) | |
820 | PATCH_IT(.rem+0x10, .rem_patch+0x10) | |
821 | PATCH_IT(.rem+0x18, .rem_patch+0x18) | |
822 | PATCH_IT(.rem+0x20, .rem_patch+0x20) | |
823 | PATCH_IT(.rem+0x28, .rem_patch+0x28) | |
824 | ||
825 | /* Signed division. */ | |
826 | PATCH_IT(.div, .div_patch) | |
827 | PATCH_IT(.div+0x08, .div_patch+0x08) | |
828 | PATCH_IT(.div+0x10, .div_patch+0x10) | |
829 | PATCH_IT(.div+0x18, .div_patch+0x18) | |
830 | PATCH_IT(.div+0x20, .div_patch+0x20) | |
831 | ||
832 | /* Unsigned multiply. */ | |
833 | PATCH_IT(.umul, .umul_patch) | |
834 | PATCH_IT(.umul+0x08, .umul_patch+0x08) | |
835 | ||
836 | /* Unsigned remainder. */ | |
837 | PATCH_IT(.urem, .urem_patch) | |
838 | PATCH_IT(.urem+0x08, .urem_patch+0x08) | |
839 | PATCH_IT(.urem+0x10, .urem_patch+0x10) | |
840 | PATCH_IT(.urem+0x18, .urem_patch+0x18) | |
841 | ||
842 | /* Unsigned division. */ | |
843 | PATCH_IT(.udiv, .udiv_patch) | |
844 | PATCH_IT(.udiv+0x08, .udiv_patch+0x08) | |
845 | PATCH_IT(.udiv+0x10, .udiv_patch+0x10) | |
846 | ||
847 | #undef PATCH_IT | |
848 | ||
849 | /* Ok, the PROM could have done funny things and apple cider could still | |
850 | * be sitting in the fault status/address registers. Read them all to | |
851 | * clear them so we don't get magic faults later on. | |
852 | */ | |
853 | /* This sucks, apparently this makes Vikings call prom panic, will fix later */ | |
854 | 2: | |
855 | rd %psr, %o1 | |
856 | srl %o1, 28, %o1 ! Get a type of the CPU | |
857 | ||
858 | subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC | |
323206a1 | 859 | be continue_boot |
1da177e4 LT |
860 | nop |
861 | ||
862 | set AC_M_SFSR, %o0 | |
863 | lda [%o0] ASI_M_MMUREGS, %g0 | |
864 | set AC_M_SFAR, %o0 | |
865 | lda [%o0] ASI_M_MMUREGS, %g0 | |
866 | ||
867 | /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */ | |
868 | subcc %o1, 0, %g0 | |
323206a1 | 869 | be continue_boot |
1da177e4 LT |
870 | nop |
871 | ||
872 | set AC_M_AFSR, %o0 | |
873 | lda [%o0] ASI_M_MMUREGS, %g0 | |
874 | set AC_M_AFAR, %o0 | |
875 | lda [%o0] ASI_M_MMUREGS, %g0 | |
876 | nop | |
877 | ||
878 | ||
323206a1 | 879 | continue_boot: |
1da177e4 LT |
880 | |
881 | /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's | |
882 | * show-time! | |
883 | */ | |
884 | ||
885 | sethi %hi(cputyp), %o0 | |
886 | st %g4, [%o0 + %lo(cputyp)] | |
887 | ||
888 | /* Turn on Supervisor, EnableFloating, and all the PIL bits. | |
889 | * Also puts us in register window zero with traps off. | |
890 | */ | |
891 | set (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2 | |
892 | wr %g2, 0x0, %psr | |
893 | WRITE_PAUSE | |
894 | ||
895 | /* I want a kernel stack NOW! */ | |
896 | set init_thread_union, %g1 | |
897 | set (THREAD_SIZE - STACKFRAME_SZ), %g2 | |
898 | add %g1, %g2, %sp | |
899 | mov 0, %fp /* And for good luck */ | |
900 | ||
901 | /* Zero out our BSS section. */ | |
902 | set __bss_start , %o0 ! First address of BSS | |
86ed40bd | 903 | set _end , %o1 ! Last address of BSS |
1da177e4 LT |
904 | add %o0, 0x1, %o0 |
905 | 1: | |
906 | stb %g0, [%o0] | |
907 | subcc %o0, %o1, %g0 | |
908 | bl 1b | |
909 | add %o0, 0x1, %o0 | |
910 | ||
5fcafb7a DH |
911 | /* If boot_cpu_id has not been setup by machine specific |
912 | * init-code above we default it to zero. | |
913 | */ | |
914 | sethi %hi(boot_cpu_id), %g2 | |
915 | ldub [%g2 + %lo(boot_cpu_id)], %g3 | |
916 | cmp %g3, 0xff | |
917 | bne 1f | |
918 | nop | |
919 | mov %g0, %g3 | |
920 | stub %g3, [%g2 + %lo(boot_cpu_id)] | |
921 | ||
922 | 1: /* boot_cpu_id set. calculate boot_cpu_id4 = boot_cpu_id*4 */ | |
923 | sll %g3, 2, %g3 | |
924 | sethi %hi(boot_cpu_id4), %g2 | |
925 | stub %g3, [%g2 + %lo(boot_cpu_id4)] | |
926 | ||
1da177e4 LT |
927 | /* Initialize the uwinmask value for init task just in case. |
928 | * But first make current_set[boot_cpu_id] point to something useful. | |
929 | */ | |
930 | set init_thread_union, %g6 | |
931 | set current_set, %g2 | |
932 | #ifdef CONFIG_SMP | |
1da177e4 LT |
933 | st %g6, [%g2] |
934 | add %g2, %g3, %g2 | |
935 | #endif | |
936 | st %g6, [%g2] | |
937 | ||
938 | st %g0, [%g6 + TI_UWINMASK] | |
939 | ||
940 | /* Compute NWINDOWS and stash it away. Now uses %wim trick explained | |
941 | * in the V8 manual. Ok, this method seems to work, Sparc is cool... | |
942 | * No, it doesn't work, have to play the save/readCWP/restore trick. | |
943 | */ | |
944 | ||
945 | wr %g0, 0x0, %wim ! so we do not get a trap | |
946 | WRITE_PAUSE | |
947 | ||
948 | save | |
949 | ||
950 | rd %psr, %g3 | |
951 | ||
952 | restore | |
953 | ||
954 | and %g3, 0x1f, %g3 | |
955 | add %g3, 0x1, %g3 | |
956 | ||
957 | mov 2, %g1 | |
958 | wr %g1, 0x0, %wim ! make window 1 invalid | |
959 | WRITE_PAUSE | |
960 | ||
961 | cmp %g3, 0x7 | |
962 | bne 2f | |
963 | nop | |
964 | ||
965 | /* Adjust our window handling routines to | |
966 | * do things correctly on 7 window Sparcs. | |
967 | */ | |
968 | ||
969 | #define PATCH_INSN(src, dest) \ | |
970 | set src, %g5; \ | |
971 | set dest, %g2; \ | |
972 | ld [%g5], %g4; \ | |
973 | st %g4, [%g2]; | |
974 | ||
975 | /* Patch for window spills... */ | |
976 | PATCH_INSN(spnwin_patch1_7win, spnwin_patch1) | |
977 | PATCH_INSN(spnwin_patch2_7win, spnwin_patch2) | |
978 | PATCH_INSN(spnwin_patch3_7win, spnwin_patch3) | |
979 | ||
980 | /* Patch for window fills... */ | |
981 | PATCH_INSN(fnwin_patch1_7win, fnwin_patch1) | |
982 | PATCH_INSN(fnwin_patch2_7win, fnwin_patch2) | |
983 | ||
984 | /* Patch for trap entry setup... */ | |
985 | PATCH_INSN(tsetup_7win_patch1, tsetup_patch1) | |
986 | PATCH_INSN(tsetup_7win_patch2, tsetup_patch2) | |
987 | PATCH_INSN(tsetup_7win_patch3, tsetup_patch3) | |
988 | PATCH_INSN(tsetup_7win_patch4, tsetup_patch4) | |
989 | PATCH_INSN(tsetup_7win_patch5, tsetup_patch5) | |
990 | PATCH_INSN(tsetup_7win_patch6, tsetup_patch6) | |
991 | ||
992 | /* Patch for returning from traps... */ | |
993 | PATCH_INSN(rtrap_7win_patch1, rtrap_patch1) | |
994 | PATCH_INSN(rtrap_7win_patch2, rtrap_patch2) | |
995 | PATCH_INSN(rtrap_7win_patch3, rtrap_patch3) | |
996 | PATCH_INSN(rtrap_7win_patch4, rtrap_patch4) | |
997 | PATCH_INSN(rtrap_7win_patch5, rtrap_patch5) | |
998 | ||
999 | /* Patch for killing user windows from the register file. */ | |
1000 | PATCH_INSN(kuw_patch1_7win, kuw_patch1) | |
1001 | ||
1002 | /* Now patch the kernel window flush sequences. | |
1003 | * This saves 2 traps on every switch and fork. | |
1004 | */ | |
1005 | set 0x01000000, %g4 | |
1006 | set flush_patch_one, %g5 | |
1007 | st %g4, [%g5 + 0x18] | |
1008 | st %g4, [%g5 + 0x1c] | |
1009 | set flush_patch_two, %g5 | |
1010 | st %g4, [%g5 + 0x18] | |
1011 | st %g4, [%g5 + 0x1c] | |
1012 | set flush_patch_three, %g5 | |
1013 | st %g4, [%g5 + 0x18] | |
1014 | st %g4, [%g5 + 0x1c] | |
1015 | set flush_patch_four, %g5 | |
1016 | st %g4, [%g5 + 0x18] | |
1017 | st %g4, [%g5 + 0x1c] | |
1018 | set flush_patch_exception, %g5 | |
1019 | st %g4, [%g5 + 0x18] | |
1020 | st %g4, [%g5 + 0x1c] | |
1021 | set flush_patch_switch, %g5 | |
1022 | st %g4, [%g5 + 0x18] | |
1023 | st %g4, [%g5 + 0x1c] | |
1024 | ||
1025 | 2: | |
1026 | sethi %hi(nwindows), %g4 | |
1027 | st %g3, [%g4 + %lo(nwindows)] ! store final value | |
1028 | sub %g3, 0x1, %g3 | |
1029 | sethi %hi(nwindowsm1), %g4 | |
1030 | st %g3, [%g4 + %lo(nwindowsm1)] | |
1031 | ||
1032 | /* Here we go, start using Linux's trap table... */ | |
1033 | set trapbase, %g3 | |
1034 | wr %g3, 0x0, %tbr | |
1035 | WRITE_PAUSE | |
1036 | ||
1037 | /* Finally, turn on traps so that we can call c-code. */ | |
1038 | rd %psr, %g3 | |
1039 | wr %g3, 0x0, %psr | |
1040 | WRITE_PAUSE | |
1041 | ||
1042 | wr %g3, PSR_ET, %psr | |
1043 | WRITE_PAUSE | |
1044 | ||
1045 | /* First we call prom_init() to set up PROMLIB, then | |
1046 | * off to start_kernel(). | |
1047 | */ | |
1048 | ||
1049 | sethi %hi(prom_vector_p), %g5 | |
1050 | ld [%g5 + %lo(prom_vector_p)], %o0 | |
1051 | call prom_init | |
1052 | nop | |
1053 | ||
1054 | call start_kernel | |
1055 | nop | |
1056 | ||
1057 | /* We should not get here. */ | |
1058 | call halt_me | |
1059 | nop | |
323206a1 SR |
1060 | no_sun4c_here: |
1061 | ld [%g7 + 0x68], %o1 | |
1062 | set sun4c_notsup, %o0 | |
1063 | call %o1 | |
1da177e4 | 1064 | nop |
323206a1 | 1065 | b halt_me |
1da177e4 | 1066 | nop |
5110bd21 | 1067 | |
1da177e4 LT |
1068 | no_sun4e_here: |
1069 | ld [%g7 + 0x68], %o1 | |
1070 | set sun4e_notsup, %o0 | |
1071 | call %o1 | |
1072 | nop | |
1073 | b halt_me | |
1074 | nop | |
1075 | ||
1076 | __INITDATA | |
1077 | ||
1078 | sun4u_1: | |
1079 | .asciz "finddevice" | |
1080 | .align 4 | |
1081 | sun4u_2: | |
1082 | .asciz "/chosen" | |
1083 | .align 4 | |
1084 | sun4u_3: | |
1085 | .asciz "getprop" | |
1086 | .align 4 | |
1087 | sun4u_4: | |
1088 | .asciz "stdout" | |
1089 | .align 4 | |
1090 | sun4u_5: | |
1091 | .asciz "write" | |
1092 | .align 4 | |
1093 | sun4u_6: | |
1094 | .asciz "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r" | |
1095 | sun4u_6e: | |
1096 | .align 4 | |
1097 | sun4u_7: | |
1098 | .asciz "exit" | |
1099 | .align 8 | |
1100 | sun4u_a1: | |
1101 | .word 0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0 | |
1102 | sun4u_r1: | |
1103 | .word 0 | |
1104 | sun4u_a2: | |
1105 | .word 0, sun4u_3, 0, 4, 0, 1, 0 | |
1106 | sun4u_i2: | |
1107 | .word 0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0 | |
1108 | sun4u_r2: | |
1109 | .word 0 | |
1110 | sun4u_a3: | |
1111 | .word 0, sun4u_5, 0, 3, 0, 1, 0 | |
1112 | sun4u_i3: | |
1113 | .word 0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0 | |
1114 | sun4u_r3: | |
1115 | .word 0 | |
1116 | sun4u_a4: | |
1117 | .word 0, sun4u_7, 0, 0, 0, 0 | |
1118 | sun4u_r4: | |
1119 | ||
1120 | __INIT | |
1121 | no_sun4u_here: | |
1122 | set sun4u_a1, %o0 | |
1123 | set current_pc, %l2 | |
1124 | cmp %l2, %g3 | |
1125 | be 1f | |
1126 | mov %o4, %l0 | |
1127 | sub %g3, %l2, %l6 | |
1128 | add %o0, %l6, %o0 | |
1129 | mov %o0, %l4 | |
1130 | mov sun4u_r4 - sun4u_a1, %l3 | |
1131 | ld [%l4], %l5 | |
1132 | 2: | |
1133 | add %l4, 4, %l4 | |
1134 | cmp %l5, %l2 | |
1135 | add %l5, %l6, %l5 | |
1136 | bgeu,a 3f | |
1137 | st %l5, [%l4 - 4] | |
1138 | 3: | |
1139 | subcc %l3, 4, %l3 | |
1140 | bne 2b | |
1141 | ld [%l4], %l5 | |
1142 | 1: | |
1143 | call %l0 | |
1144 | mov %o0, %l1 | |
1145 | ||
1146 | ld [%l1 + (sun4u_r1 - sun4u_a1)], %o1 | |
1147 | add %l1, (sun4u_a2 - sun4u_a1), %o0 | |
1148 | call %l0 | |
1149 | st %o1, [%o0 + (sun4u_i2 - sun4u_a2)] | |
1150 | ||
1151 | ld [%l1 + (sun4u_1 - sun4u_a1)], %o1 | |
1152 | add %l1, (sun4u_a3 - sun4u_a1), %o0 | |
1153 | call %l0 | |
1154 | st %o1, [%o0 + (sun4u_i3 - sun4u_a3)] | |
1155 | ||
1156 | call %l0 | |
1157 | add %l1, (sun4u_a4 - sun4u_a1), %o0 | |
1158 | ||
1159 | /* Not reached */ | |
1160 | halt_me: | |
1161 | ld [%g7 + 0x74], %o0 | |
1162 | call %o0 ! Get us out of here... | |
1163 | nop ! Apparently Solaris is better. | |
1164 | ||
1165 | /* Ok, now we continue in the .data/.text sections */ | |
1166 | ||
1167 | .data | |
1168 | .align 4 | |
1169 | ||
1170 | /* | |
1171 | * Fill up the prom vector, note in particular the kind first element, | |
1172 | * no joke. I don't need all of them in here as the entire prom vector | |
1173 | * gets initialized in c-code so all routines can use it. | |
1174 | */ | |
1175 | ||
1da177e4 LT |
1176 | prom_vector_p: |
1177 | .word 0 | |
1178 | ||
1179 | /* We calculate the following at boot time, window fills/spills and trap entry | |
1180 | * code uses these to keep track of the register windows. | |
1181 | */ | |
1182 | ||
1183 | .align 4 | |
1184 | .globl nwindows | |
1185 | .globl nwindowsm1 | |
1186 | nwindows: | |
1187 | .word 8 | |
1188 | nwindowsm1: | |
1189 | .word 7 | |
1190 | ||
1191 | /* Boot time debugger vector value. We need this later on. */ | |
1192 | ||
1193 | .align 4 | |
1194 | .globl linux_dbvec | |
1195 | linux_dbvec: | |
1196 | .word 0 | |
1197 | .word 0 | |
1198 | ||
1199 | .align 8 | |
1200 | ||
1201 | .globl lvl14_save | |
1202 | lvl14_save: | |
1203 | .word 0 | |
1204 | .word 0 | |
1205 | .word 0 | |
1206 | .word 0 | |
1207 | .word t_irq14 | |
1208 | ||
1209 | .section ".fixup",#alloc,#execinstr | |
1210 | .globl __ret_efault | |
1211 | __ret_efault: | |
1212 | ret | |
1213 | restore %g0, -EFAULT, %o0 |