Skip to content

Instantly share code, notes, and snippets.

@JakWai01
Created October 27, 2024 14:02
Show Gist options
  • Select an option

  • Save JakWai01/05832b053290b8ff0ea7ce023f9a3339 to your computer and use it in GitHub Desktop.

Select an option

Save JakWai01/05832b053290b8ff0ea7ce023f9a3339 to your computer and use it in GitHub Desktop.
https://cmput229.github.io/229-labs-RISCV/RISC-V-Examples_Public/01-Basics/01c-System_Calls.html
"Two registers and a single instruction are involved in a system call in RISC-V. The idea is to store important pieces of information into registers a0and a7, and then run the instruction ecall to perform the system call. The register a7 specifies the type of system call. Each type of system call has a number associated with it. To specify the type of system call the assembly program simply puts the corresponding number into a7. If the call needs a value, this value must be put into a0. For instance, to print an integer value, the value of the integer must be put into a0. For a system call that allocates memory, the number of bytes that will be allocated is put into a0."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment