source: soft/tp12/correction/reset.s @ 34

Last change on this file since 34 was 13, checked in by alain, 14 years ago
File size: 1.2 KB
Line 
1#################################################################################
2#       File : reset.s
3#       Author : Alain Greiner
4#       Date : 28/08/2006
5#################################################################################
6#       This is a minimal boot code :
7#       - It initializes the Status Register (SR)
8#       - It defines the stack size  and initializes the stack pointer ($29)
9#       - It initializes the global pointer ($28) that is used by GCC to
10#         optimize acces to the global variables.
11#       - It initializes the EPC register, and jump to the main address
12#################################################################################
13               
14        .section .reset,"ax",@progbits
15
16        .extern seg_stack_base
17        .extern seg_data_base
18        .extern main
19
20        .globl  reset                           # makes reset an external symbol
21        .ent    reset
22        .func   reset
23        .align  2
24
25reset:
26        .set noreorder
27
28# initializes SR register
29        li      $26,    0x00000013             
30        mtc0    $26,    $12                     
31
32# initializes stack pointer
33        la      $29,    seg_stack_base
34        addiu   $29,    $29,    0x4000 
35
36# initializes global pointer
37        la      $28,    seg_data_base   
38
39# jump to main in kernel mode
40        la      $26,    main
41        mtc0    $26,    $14
42        eret
43
44        .end    reset
45        .size   reset, .-reset
46
47        .set reorder
Note: See TracBrowser for help on using the repository browser.