diff --git a/kernel/common.h b/kernel/common.h index 45ed218..466901c 100644 --- a/kernel/common.h +++ b/kernel/common.h @@ -11,4 +11,7 @@ void kpanic(); void liftoff(uint32_t entry_point, uint32_t user_stack) __attribute__((noreturn)); +uint8_t inb(uint16_t port); +void outb(uint16_t port, uint8_t data); + #endif \ No newline at end of file diff --git a/kernel/drivers/vga/vga.c b/kernel/drivers/vga/vga.c index f78bd19..7190898 100644 --- a/kernel/drivers/vga/vga.c +++ b/kernel/drivers/vga/vga.c @@ -3,7 +3,9 @@ #include -#include "vga.h" +#include + +#include #define VGA_WIDTH 80 #define VGA_HEIGHT 25 @@ -43,7 +45,21 @@ static inline uint16_t vga_entry(unsigned char uc, uint8_t color) return (uint16_t) uc | (uint16_t) color << 8; } +static void update_cursor() +{ + uint16_t pos = terminal_row * VGA_WIDTH + terminal_column; + outb(0x3D4, 0x0F); + outb(0x3D5, (uint8_t) (pos & 0xFF)); + outb(0x3D4, 0x0E); + outb(0x3D5, (uint8_t) ((pos >> 8) & 0xFF)); +} + void vga_init() { + outb(0x3D4, 0x0A); + outb(0x3D5, (inb(0x3D5) & 0xC0) | 14); + outb(0x3D4, 0x0B); + outb(0x3D5, (inb(0x3D5) & 0xE0) | 15); + terminal_row = 0; terminal_column = 0; terminal_color = vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK); @@ -89,5 +105,6 @@ uint32_t vga_write(vfs_node_t* node, uint32_t offset, uint32_t size, uint8_t* bu for (uint32_t i = 0; i < size; i++) { vga_putchar((char)buf[i]); } + update_cursor(); return size; } \ No newline at end of file diff --git a/kernel/syscall.c b/kernel/syscall.c index 98bb642..eaac410 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -26,7 +26,6 @@ typedef struct registers { static int32_t sys_exit(int status) { process_t* task = current_task(); task->state = STATE_DEAD; - kprintf("exiting task %d with status %d\n", task->pid, status); exit(); return 0; } diff --git a/programs/lib/rlibc.a b/programs/lib/rlibc.a index 4a07381..b58cefa 100644 Binary files a/programs/lib/rlibc.a and b/programs/lib/rlibc.a differ