Rev 3890 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3890 | Rev 3922 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | #include <arch/asm/regname.h> |
29 | #include <arch/asm/regname.h> |
30 | #include <arch/mm/page.h> |
30 | #include <arch/mm/page.h> |
31 | #include <arch/asm/boot.h> |
31 | #include <arch/asm/boot.h> |
32 | #include <arch/context_offset.h> |
32 | #include <arch/context_offset.h> |
33 | #include <arch/stack.h> |
33 | #include <arch/stack.h> |
34 | 34 | ||
35 | .text |
35 | .text |
36 | 36 | ||
37 | .set noat |
37 | .set noat |
38 | .set noreorder |
38 | .set noreorder |
39 | .set nomacro |
39 | .set nomacro |
Line 150... | Line 150... | ||
150 | # Move $k0 pointer to kernel stack |
150 | # Move $k0 pointer to kernel stack |
151 | lui $k0, %hi(supervisor_sp) |
151 | lui $k0, %hi(supervisor_sp) |
152 | ori $k0, $k0, %lo(supervisor_sp) |
152 | ori $k0, $k0, %lo(supervisor_sp) |
153 | # Move $k0 (superveisor_sp) |
153 | # Move $k0 (superveisor_sp) |
154 | lw $k0, 0($k0) |
154 | lw $k0, 0($k0) |
155 | 1: |
155 | 1: |
156 | .endm |
156 | .endm |
157 | 157 | ||
158 | .org 0x0 |
158 | .org 0x0 |
159 | kernel_image_start: |
159 | kernel_image_start: |
160 | /* Load temporary stack */ |
160 | /* Load temporary stack */ |
161 | lui $sp, %hi(end_stack) |
161 | lui $sp, %hi(end_stack) |
162 | ori $sp, $sp, %lo(end_stack) |
162 | ori $sp, $sp, %lo(end_stack) |
163 | 163 | ||
164 | /* $a1 contains physical address of bootinfo_t */ |
- | |
165 | /* $a2 contains size of bootinfo_t */ |
164 | /* Not sure about this, but might |
166 | - | ||
167 | beq $a2, $0, bootinfo_end |
- | |
168 | - | ||
169 | /* Not sure about this, but might be needed for PIC code???? */ |
165 | be needed for PIC code */ |
170 | lui $gp, 0x8000 |
166 | lui $gp, 0x8000 |
171 | 167 | ||
172 | lui $a3, %hi(bootinfo) |
- | |
173 | ori $a3, $a3, %lo(bootinfo) |
168 | /* $a1 contains physical address of bootinfo_t */ |
174 | - | ||
175 | bootinfo_loop: |
- | |
176 | - | ||
177 | lw $v0, 0($a1) |
- | |
178 | sw $v0, 0($a3) |
- | |
179 | - | ||
180 | addi $a1, $a1, 4 |
- | |
181 | addi $a3, $a3, 4 |
- | |
182 | addi $a2, $a2, -4 |
- | |
183 | - | ||
184 | bgtz $a2, bootinfo_loop |
- | |
185 | nop |
- | |
186 | - | ||
187 | bootinfo_end: |
- | |
188 | 169 | ||
189 | jal arch_pre_main |
170 | jal arch_pre_main |
190 | nop |
171 | nop |
191 | 172 | ||
192 | j main_bsp |
173 | j main_bsp |
Line 203... | Line 184... | ||
203 | j cache_error_handler |
184 | j cache_error_handler |
204 | nop |
185 | nop |
205 | 186 | ||
206 | exception_entry: |
187 | exception_entry: |
207 | j exception_handler |
188 | j exception_handler |
208 | nop |
189 | nop |
209 | 190 | ||
210 | exception_handler: |
191 | exception_handler: |
211 | KERNEL_STACK_TO_K0 |
192 | KERNEL_STACK_TO_K0 |
212 | sub $k0, REGISTER_SPACE |
193 | sub $k0, REGISTER_SPACE |
213 | sw $sp, EOFFSET_SP($k0) |
194 | sw $sp, EOFFSET_SP($k0) |
214 | move $sp, $k0 |
195 | move $sp, $k0 |
215 | 196 | ||
216 | mfc0 $k0, $cause |
197 | mfc0 $k0, $cause |
217 | 198 | ||
218 | sra $k0, $k0, 0x2 # cp0_exc_cause() part 1 |
199 | sra $k0, $k0, 0x2 # cp0_exc_cause() part 1 |
219 | andi $k0, $k0, 0x1f # cp0_exc_cause() part 2 |
200 | andi $k0, $k0, 0x1f # cp0_exc_cause() part 2 |
220 | sub $k0, 8 # 8 = SYSCALL |
201 | sub $k0, 8 # 8 = SYSCALL |
221 | 202 | ||
222 | beqz $k0, syscall_shortcut |
203 | beqz $k0, syscall_shortcut |
223 | add $k0, 8 # Revert $k0 back to correct exc number |
204 | add $k0, 8 # Revert $k0 back to correct exc number |
224 | 205 | ||
225 | REGISTERS_STORE_AND_EXC_RESET $sp |
206 | REGISTERS_STORE_AND_EXC_RESET $sp |
226 | 207 | ||
227 | move $a1, $sp |
208 | move $a1, $sp |
228 | jal exc_dispatch # exc_dispatch(excno, register_space) |
209 | jal exc_dispatch # exc_dispatch(excno, register_space) |
229 | move $a0, $k0 |
210 | move $a0, $k0 |
230 | 211 | ||
231 | REGISTERS_LOAD $sp |
212 | REGISTERS_LOAD $sp |
232 | # The $sp is automatically restored to former value |
213 | # The $sp is automatically restored to former value |
233 | eret |
214 | eret |