summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/env/semihost/crt.s
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/riscv-probe/env/semihost/crt.s')
-rw-r--r--riscv/riscv-probe/env/semihost/crt.s28
1 files changed, 28 insertions, 0 deletions
diff --git a/riscv/riscv-probe/env/semihost/crt.s b/riscv/riscv-probe/env/semihost/crt.s
new file mode 100644
index 0000000..b75cba8
--- /dev/null
+++ b/riscv/riscv-probe/env/semihost/crt.s
@@ -0,0 +1,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