source: branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/reset.S @ 994

Last change on this file since 994 was 934, checked in by cfuguet, 10 years ago

reconf: add unitary test for the segment migration mechanism in the
dspin router.

File size: 1.5 KB
Line 
1/**
2 * File   : reset.S
3 * Author : Cesar FUGUET <cesar.fuguet-tortolero@lip6.fr>
4 * Date   : 16 October 2014
5 */
6
7#include "hard_config.h"
8#include "cpu_registers.h"
9
10    .section .reset,"ax",@progbits
11
12    .extern seg_stack_base
13    .extern seg_kcode_base
14    .extern main
15
16    .globl  reset
17    .ent    reset
18    .align  2
19
20#define P_MASK ((1<<P_WIDTH)-1)
21#define Y_MASK ((1<<Y_WIDTH)-1)
22
23reset:
24    .set noreorder
25
26    /*
27     * SR register initialization
28     * - Disable interrupts
29     * - Keep the Bootstrap Exception Vector (BEV) bit set
30     */
31    li     k0,  0x00400000
32    mtc0   k0,  CP0_STATUS
33
34    /*
35     * All processors compute:
36     *   cid = (x * Y_SIZE) + y
37     *   pid = (cid * NB_PROCS_MAX) + lpid
38     */
39    mfc0   k0,  CP0_PROCID
40    andi   k0,  k0,  0xFFF             /* k0 <= proc_xyl                 */
41
42    /* Only the processor 0 continues the execution                      */
43    beqz   k0,  1f
44    nop
45    wait
46
471:  /* processor 0 initializes stack pointer (16K) */
48    la     sp,  _stack
49    addiu  sp,  sp,  (1<<14)           /* sp <= _stack + 16K             */
50
51    /* jumps to main in kernel mode */
52    jal    main
53    nop
54
55    j      exit
56    nop
57
58    .set reorder
59    .end reset
60
61
62
63.org 0x380
64
65reset_exception_handler:
66    mtc2   $0,  MMU_DATA_PADDR_EXT
67    j exception_handler
68
69
70
71    .section .data
72
73/*
74 * Stack segment definition
75 */
76_stack:
77    .space (1<<14)                     /* 16 Kbytes                      */
78
79/*
80 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
81 */
Note: See TracBrowser for help on using the repository browser.