summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/env/semihost/crt.s
blob: b75cba8f6518dce4180fe9b0a7c5ebaaad8741d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# See LICENSE for license details.

.include "macros.s"
.include "constants.s"

#
# start of trap handler
#

.section .text.init,"ax",@progbits
.globl _start

_start:

    # set up stack pointer based on hartid (in a0)
    mv      t0, a0
    slli    t0, t0, STACK_SHIFT
    la      sp, stacks + STACK_SIZE
    add     sp, sp, t0

    # jump to libfemto_start_main
    j       libfemto_start_main

    .bss
    .align 4
    .global stacks
stacks:
    .skip STACK_SIZE * MAX_HARTS