source: rtems/bsps/riscv/riscv/start/start.S @ 2086948a

5
Last change on this file since 2086948a was 2086948a, checked in by Sebastian Huber <sebastian.huber@…>, on 05/11/18 at 04:54:59

riscv: Add dummy SMP support

Update #3433.

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[6d85e05]1/*
2 * Copyright (c) 2015 University of York.
3 * Hesham Almatary <hesham@alumni.york.ac.uk>
4 *
5 * Copyright (c) 2013, The Regents of the University of California (Regents).
6 * All Rights Reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
[52f4fb6]29
[6d85e05]30#include <bsp/linker-symbols.h>
31#include <rtems/score/riscv-utility.h>
[8fa827c]32#include <rtems/score/cpu.h>
[6d85e05]33#include <rtems/asm.h>
34
35EXTERN(bsp_section_bss_begin)
36EXTERN(bsp_section_bss_end)
37EXTERN(ISR_Handler)
38EXTERN(bsp_section_stack_begin)
39
40PUBLIC(bsp_start_vector_table_begin)
41PUBLIC(bsp_start_vector_table_end)
42PUBLIC(_start)
43
[52f4fb6]44        .section        .bsp_start_text, "ax", @progbits
45        .align  2
46
[6d85e05]47TYPE_FUNC(_start)
48SYM(_start):
[9b2ef07f]49        /* Load global pointer */
50        .option push
51        .option norelax
52        la      gp, __global_pointer$
53        .option pop
54
[2086948a]55#ifdef RTEMS_SMP
56        csrr    s0, mhartid
57        bnez    s0, .Lloop_forever
58#endif
59
[52f4fb6]60        la      t0, ISR_Handler
61        csrw    mtvec, t0
[6d85e05]62
[52f4fb6]63        /* load stack and frame pointers */
64        la      sp, _Configuration_Interrupt_stack_area_end
[6d85e05]65
[b0ee789]66        /* Clear .bss */
67        la      a0, bsp_section_bss_begin
68        li      a1, 0
69        la      a2, bsp_section_bss_size
70        call    memset
[6d85e05]71
[52f4fb6]72        /* Init FPU unit if it's there */
73        li      t0, MSTATUS_FS
74        csrs    mstatus, t0
[6d85e05]75
[52f4fb6]76        j       boot_card
[6d85e05]77
[2086948a]78#ifdef RTEMS_SMP
79.Lloop_forever:
80        j       .Lloop_forever
81#endif
82
[52f4fb6]83        .align  4
[6d85e05]84bsp_start_vector_table_begin:
[52f4fb6]85        .word   _RISCV_Exception_default /* User int */
86        .word   _RISCV_Exception_default /* Supervisor int */
87        .word   _RISCV_Exception_default /* Reserved */
88        .word   _RISCV_Exception_default /* Machine int */
89        .word   _RISCV_Exception_default /* User timer int */
90        .word   _RISCV_Exception_default /* Supervisor Timer int */
91        .word   _RISCV_Exception_default /* Reserved */
92        .word   _RISCV_Exception_default /* Machine Timer int */
93        .word   _RISCV_Exception_default /* User external int */
94        .word   _RISCV_Exception_default /* Supervisor external int */
95        .word   _RISCV_Exception_default /* Reserved */
96        .word   _RISCV_Exception_default /* Machine external int */
97        .word   _RISCV_Exception_default
98        .word   _RISCV_Exception_default
99        .word   _RISCV_Exception_default
100        .word   _RISCV_Exception_default
[6d85e05]101bsp_start_vector_table_end:
Note: See TracBrowser for help on using the repository browser.