starnix_core/arch/x64/
execution.rs1use crate::task::{CurrentTask, ThreadState};
6use starnix_registers::RegisterStorage;
7use starnix_syscalls::SyscallArg;
8use starnix_syscalls::decls::{Syscall, SyscallDecl};
9
10pub fn new_syscall_from_state<T: RegisterStorage>(
11 syscall_decl: SyscallDecl,
12 thread_state: &ThreadState<T>,
13) -> Syscall {
14 Syscall {
15 decl: syscall_decl,
16 arg0: SyscallArg::from_raw(thread_state.registers.rdi),
17 arg1: SyscallArg::from_raw(thread_state.registers.rsi),
18 arg2: SyscallArg::from_raw(thread_state.registers.rdx),
19 arg3: SyscallArg::from_raw(thread_state.registers.r10),
20 arg4: SyscallArg::from_raw(thread_state.registers.r8),
21 arg5: SyscallArg::from_raw(thread_state.registers.r9),
22 }
23}
24
25pub fn new_syscall(syscall_decl: SyscallDecl, current_task: &CurrentTask) -> Syscall {
26 new_syscall_from_state(syscall_decl, ¤t_task.thread_state)
27}