From 47c858e3cd983a42a1afdb227418644f6bda1f65 Mon Sep 17 00:00:00 2001 From: Nathanne Isip Date: Sat, 18 May 2024 01:25:31 +0800 Subject: [PATCH] Integration of Keyboard API syscalls on Rishka VM. --- src/rishka_vm.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/rishka_vm.cpp b/src/rishka_vm.cpp index 6d9997d..71c1f53 100644 --- a/src/rishka_vm.cpp +++ b/src/rishka_vm.cpp @@ -947,6 +947,51 @@ uint64_t RishkaVM::handleSyscall(uint64_t code) { case RISHKA_SC_RT_FORK_STREAM: return RishkaSyscall::Runtime::getForkString(this); + case RISHKA_SC_KB_LAYOUT_NAME: + return RishkaSyscall::Keyboard::layout_name(); + + case RISHKA_SC_KB_LAYOUT_DESC: + return RishkaSyscall::Keyboard::layout_desc(); + + case RISHKA_SC_KB_DEVICE_TYPE: + return RishkaSyscall::Keyboard::device_type(); + + case RISHKA_SC_KB_LED_GET_NUM: + return RishkaSyscall::Keyboard::is_num_lock(); + + case RISHKA_SC_KB_LED_GET_CAPS: + return RishkaSyscall::Keyboard::is_caps_lock(); + + case RISHKA_SC_KB_LED_GET_SCROLL: + return RishkaSyscall::Keyboard::is_scroll_lock(); + + case RISHKA_SC_KB_LED_SET_NUM: + RishkaSyscall::Keyboard::num_lock(this); + break; + + case RISHKA_SC_KB_LED_SET_CAPS: + RishkaSyscall::Keyboard::caps_lock(this); + break; + + case RISHKA_SC_KB_LED_SET_SCROLL: + RishkaSyscall::Keyboard::scroll_lock(this); + break; + + case RISHKA_SC_KB_NEXT_SCAN_CODE: + return RishkaSyscall::Keyboard::next_scan_code(this); + + case RISHKA_SC_KB_LOCK: + RishkaSyscall::Keyboard::lock(this); + break; + + case RISHKA_SC_KB_UNLOCK: + RishkaSyscall::Keyboard::unlock(); + break; + + case RISHKA_SC_KB_RESET: + RishkaSyscall::Keyboard::reset(); + break; + default: this->panic("Invalid system call."); break;