mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-19 09:35:15 -04:00
Add a print_char system call
This commit is contained in:
parent
19b68b7e9f
commit
d7378376e6
@ -8,8 +8,26 @@
|
|||||||
#include "system_calls.hpp"
|
#include "system_calls.hpp"
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void sc_print_char(const interrupt::syscall_regs& regs){
|
||||||
|
k_print(static_cast<char>(regs.rbx));
|
||||||
|
}
|
||||||
|
|
||||||
|
} //End of anonymous namespace
|
||||||
|
|
||||||
void system_call_entry(const interrupt::syscall_regs& regs){
|
void system_call_entry(const interrupt::syscall_regs& regs){
|
||||||
k_print_line("system_call");
|
auto code = regs.rax;
|
||||||
|
|
||||||
|
switch(code){
|
||||||
|
case 0:
|
||||||
|
sc_print_char(regs);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
k_print_line("Invalid system call");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void install_system_calls(){
|
void install_system_calls(){
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
asm volatile("int 50");
|
asm volatile("mov rax, 0; mov rbx, 0x41; int 50" : : : "rax", "rbx");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user