source: soft/tp20/correction/reset.s @ 80

Last change on this file since 80 was 57, checked in by porquet, 13 years ago

typo

File size: 3.0 KB
Line 
1#################################################################################
2#   File : reset.s
3#   Author : Alain Greiner
4#   Date : 15/09/2010
5#################################################################################
6#   This is a boot code for a multi-processor architecture supporting
7#   up to 8 processors :
8#   - It initializes the Status Register (SR)
9#   - It initializes the 8 stack pointers (stack size = 64K)
10#   - It initializes the interrupt vector with two ISR addresses.
11#   - It configurates the ICU : IRQ_IN[0] & IRQ_IN[1] activated.
12#   - It initializes the EPC register, and jumps to the main in user mode.
13#################################################################################
14
15    .section .reset,"ax",@progbits
16
17    .extern seg_stack_base
18    .extern seg_data_base
19    .extern main
20    .extern _interrupt_vector
21    .extern _isr_tty_get_task0
22    .extern _isr_switch
23
24    .globl  reset               # makes reset an external symbol
25    .ent    reset
26    .align  2
27
28reset:
29    .set noreorder
30
31# initializes stack pointers
32    mfc0    $10,    $15,    1
33    andi    $10,    $10,    0xf         # $10 <= proc_id
34    li      $27,    0x10000             # $27 <= 64 K
35    mult    $27,    $10   
36    mflo    $26                         # $26 <= proc_id*64K
37    addu    $26,    $26,    $27         # $26 <= (proc_id + 1)*64K
38    la      $29,    seg_stack_base      # $29 <= seg_stack_base
39    addu    $29,    $29,    $26         # $29 <= seg_stack_base + (proc_id + 1)*64K
40
41# initializes interrupt vector
42    la      $26,    _interrupt_vector   # $26 <= interrupt_vector address
43    la      $27,    _isr_switch         #
44    sw      $27,    0($26)              # interrupt_vector[0] <= _isr_switch
45    la      $27,    _isr_tty_get_task0  #
46    sw      $27,    4($26)              # interrupt_vector[1] <= _isr_tty_get_task0
47    la      $27,    _isr_tty_get_task1  #
48    sw      $27,    8($26)              # interrupt_vector[2] <= _isr_tty_get_task1
49    la      $27,    _isr_tty_get_task2  #
50    sw      $27,   12($26)              # interrupt_vector[3] <= _isr_tty_get_task2
51    la      $27,    _isr_tty_get_task3  #
52    sw      $27,   16($26)              # interrupt_vector[4] <= _isr_tty_get_task3
53    la      $27,    _isr_ioc            #
54    sw      $27,   20($26)              # interrupt_vector[5] <= _isr_ioc         
55    la      $27,    _isr_dma            #
56    sw      $27,   24($26)              # interrupt_vector[6] <= _isr_dma
57
58# initializes ICU
59    li      $27,    0x100000            # $27 <= 1M
60    mult    $27,    $10
61    mflo    $27                         # $27 <= proc_id*1M
62    la      $26,    seg_icu_base
63    addu    $26,    $26,    $27         # $26 <= seg_icu_base + proc_id*1M
64    li      $27,    0x3                 # IRQ_IN[0] & IRQ_IN[1] enabled
65    sw      $27,    8($26)              # ICU_MASK_SET 0x3
66
67# initializes SR register
68    li      $26,    0x0000FF13          # IRQ activation
69    mtc0    $26,    $12
70
71# jump to main in user mode
72    la      $26,    main
73    mtc0    $26,    $14
74    eret
75
76    .end    reset
77    .size   reset, .-reset
78
79    .set reorder
Note: See TracBrowser for help on using the repository browser.