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