Changeset 189 for soft/giet_vm/boot/reset.S
- Timestamp:
- Aug 7, 2012, 6:37:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/boot/reset.S
r173 r189 7 7 /* running one or several multi-tasks software application(s) defined in */ 8 8 /* the mapping_info data-structure. */ 9 /* Procesor 0 uses the mapping_info data structure to build all page tables */ 10 /* before jumping to the kernel_init code. */ 9 /* Procesor 0 uses the mapping_info data structure to statically initialize */ 10 /* the kernel structures: */ 11 /* - build page tables for all vspaces */ 12 /* - initializes the vobjs not initialized by GCC */ 13 /* - initialize the schedulers and task contexts for all processeurs */ 14 /* - initialize the peripherals */ 11 15 /* Other processors are waiting until the mapping_info signature has been */ 12 /* modified by processor 0 (done while executing kernel_init code). */ 16 /* modified by processor 0. */ 17 /* */ 13 18 /* Implementation note: */ 14 19 /* The entry point is 0xbfc00000, but the actual boot code starts at address */ … … 43 48 .align 2 44 49 .org EXCEP_ORG 50 45 51 boot_excep: 46 la a0, boot_error_string 47 jal boot_puts 52 53 # get the lock protecting TTY0 54 la k0, boot_tty0_lock 55 ll k1, 0(k0) 56 bnez k1, boot_excep 57 li k1, 1 58 sc k1, 0(k0) 59 beqz k1, boot_excep 60 nop 61 62 # display error messages on TTY0 63 la a0, boot_error_string 64 jal boot_puts 48 65 nop 49 66 mfc0 a0, CP0_TIME 50 jal boot_putw67 jal boot_putw 51 68 nop 52 la a0, boot_lf_string53 jal boot_puts54 nop 55 56 la a0, boot_pid_string57 jal boot_puts69 la a0, boot_lf_string 70 jal boot_puts 71 nop 72 73 la a0, boot_pid_string 74 jal boot_puts 58 75 nop 59 76 mfc0 k0, CP0_PROCID 60 77 andi a0, k0, 0xFFF 61 jal boot_putw62 nop 63 la a0, boot_lf_string64 jal boot_puts65 nop 66 67 la a0, boot_epc_string68 jal boot_puts78 jal boot_putw 79 nop 80 la a0, boot_lf_string 81 jal boot_puts 82 nop 83 84 la a0, boot_epc_string 85 jal boot_puts 69 86 nop 70 87 mfc0 a0, CP0_EPC 71 jal boot_putw72 nop 73 la a0, boot_lf_string74 jal boot_puts75 nop 76 77 la a0, boot_cr_string78 jal boot_puts88 jal boot_putw 89 nop 90 la a0, boot_lf_string 91 jal boot_puts 92 nop 93 94 la a0, boot_cr_string 95 jal boot_puts 79 96 nop 80 97 mfc0 a0, CP0_CR 81 jal boot_putw82 nop 83 la a0, boot_lf_string84 jal boot_puts85 nop 86 87 la a0, boot_sr_string88 jal boot_puts98 jal boot_putw 99 nop 100 la a0, boot_lf_string 101 jal boot_puts 102 nop 103 104 la a0, boot_sr_string 105 jal boot_puts 89 106 nop 90 107 mfc0 a0, CP0_SR 91 jal boot_putw92 nop 93 la a0, boot_lf_string94 jal boot_puts95 nop 96 97 la a0, boot_bar_string98 jal boot_puts108 jal boot_putw 109 nop 110 la a0, boot_lf_string 111 jal boot_puts 112 nop 113 114 la a0, boot_bar_string 115 jal boot_puts 99 116 nop 100 117 mfc0 a0, CP0_BAR 101 jal boot_putw 102 nop 103 la a0, boot_lf_string 104 jal boot_puts 105 nop 106 118 jal boot_putw 119 nop 120 la a0, boot_lf_string 121 jal boot_puts 122 nop 123 124 # release the lock 125 la k0, boot_tty0_lock 126 li k1, 0 127 sw k1, 0(k0) 128 129 # exit 107 130 j boot_exit 108 131 nop … … 115 138 116 139 boot_start: 117 /* get the procid */ 140 141 # get the procid 118 142 mfc0 k0, CP0_PROCID 119 andi k0, k0, 0xFFF /* no more than 4096 processors... */120 121 /* Only processor 0 does init */122 bne k0, zero, boot_wait_signature123 nop 124 125 /* Processor 0 get a temporary stack */143 andi k0, k0, 0xFFF # no more than 4096 processors 144 145 # Only processor 0 does init 146 bne k0, zero, boot_wait_signature 147 nop 148 149 # Processor 0 get a temporary stack 126 150 la sp, seg_boot_stack_base 127 addiu sp, sp, 0x3000 /* SP <= seg_boot_stack + 12K */128 129 /* Processor 0 initialises all Page Tables */130 jal boot_ pt_init151 addiu sp, sp, 0x3000 # SP <= seg_boot_stack + 12K 152 153 # Processor 0 initialises all kernel structures 154 jal boot_init 131 155 nop 132 156 133 /* jump to kernel_init */157 # jump to kernel_init 134 158 j boot_to_kernel_init 135 159 nop … … 137 161 boot_wait_signature: 138 162 139 /* all other processors are waiting signature change */140 la 141 cache 0x11, 0(k0) /* invalidate local cache copy */142 lw k0, 0(k0) /* k0 <= mapping_info[0] */143 li k1,OUT_MAPPING_SIGNATURE144 bne 163 # all other processors are waiting signature change 164 la k0, seg_mapping_base 165 cache 0x11, 0(k0) # invalidate local cache copy 166 lw k0, 0(k0) # k0 <= mapping_info[0] 167 li k1, OUT_MAPPING_SIGNATURE 168 bne k1, k0, boot_wait_signature 145 169 nop 146 170 147 /* all other processors get a temporary stack of 256 bytes */171 # all other processors initialise SP register: temporary stack of 256 bytes 148 172 la sp, seg_boot_stack_base 149 173 addiu sp, sp, 0x3100 … … 151 175 andi k0, k0, 0xFFF 152 176 sll k0, k0, 8 153 addu sp, sp, k0 /* SP <= seg_boot_stack_base + 12K + (pid+1)*256 */177 addu sp, sp, k0 # SP <= seg_boot_stack_base + 12K + (pid+1)*256 154 178 155 179 boot_to_kernel_init: 156 180 157 /* all processors initialize PTPR with PTAB[0] */ 158 la k1, _ptabs 181 # all processors initialise SCHED register with boot_schedulers_paddr[pid] 182 mfc0 k0, CP0_PROCID 183 andi k0, k0, 0xFFF 184 sll k0, k0, 2 # k0 <= 4*pid 185 la k1, boot_schedulers_paddr 186 addu k1, k1, k0 # k1 <= &boot_scheduler_paddr[pid] 187 lw k1, 0(k1) 188 mtc0 k1, CP0_SCHED 189 190 # all processors initialize PTPR register with boot_ptabs_paddr[0] 191 la k1, boot_ptabs_paddr 159 192 lw k1, 0(k1) 160 193 srl k1, k1, 13 161 mtc2 k1, CP2_PTPR /* PTPR <= _ptabs[0] */162 163 /* all processors activate MMU */194 mtc2 k1, CP2_PTPR 195 196 # all processors activate MMU 164 197 li k1, 0xF 165 mtc2 k1, CP2_MODE /* MODE register */166 167 /* jump to kernel_init */198 mtc2 k1, CP2_MODE 199 200 # all processors jump to kernel_init 168 201 la k0, seg_kernel_init_base 169 202 j k0 170 203 nop 171 204 172 boot_error_string: .asciiz "\n[BOOT] Fatal Error in reset.Sat cycle "205 boot_error_string: .asciiz "\n[BOOT] Fatal Error at cycle " 173 206 boot_pid_string: .asciiz " PID = " 174 207 boot_sr_string: .asciiz " SR = " … … 178 211 boot_lf_string: .asciiz "\n" 179 212 180 .set reorder 181 182 213 boot_tty0_lock: .word 0 214 215 .set reorder 216 217
Note: See TracChangeset
for help on using the changeset viewer.