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

Last change on this file since 46 was 42, checked in by alain, 14 years ago

Improving the _barrier_init function in drivers.c

File size: 1.9 KB
RevLine 
[14]1#################################################################################
[42]2#   File : reset.s
3#   Author : Alain Greiner
4#   Date : 15/09/2010
[14]5#################################################################################
[42]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.
[14]10#       - It configurates the ICU : IRQ_IN[0] & IRQ_IN[1] activated.
[42]11#   - It initializes the EPC register, and jumps to the main in user mode.
[14]12#################################################################################
13
[42]14    .section .reset,"ax",@progbits
[14]15
[42]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
[14]22
[42]23    .globl  reset               # makes reset an external symbol
24    .ent    reset
25    .align  2
26
[14]27reset:
[42]28    .set noreorder
[14]29
30# initializes stack pointer
[42]31    la      $29,    seg_stack_base
32    addiu   $29,    $29,    0x4000
[14]33
34# initializes interrupt vector
[42]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
[14]40
41# initializes ICU
[42]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
[14]45
46# initializes SR register
[42]47    li      $26,    0x0000FF13      # IRQ activation
48    mtc0    $26,    $12
[14]49
50# jump to main in user mode
[42]51    la      $26,    main
52    mtc0    $26,    $14
53    eret
[14]54
[42]55    .end    reset
56    .size   reset, .-reset
[14]57
[42]58    .set reorder
Note: See TracBrowser for help on using the repository browser.