I'm writing RISCV assembly and I need to perform some syscalls. Based on other answers on this site I know I need to load the syscall code into a7 and launch ecall.
How do I know what code to use?
EDIT: I'm trying to use write, read, close,wait4, fork.
I found two sources of syscall codes that are different:
https://github.com/westerndigitalcorporation/RISC-V-Linux/blob/master/linux/arch/s390/kernel/syscalls/syscall.tbl
and directly in the file generated after running make linux using the RISCV toolchain: sysroot/usr/include/asm-generic/unistd.h
Which should I use? (Fork is in the first but not the second)
it is a late answer, but perhaps someone will find it usefull.
As of now you can find the codes for linux syscall at this website :
https://gpages.juszkiewicz.com.pl/syscalls-table/syscalls.html
just select your architecture.
for the calling convention, there is a post about it there :
RISC-V ecall syscall calling convention on pk/Linux
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With