From 7199e74aa22e592a3b77bdd81f735edca5470596 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 20 Jan 2024 17:59:40 -0500 Subject: update --- kernel/entry.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'kernel/entry.cpp') diff --git a/kernel/entry.cpp b/kernel/entry.cpp index 8ba585f..3a42df7 100644 --- a/kernel/entry.cpp +++ b/kernel/entry.cpp @@ -3,9 +3,9 @@ #include #include #include -#include #include #include +#include "../limine/limine.h" using namespace hilbert::kernel; @@ -197,32 +197,31 @@ extern "C" [[noreturn]] void start_user_mode( terminal::init_terminal(); - storage::bd::memory initfs_bd(initfs, initfs_len); - storage::fs::tarfs_instance initfs_fs(&initfs_bd); - initfs_bd.mounted_as = &initfs_fs; + auto *initfs_bd = new storage::bd::memory(initfs, initfs_len); + auto *initfs_fs = new storage::fs::tarfs_instance(initfs_bd); + initfs_bd->mounted_as = initfs_fs; - vfile::vfile vfs_root; - vfs_root.bd = &initfs_bd; - vfs_root.dir_entry.type = storage::file_type::directory; - vfs_root.path.absolute = true; + vfile::vfile initfs_root; + initfs_root.bd = initfs_bd; + initfs_root.dir_entry.type = storage::file_type::directory; + initfs_root.path.absolute = true; - if (initfs_fs.get_root_node(vfs_root.dir_entry.node) != + if (initfs_fs->get_root_node(initfs_root.dir_entry.node) != storage::fs_result::success) print_and_halt("failed to get root node of initfs."); + vfile::set_root(initfs_root); + utility::string init_path_string("/bin/init.elf", 13); vfile::canon_path init_path; vfile::canonize_path(init_path_string, init_path); - std::optional init_file; - if (vfile::lookup_path(vfs_root, init_path, init_file) != - storage::fs_result::success) + vfile::vfile init_file; + if (vfile::lookup_path(init_path, init_file) != storage::fs_result::success) print_and_halt("failed to look up /bin/init.elf."); - if (!init_file) - print_and_halt("/bin/init.elf does not exist."); application::app_instance *init; - if (application::create_app(*init_file, init) != + if (application::create_app(init_file, init, initfs_root) != application::create_app_result::success) print_and_halt("failed to parse /bin/init.elf."); -- cgit v1.2.3