aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/src/context_switching/main.cpp17
1 files changed, 14 insertions, 3 deletions
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;