source: soft/tp14/correction/reset.s @ 57

Last change on this file since 57 was 42, checked in by alain, 13 years ago

Improving the _barrier_init function in drivers.c

File size: 1.9 KB
Line 
1#################################################################################
2#   File : reset.s
3#   Author : Alain Greiner
4#   Date : 15/09/2010
5#################################################################################
6#   This is an improved 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 interrupt vector with two ISR addresses.
10#       - It configurates the ICU : IRQ_IN[0] & IRQ_IN[1] activated.
11#   - It initializes the EPC register, and jumps to the main in user mode.
12#################################################################################
13
14    .section .reset,"ax",@progbits
15
16    .extern seg_stack_base
17    .extern seg_data_base
18    .extern main
19    .extern _interrupt_vector
20    .extern _isr_tty_get_task0
21    .extern _isr_timer
22
23    .globl  reset               # makes reset an external symbol
24    .ent    reset
25    .align  2
26
27reset:
28    .set noreorder
29
30# initializes stack pointer
31    la      $29,    seg_stack_base
32    addiu   $29,    $29,    0x4000
33
34# initializes interrupt vector
35    la      $26,    _interrupt_vector   # $26 <= interrupt_vector address
36    la      $27,    _isr_timer          # $27 <= isr_timer address
37    sw      $27,    0($26)              # interrupt_vector[0] <= _isr_timer
38    la      $27,    _isr_tty_get_task0  # $27 <= isr_tty_get_task0 address
39    sw      $27,    4($26)              # interrupt_vector[1] <= _isr_tty_get_task0
40
41# initializes ICU
42    la      $26,    seg_icu_base
43    li      $27,    0x3             # IRQ_IN[0] & IRQ_IN[1] enabled
44    sw      $27,    8($26)          # ICU_MASK_SET 0x3
45
46# initializes SR register
47    li      $26,    0x0000FF13      # IRQ activation
48    mtc0    $26,    $12
49
50# jump to main in user mode
51    la      $26,    main
52    mtc0    $26,    $14
53    eret
54
55    .end    reset
56    .size   reset, .-reset
57
58    .set reorder
Note: See TracBrowser for help on using the repository browser.