diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-04-29 15:01:44 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-04-29 15:01:44 +0000 |
| commit | ecdfbc3e1458923f619f0d4b8a841a6e96a6678a (patch) | |
| tree | 589488a459732add1ac9d569444f82c7a0443c63 /arch | |
| parent | 151b699058d994c0aee18cc17fe56aecc15ea336 (diff) | |
| download | teachos-ecdfbc3e1458923f619f0d4b8a841a6e96a6678a.tar.xz teachos-ecdfbc3e1458923f619f0d4b8a841a6e96a6678a.zip | |
Start adding parameters to syscall
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86_64/src/context_switching/main.cpp | 17 |
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; |
