System calls for mouse position

This commit is contained in:
Baptiste Wicht 2016-08-07 13:20:42 +02:00
parent 7f7d415fa3
commit f0d3982a59
3 changed files with 28 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include "rtc.hpp" #include "rtc.hpp"
#include "kernel_utils.hpp" #include "kernel_utils.hpp"
#include "vesa.hpp" #include "vesa.hpp"
#include "mouse.hpp"
#include "vfs/vfs.hpp" #include "vfs/vfs.hpp"
namespace { namespace {
@ -257,6 +258,14 @@ void sc_vesa_redraw(interrupt::syscall_regs* regs){
vesa::redraw(new_buffer); vesa::redraw(new_buffer);
} }
void sc_mouse_x(interrupt::syscall_regs* regs){
regs->rax = mouse::x();
}
void sc_mouse_y(interrupt::syscall_regs* regs){
regs->rax = mouse::y();
}
} //End of anonymous namespace } //End of anonymous namespace
void system_call_entry(interrupt::syscall_regs* regs){ void system_call_entry(interrupt::syscall_regs* regs){
@ -416,6 +425,14 @@ void system_call_entry(interrupt::syscall_regs* regs){
sc_vesa_redraw(regs); sc_vesa_redraw(regs);
break; break;
case 0x1100:
sc_mouse_x(regs);
break;
case 0x1101:
sc_mouse_y(regs);
break;
default: default:
k_print_line("Invalid system call"); k_print_line("Invalid system call");
break; break;

View File

@ -24,6 +24,9 @@ uint64_t get_red_shift();
uint64_t get_green_shift(); uint64_t get_green_shift();
uint64_t get_blue_shift(); uint64_t get_blue_shift();
uint64_t mouse_x();
uint64_t mouse_y();
void redraw(char* buffer); void redraw(char* buffer);
} // end of namespace graphics } // end of namespace graphics

View File

@ -58,3 +58,11 @@ void graphics::redraw(char* buffer){
: [buffer] "g" (buffer) : [buffer] "g" (buffer)
: "rax", "rbx"); : "rax", "rbx");
} }
uint64_t graphics::mouse_x(){
return syscall_get(0x1100);
}
uint64_t graphics::mouse_y(){
return syscall_get(0x1101);
}