2 #include <lunaix/syscall.h>
3 #include "syscall_nr.inc"
4 #include "asm/variants/interrupt64.S.inc"
7 .type syscall_hndlr, @function
14 movq %rdi, %rbx // struct hart_state*
16 movq irax(%rbx), %rax /* rax: call code as well as the return value from syscall */
17 cmpq $__SYSCALL_MAX, %rax
20 shlq $3, %rax // %rax * 8
21 movabsq $syscall_table, %r8
35 movq irbx(%rbx), %rsi /* rbx -> rsi #1 arg */
36 movq ircx(%rbx), %rdx /* rcx -> rdx #2 arg */
37 movq irdx(%rbx), %rcx /* rdx -> rcx #3 arg */
38 movq irdi(%rbx), %r8 /* rdi -> r8 #4 arg */
39 movq irsi(%rbx), %r9 /* rsi -> r9 #5 arg */
43 movq %rax, irax(%rbx) /* save the return value */