os/kernel/syscall.c
2024-08-11 13:40:21 +02:00

36 lines
746 B
C

#include <kernel/tty.h>
#include <kernel/io/keyboard.h>
#include <debugging.h>
static void print(char* buffer)
{
terminal_writestring(buffer);
}
static void input(char* buffer)
{
while (true) {
for (size_t i = 0; i < keyboard_buffer_top; i++) {
buffer[i] = keyboard_buffer[i];
if (keyboard_buffer[i] == '\n') {
buffer[keyboard_buffer_top] = 0;
keyboard_buffer_top = 0;
return;
}
}
asm("hlt");
}
}
void _syscall(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
{
switch (d) {
case 0x00:
print((char*) a);
break;
case 0x01:
input((char*) a);
break;
}
}