diff options
Diffstat (limited to 'kernel/entry.cpp')
-rw-r--r-- | kernel/entry.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
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 <hilbert/kernel/application.hpp> #include <hilbert/kernel/framebuffer.hpp> #include <hilbert/kernel/terminal.hpp> -#include <hilbert/kernel/limine.hpp> #include <hilbert/kernel/paging.hpp> #include <hilbert/kernel/vfile.hpp> +#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<vfile::vfile> 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."); |