From 7d5a9792e57b4088cce5cc97837eb04016b57a4d Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 31 Oct 2019 00:49:00 +0100 Subject: Implemented basic syscalls and user mode Doesn't completely work right now --- src/kernel/fs/initrd.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/kernel/fs/initrd.c') diff --git a/src/kernel/fs/initrd.c b/src/kernel/fs/initrd.c index 906498e..acaceb8 100644 --- a/src/kernel/fs/initrd.c +++ b/src/kernel/fs/initrd.c @@ -4,6 +4,7 @@ #include #include #include +#include initrd_header_t *initrd_header; initrd_file_header_t *file_headers; @@ -103,3 +104,28 @@ fs_node_t *initialise_initrd(uint32_t location) { } return initrd_root; } + +void initrd_test() { + 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++; + } +} \ No newline at end of file -- cgit v1.2.3