Skip to content

Commit 9eb5920

Browse files
committed
examples: implement _start and syscall for RISC-V
To build the API examples on RISC-V we need to implement _start and syscall for RISC-V. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
1 parent 6f7f47e commit 9eb5920

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

examples/api/crt0.S

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,38 @@ syscall:
8080
return_addr:
8181
.align 8
8282
.long 0
83+
#elif defined(CONFIG_ARCH_RV32I)
84+
85+
.text
86+
.globl _start
87+
_start:
88+
la t0, search_hint
89+
sw sp, 0(t0)
90+
la t0, main
91+
jalr x0, t0
92+
93+
.globl syscall
94+
syscall:
95+
la t0, syscall_ptr
96+
lw t0, 0(t0)
97+
jalr x0, t0
98+
99+
#elif defined(CONFIG_ARCH_RV64I)
100+
101+
.text
102+
.globl _start
103+
_start:
104+
la t0, search_hint
105+
sd sp, 0(t0)
106+
la t0, main
107+
jalr x0, t0
108+
109+
.globl syscall
110+
syscall:
111+
la t0, syscall_ptr
112+
ld t0, 0(t0)
113+
jalr x0, t0
114+
83115
#else
84116
#error No support for this arch!
85117
#endif

0 commit comments

Comments
 (0)