From ecdfbc3e1458923f619f0d4b8a841a6e96a6678a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Tue, 29 Apr 2025 15:01:44 +0000 Subject: Start adding parameters to syscall --- arch/x86_64/src/context_switching/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/x86_64/src/context_switching/main.cpp b/arch/x86_64/src/context_switching/main.cpp index 21299da..2a2a188 100644 --- a/arch/x86_64/src/context_switching/main.cpp +++ b/arch/x86_64/src/context_switching/main.cpp @@ -35,6 +35,11 @@ namespace teachos::arch::context_switching { video::vga::text::write("Successfully entered user mode!", video::vga::text::common_attributes::green_on_black); + uint64_t new_value = 60U; + asm volatile("mov %[input], %%rax" + : /* no output from call */ + : [input] "r"(new_value) + : "memory"); asm volatile("syscall"); video::vga::text::write("Successfully made a SYSCALL and returned back with SYSRETQ!", @@ -43,10 +48,16 @@ namespace teachos::arch::context_switching auto syscall_handler() -> void { - uint64_t dummy{}; - switch (dummy) + uint64_t syscall_number{}; + asm volatile("mov %%rax, %[output]" : [output] "=r"(syscall_number)); + + switch (syscall_number) { - case 0: + case 1: + // Write VGA + break; + case 60U: + // Exit break; default: break; -- cgit v1.2.3