flip-jump icon indicating copy to clipboard operation
flip-jump copied to clipboard

Implement the RiscV fj library

Open tomhea opened this issue 4 years ago • 2 comments

Implement stl/riscvlib.fj

Create a new standard library file just for RiscV 32bit Instruction Set (RV32I).

tomhea avatar May 07 '21 23:05 tomhea

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).

  • no other syscalls seemed important, maybe sched_yield/sync (ignored) and reboot (exit), but they don't exist in the numbers link below.
  • numbers, info

tomhea avatar May 22 '21 00:05 tomhea

The table in page 144 (128) in V20191214 riscv-pdf is really helpfull.

tomhea avatar Jun 17 '21 00:06 tomhea

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.

tomhea avatar Dec 10 '22 10:12 tomhea