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