diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/graphics/vesa.c | 2 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.h | 2 | ||||
-rw-r--r-- | src/kernel/grub.cfg | 7 | ||||
-rw-r--r-- | src/kernel/kernel.c | 30 |
4 files changed, 29 insertions, 12 deletions
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index 94f53c6..3f8a9ba 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -287,6 +287,8 @@ void vesa_draw_char(char ch) { } else if (ch == '\n') { terminal_x = 0; terminal_y += font_height + 2; + } else if (ch == '\t') { + terminal_x += 4 * (font_width + 2); } if (terminal_x >= vbe_width) { diff --git a/src/kernel/graphics/vesa.h b/src/kernel/graphics/vesa.h index 649c6ee..748f8d0 100644 --- a/src/kernel/graphics/vesa.h +++ b/src/kernel/graphics/vesa.h @@ -128,6 +128,8 @@ void vesa_clear(); */ void vesa_set_font(int height); +void vesa_draw_char(char ch); + /** * Draw a char from keyboard * @param ch The character diff --git a/src/kernel/grub.cfg b/src/kernel/grub.cfg deleted file mode 100644 index 8a452ed..0000000 --- a/src/kernel/grub.cfg +++ /dev/null @@ -1,7 +0,0 @@ -set timeout=0 -set default=0 -menuentry "Melvix" { - multiboot /boot/melvix.bin - set gfxpayload=640x480x32 - boot -}
\ No newline at end of file diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index cba4f6e..dd49949 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -30,16 +30,36 @@ void init() { void kernel_main(struct multiboot *mboot_ptr) { init(); - info("Kernel size in KiB: "); - vesa_draw_number((int) end >> 10); - assert(mboot_ptr->mods_count > 0); uint32_t initrd_location = *((uint32_t *) mboot_ptr->mods_addr); uint32_t initrd_end = *(uint32_t *) (mboot_ptr->mods_addr + 4); - // Don't trample our module with placement accesses, please! - // placement_address = initrd_end; + paging_set_used(0, (initrd_end >> 12) + 1); + fs_root = initialise_initrd(initrd_location); + int i = 0; + struct dirent *node = 0; + vesa_draw_string("\n"); + while ((node = readdir_fs(fs_root, i)) != 0) { + vesa_draw_string("Found file: "); + vesa_draw_string(node->name); + vesa_draw_string("\n"); + fs_node_t *fsnode = finddir_fs(fs_root, node->name); + + if ((fsnode->flags & 0x7) == FS_DIRECTORY) + vesa_draw_string("\t (directory)\n"); + else { + vesa_draw_string("\t contents: \""); + uint8_t buf[fsnode->length]; + uint32_t sz = read_fs(fsnode, 0, fsnode->length, buf); + for (uint32_t j = 0; j < sz; j++) + vesa_draw_char(buf[j]); + + vesa_draw_string("\"\n"); + } + i++; + } + // asm volatile ("div %0" :: "r"(0)); // Exception testing x/0 loop: asm volatile ("hlt"); |