flip-jump
flip-jump copied to clipboard
Implement the RiscV fj library
Implement stl/riscvlib.fj
Create a new standard library file just for RiscV 32bit Instruction Set (RV32I).
ecall: related syscalls
- read (input): a7=63, a0=0, a1=input_buf, a2=len (returns len. ~maybe return bytes read until \n or \0?)
- write (output): a7=64, a0=1, a1=output_buf, a2=len (returns len)
- exit: a7=93, a0=error_code (exits, self-loop)
- exit_group: a7=94, a0=error_code (exits, self-loop)
- brk: a7=214, a0=new_brk (maintains global brk. returns brk, sets brk to new_brk)
maybe getpid(172) (return 1) / getcwd(17) (return "", 1).
The table in page 144 (128) in V20191214 riscv-pdf is really helpfull.
Decided on switching to arm. the "syscall"-implementation equivalence in arm-none-eabi-gcc in the implementation of newlib's functions (as _write, _read, _exit, _sbrk). so the research on the linux syscalls wasn't redundant - it shows as now that we were totally on track, and it's a clear sign of confidence on continuing on this path.