diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bootloader/grub.cfg (renamed from src/kernel/grub.cfg) | 2 | ||||
-rw-r--r-- | src/bootloader/make_initrd.c (renamed from src/utils/make_initrd.c) | 2 | ||||
-rw-r--r-- | src/bootloader/test.txt | 1 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.c | 2 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.h | 2 | ||||
-rw-r--r-- | src/kernel/kernel.c | 30 | ||||
-rw-r--r-- | src/utils/test.txt | 1 |
7 files changed, 33 insertions, 7 deletions
diff --git a/src/kernel/grub.cfg b/src/bootloader/grub.cfg index 8a452ed..cb265b1 100644 --- a/src/kernel/grub.cfg +++ b/src/bootloader/grub.cfg @@ -2,6 +2,6 @@ set timeout=0 set default=0 menuentry "Melvix" { multiboot /boot/melvix.bin - set gfxpayload=640x480x32 + module /boot/melvix.initrd boot }
\ No newline at end of file diff --git a/src/utils/make_initrd.c b/src/bootloader/make_initrd.c index f6e504b..d7e0487 100644 --- a/src/utils/make_initrd.c +++ b/src/bootloader/make_initrd.c @@ -30,6 +30,8 @@ int main(char argc, char **argv) { headers[i].magic = 0xBF; } + printf(headers[1].name); + FILE *wstream = fopen("./initrd.img", "w"); unsigned char *data = (unsigned char *) malloc(off); fwrite(&nheaders, sizeof(int), 1, wstream); diff --git a/src/bootloader/test.txt b/src/bootloader/test.txt new file mode 100644 index 0000000..9033296 --- /dev/null +++ b/src/bootloader/test.txt @@ -0,0 +1 @@ +hallo
\ No newline at end of file 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/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"); diff --git a/src/utils/test.txt b/src/utils/test.txt deleted file mode 100644 index 9116450..0000000 --- a/src/utils/test.txt +++ /dev/null @@ -1 +0,0 @@ -heey |