boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

syscall.s (547B)


      1 /* tcc-build riscv64 syscall trampoline.
      2  *
      3  * C-ABI brings the syscall number in a0 and arguments in a1-a6;
      4  * Linux riscv64 ABI wants the number in a7 and arguments in a0-a5.
      5  * Shuffle and ecall; the kernel returns into a0 already.
      6  *
      7  * tcc-asm lacks the `ret` pseudo, so use the canonical
      8  * `jalr zero, ra, 0` form (matches tcc-libc/riscv64/sys_stubs.S).
      9  */
     10 
     11 	.global __syscall
     12 	.hidden __syscall
     13 	.type   __syscall, %function
     14 __syscall:
     15 	mv a7, a0
     16 	mv a0, a1
     17 	mv a1, a2
     18 	mv a2, a3
     19 	mv a3, a4
     20 	mv a4, a5
     21 	mv a5, a6
     22 	ecall
     23 	jalr zero, ra, 0