Skip to content

Commit d4159f2

Browse files
committed
Update docusaurus, update VM calls
1 parent 9992c70 commit d4159f2

File tree

2 files changed

+904
-996
lines changed

2 files changed

+904
-996
lines changed

docs/emulator/vmcalls.md

+19
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,27 @@ In the C API each argument register has to be populated manually, and the return
279279
A general rule for passing data to a function is that:
280280
1. Each integer goes into the next free integer register
281281
2. Each pointer goes into the next free integer register
282+
283+
```c
284+
LIBRISCV_ARG_REGISTER(regs, 0) = 1;
285+
LIBRISCV_ARG_REGISTER(regs, 1) = true;
286+
LIBRISCV_ARG_REGISTER(regs, 2) = libriscv_stack_push(machine, regs, mystruct, sizeof(mystruct));
287+
LIBRISCV_ARG_REGISTER(regs, 3) = libriscv_address_of(machine, "my_function");
288+
```
289+
A function address is also a pointer, which goes into the integer register file.
290+
291+
282292
3. Each float goes into the next free float register of that type
283293
294+
```c
295+
LIBRISCV_FP32_ARG_REG(regs, 0) = 1.0f;
296+
LIBRISCV_FP32_ARG_REG(regs, 1) = 2.0f;
297+
LIBRISCV_FP64_ARG_REG(regs, 2) = 3.0;
298+
LIBRISCV_FP64_ARG_REG(regs, 3) = 4.0;
299+
```
300+
32- and 64-bit floating point values use the same register file.
301+
302+
284303
### Example
285304

286305
Function:

0 commit comments

Comments
 (0)