Changeset 96e0748d in mainline for kernel/arch/mips32/src
- Timestamp:
- 2009-02-17T22:47:27Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f89979b
- Parents:
- e662a5f
- Location:
- kernel/arch/mips32/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/mips32/src/mips32.c
re662a5f r96e0748d 34 34 35 35 #include <arch.h> 36 #include <arch/boot.h>37 36 #include <arch/cp0.h> 38 37 #include <arch/exception.h> … … 59 58 #include <arch/asm/regname.h> 60 59 61 /* Size of the code jumping to the exception handler code 62 * - J+NOP 63 */ 64 #define EXCEPTION_JUMP_SIZE 65 66 #define TLB_EXC ((char *) 0x80000000)67 #define NORM_EXC ((char *) 0x80000180)68 #define CACHE_EXC ((char *) 0x80000100)60 /* Size of the code jumping to the exception handler code 61 * - J+NOP 62 */ 63 #define EXCEPTION_JUMP_SIZE 8 64 65 #define TLB_EXC ((char *) 0x80000000) 66 #define NORM_EXC ((char *) 0x80000180) 67 #define CACHE_EXC ((char *) 0x80000100) 69 68 70 69 71 70 /* Why the linker moves the variable 64K away in assembler 72 * when not in .text section ???????? 73 */ 71 * when not in .text section? 72 */ 73 74 /* Stack pointer saved when entering user mode */ 74 75 uintptr_t supervisor_sp __attribute__ ((section (".text"))); 75 /* Stack pointer saved when entering user mode */ 76 /* TODO: How do we do it on SMP system???? */ 77 bootinfo_t bootinfo __attribute__ ((section (".text"))); 78 79 void arch_pre_main(void) 76 77 count_t cpu_count = 0; 78 79 void arch_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo) 80 80 { 81 81 /* Setup usermode */ 82 init.cnt = bootinfo.cnt; 83 84 uint32_t i; 85 86 for (i = 0; i < bootinfo.cnt; i++) { 87 init.tasks[i].addr = bootinfo.tasks[i].addr; 88 init.tasks[i].size = bootinfo.tasks[i].size; 82 init.cnt = bootinfo->cnt; 83 84 count_t i; 85 for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { 86 init.tasks[i].addr = bootinfo->tasks[i].addr; 87 init.tasks[i].size = bootinfo->tasks[i].size; 88 } 89 90 for (i = 0; i < CPUMAP_MAX_RECORDS; i++) { 91 if ((bootinfo->cpumap & (1 << i)) != 0) 92 cpu_count++; 89 93 } 90 94 } -
kernel/arch/mips32/src/smp/smp.c
re662a5f r96e0748d 33 33 */ 34 34 35 #include <config.h> 35 36 #include <smp/smp.h> 37 #include <arch/arch.h> 36 38 37 39 #ifdef CONFIG_SMP … … 39 41 void smp_init(void) 40 42 { 43 config.cpu_count = cpu_count; 41 44 } 42 45 -
kernel/arch/mips32/src/start.S
re662a5f r96e0748d 32 32 #include <arch/context_offset.h> 33 33 #include <arch/stack.h> 34 34 35 35 .text 36 36 … … 153 153 # Move $k0 (superveisor_sp) 154 154 lw $k0, 0($k0) 155 1: 155 1: 156 156 .endm 157 157 158 158 .org 0x0 159 159 kernel_image_start: … … 162 162 ori $sp, $sp, %lo(end_stack) 163 163 164 /* Not sure about this, but might 165 be needed for PIC code */ 166 lui $gp, 0x8000 167 164 168 /* $a1 contains physical address of bootinfo_t */ 165 /* $a2 contains size of bootinfo_t */166 167 beq $a2, $0, bootinfo_end168 169 /* Not sure about this, but might be needed for PIC code???? */170 lui $gp, 0x8000171 172 lui $a3, %hi(bootinfo)173 ori $a3, $a3, %lo(bootinfo)174 175 bootinfo_loop:176 177 lw $v0, 0($a1)178 sw $v0, 0($a3)179 180 addi $a1, $a1, 4181 addi $a3, $a3, 4182 addi $a2, $a2, -4183 184 bgtz $a2, bootinfo_loop185 nop186 187 bootinfo_end:188 169 189 170 jal arch_pre_main … … 206 187 exception_entry: 207 188 j exception_handler 208 nop 209 189 nop 190 210 191 exception_handler: 211 192 KERNEL_STACK_TO_K0 … … 216 197 mfc0 $k0, $cause 217 198 218 sra $k0, $k0, 0x2 219 andi $k0, $k0, 0x1f 220 sub $k0, 8 199 sra $k0, $k0, 0x2 # cp0_exc_cause() part 1 200 andi $k0, $k0, 0x1f # cp0_exc_cause() part 2 201 sub $k0, 8 # 8 = SYSCALL 221 202 222 203 beqz $k0, syscall_shortcut 223 add $k0, 8 204 add $k0, 8 # Revert $k0 back to correct exc number 224 205 225 206 REGISTERS_STORE_AND_EXC_RESET $sp 226 207 227 208 move $a1, $sp 228 jal exc_dispatch 209 jal exc_dispatch # exc_dispatch(excno, register_space) 229 210 move $a0, $k0 230 211
Note:
See TracChangeset
for help on using the changeset viewer.