#include "arch/context_switching/syscall/main.hpp" namespace teachos::arch::context_switching::syscall { auto syscall(type syscall_number, arguments args) -> error { asm volatile("mov %[input], %%rax" : /* no output from call */ : [input] "m"(syscall_number) : "memory"); asm volatile("mov %[input], %%rdi " : /* no output from call */ : [input] "m"(args.arg_0) : "memory"); asm volatile("mov %[input], %%rsi" : /* no output from call */ : [input] "m"(args.arg_1) : "memory"); asm volatile("mov %[input], %%rdx" : /* no output from call */ : [input] "m"(args.arg_2) : "memory"); asm volatile("mov %[input], %%r10" : /* no output from call */ : [input] "m"(args.arg_3) : "memory"); asm volatile("mov %[input], %%r8" : /* no output from call */ : [input] "m"(args.arg_4) : "memory"); asm volatile("mov %[input], %%r9" : /* no output from call */ : [input] "m"(args.arg_5) : "memory"); asm volatile("syscall"); error error{}; asm volatile("mov %%rax, %[output]" : [output] "=m"(error)); return error; } } // namespace teachos::arch::context_switching::syscall