got the screen cleared, vga cursor moving, looking good
This commit is contained in:
@@ -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
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
#include <lib/stream.h>
|
||||
|
||||
#include "vga.h"
|
||||
#include <drivers/vga/vga.h>
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user