aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/context_switching/syscall/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/context_switching/syscall/main.cpp')
-rw-r--r--arch/x86_64/src/context_switching/syscall/main.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/x86_64/src/context_switching/syscall/main.cpp b/arch/x86_64/src/context_switching/syscall/main.cpp
index 93fc613..996d7fb 100644
--- a/arch/x86_64/src/context_switching/syscall/main.cpp
+++ b/arch/x86_64/src/context_switching/syscall/main.cpp
@@ -2,7 +2,7 @@
namespace teachos::arch::context_switching::syscall
{
- auto syscall(type syscall_number, arguments args) -> error
+ auto syscall(type syscall_number, arguments args) -> response
{
asm volatile("mov %[input], %%rax"
: /* no output from call */
@@ -18,9 +18,18 @@ namespace teachos::arch::context_switching::syscall
asm volatile("syscall");
- error error{};
- asm volatile("mov %%rax, %[output]" : [output] "=m"(error));
- return error;
+ error error_code{};
+ asm volatile("mov %%rax, %[output]" : [output] "=m"(error_code));
+
+ arguments values{};
+ asm volatile("mov %%rdi, %[output]" : [output] "=m"(values.arg_0));
+ asm volatile("mov %%rsi, %[output]" : [output] "=m"(values.arg_1));
+ asm volatile("mov %%rdx, %[output]" : [output] "=m"(values.arg_2));
+ asm volatile("mov %%r10, %[output]" : [output] "=m"(values.arg_3));
+ asm volatile("mov %%r8, %[output]" : [output] "=m"(values.arg_4));
+ asm volatile("mov %%r9, %[output]" : [output] "=m"(values.arg_5));
+
+ return {error_code, values};
}
} // namespace teachos::arch::context_switching::syscall