diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/arch/amd64/driver/fsroot.c | 23 | ||||
-rw-r--r-- | src/kernel/arch/amd64/tty/tty.c | 6 | ||||
-rw-r--r-- | src/kernel/arch/amd64/tty/tty.h | 3 | ||||
-rw-r--r-- | src/kernel/arch/amd64/tty/vga.c | 33 |
4 files changed, 1 insertions, 64 deletions
diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c index e0f5e77..512b7da 100644 --- a/src/kernel/arch/amd64/driver/fsroot.c +++ b/src/kernel/arch/amd64/driver/fsroot.c @@ -11,7 +11,6 @@ enum { HANDLE_ROOT, - HANDLE_VGA, HANDLE_ATA_ROOT, HANDLE_ATA, _SKIP = HANDLE_ATA + 4, @@ -40,8 +39,6 @@ static int handle(struct vfs_request *req) { switch (req->type) { case VFSOP_OPEN: if (exacteq(req, "/")) return HANDLE_ROOT; - if (exacteq(req, "/vga")) return HANDLE_VGA; - if (exacteq(req, "/ata/")) return HANDLE_ATA_ROOT; if (exacteq(req, "/ata/0")) return ata_available(0) ? HANDLE_ATA+0 : -1; @@ -60,15 +57,12 @@ static int handle(struct vfs_request *req) { // TODO document directory read format // TODO don't hardcode const char src[] = - "vga\0" "com1\0" "ps2\0" "ata/\0" "video/"; return req_readcopy(req, src, sizeof src); } - case HANDLE_VGA: - return req_readcopy(req, (void*)0xB8000, 80*25*2); case HANDLE_ATA_ROOT: { char list[8] = {}; size_t len = 0; @@ -92,23 +86,6 @@ static int handle(struct vfs_request *req) { default: panic_invalid_state(); } - case VFSOP_WRITE: - switch (id) { - case HANDLE_VGA: { - void *vga = (void*)0xB8000; - if (req->flags) - return -1; - fs_normslice(&req->offset, &req->input.len, 80*25*2, false); - if (!virt_cpy_from(req->caller->pages, vga + req->offset, - req->input.buf, req->input.len)) - { - return -EFAULT; - } - return req->input.len; - } - default: return -1; - } - case VFSOP_CLOSE: return 0; diff --git a/src/kernel/arch/amd64/tty/tty.c b/src/kernel/arch/amd64/tty/tty.c index fcd4675..6730800 100644 --- a/src/kernel/arch/amd64/tty/tty.c +++ b/src/kernel/arch/amd64/tty/tty.c @@ -4,15 +4,11 @@ #include <shared/printf.h> void tty_init(void) { - vga_clear(); serial_preinit(); - - vga_write("\x03 ", 2); // cp437 heart serial_write("<3 ", 3); } -static void backend(void __attribute__((unused)) *arg, const char *buf, size_t len) { - vga_write(buf, len); +static void backend(void __attribute__((unused)) *arg, const char *buf, size_t len) { serial_write(buf, len); } diff --git a/src/kernel/arch/amd64/tty/tty.h b/src/kernel/arch/amd64/tty/tty.h index b96003d..a8f594c 100644 --- a/src/kernel/arch/amd64/tty/tty.h +++ b/src/kernel/arch/amd64/tty/tty.h @@ -1,7 +1,4 @@ #pragma once #include <stddef.h> -void vga_write(const char *buf, size_t len); -void vga_clear(void); - void tty_init(void); diff --git a/src/kernel/arch/amd64/tty/vga.c b/src/kernel/arch/amd64/tty/vga.c deleted file mode 100644 index e5f2274..0000000 --- a/src/kernel/arch/amd64/tty/vga.c +++ /dev/null @@ -1,33 +0,0 @@ -#include <kernel/arch/amd64/tty/tty.h> - -struct vga_cell { - unsigned char c; - unsigned char style; -} __attribute__((__packed__)); - -static const size_t vga_len = 80 * 25; -static struct vga_cell *vga = (void*) 0xB8000; -static size_t vga_pos = 0; - -static void vga_scroll(void) { - for (size_t i = 0; i < vga_len - 80; i++) - vga[i] = vga[i + 80]; - vga_pos -= 80; -} - -static void vga_putchar(char c) { - if (vga_pos >= vga_len - 80) - vga_scroll(); - vga[vga_pos++].c = c; -} - -void vga_write(const char *buf, size_t len) { - for (size_t i = 0; i < len; i++) - vga_putchar(buf[i]); -} - -void vga_clear(void) { - for (size_t i = 0; i < vga_len; i++) - vga[i].c = ' '; - vga_pos = 0; -} |