os/kernel/syscall.c

40 lines
824 B
C
Raw Normal View History

2024-08-10 01:14:29 +02:00
#include <kernel/tty.h>
2024-08-11 13:40:21 +02:00
#include <kernel/io/keyboard.h>
2024-08-10 01:14:29 +02:00
#include <debugging.h>
static void print(char* buffer)
{
terminal_writestring(buffer);
}
static void input(char* buffer)
{
2024-11-27 21:57:18 +01:00
terminal_writestring("Input: ");
2024-08-10 01:14:29 +02:00
while (true) {
2024-08-10 02:18:09 +02:00
for (size_t i = 0; i < keyboard_buffer_top; i++) {
2024-08-10 01:14:29 +02:00
buffer[i] = keyboard_buffer[i];
if (keyboard_buffer[i] == '\n') {
buffer[keyboard_buffer_top] = 0;
keyboard_buffer_top = 0;
return;
}
}
2024-08-10 01:17:14 +02:00
asm("hlt");
2024-08-10 01:14:29 +02:00
}
}
2024-11-27 21:57:18 +01:00
void _syscall(uint32_t a, uint32_t b, uint32_t c)
2024-08-10 01:14:29 +02:00
{
2025-02-25 18:48:58 +01:00
/*
2024-11-27 21:57:18 +01:00
switch (c) {
2024-08-10 01:14:29 +02:00
case 0x00:
print((char*) a);
break;
case 0x01:
input((char*) a);
break;
}
2025-02-25 18:48:58 +01:00
*/
2025-02-26 01:42:35 +01:00
terminal_writestring("waow :3\n");
2024-08-10 01:14:29 +02:00
}