You are on page 1of 8

ECALL in risc-v

E DI TOR: P O - WE I HUA N G
0 6 . 30. 2017
CC- BY- SA
Outline
Introduction to ecall
Pass the argument to ecall
What will ecall do?
Reference
Acknowledgement
Thanks Bruce Hoult for teaching me Ecall
ECALL
User level instruction in risc-v
Used to make a request to the supporting
execution environment (OS)
Argument for ECALL
Like int 3 in x86, it has an argument.
System ABI will define how parameters for the environment
request are passed, but usually these will be in defined
locations in the integer register file.
ECALL in Linux
Used to implement syscalls in linux.
Current Linux implementations on RISC-V pass
arguments in a0-a6, and put system call number
in a7. [1][2]
What will happen after ecall?
The behavior depends on privilege level.
Example in spike[3]
Reference
1.https://github.com/riscv/riscv-
linux/blob/32b1573d1f118844d859341d095e005ca5ba572e/arch/riscv/include/asm/sbi.h#L30
2.https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/75751735-0b47-4b97-9e19-
f4661a4e676a%40groups.riscv.org?utm_medium=email&utm_source=footer
3. https://github.com/riscv/riscv-isa-
sim/blob/5762bedab3a671ddfd279737d370533f31ed979e/riscv/insns/ecall.h

You might also like