summaryrefslogtreecommitdiff
path: root/kernel/source/syscall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/source/syscall.cpp')
-rw-r--r--kernel/source/syscall.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/kernel/source/syscall.cpp b/kernel/source/syscall.cpp
index 768ff0d..5d9714c 100644
--- a/kernel/source/syscall.cpp
+++ b/kernel/source/syscall.cpp
@@ -157,7 +157,7 @@ namespace hilbert::kernel::syscall {
}
- void read_key_packet_syscall(
+ void get_input_packet_syscall(
uint64_t &rax, uint64_t &rdi, uint64_t &rsi, uint64_t &rdx
) {
@@ -165,8 +165,17 @@ namespace hilbert::kernel::syscall {
auto *t = application::running_thread;
do
- if (input::key_queue->count > 0) {
- rax = (uint64_t)input::key_queue->take();
+ if (input::input_queue->count > 0) {
+ input::input_packet packet = input::input_queue->take();
+ if (packet.is_mouse) {
+ rax = packet.mouse.buttons | 0x80;
+ rdi = (uint16_t)packet.mouse.x_change;
+ rsi = (uint16_t)packet.mouse.y_change;
+ }
+ else {
+ rax = 0;
+ rdi = packet.keyboard;
+ }
return;
}
while (application::save_thread_state(t->cpu));
@@ -504,7 +513,7 @@ namespace hilbert::kernel::syscall {
&open_file_syscall,
&end_this_thread_syscall,
&get_new_pages_syscall,
- &read_key_packet_syscall,
+ &get_input_packet_syscall,
&create_private_socket_syscall,
&create_socket_listener_syscall,
&stop_socket_listener_syscall,
@@ -520,7 +529,7 @@ namespace hilbert::kernel::syscall {
&set_stream_length_syscall
};
- static constexpr int max_syscall_number = 18;
+ static constexpr int max_syscall_number = 19;
}