summaryrefslogtreecommitdiff
path: root/kernel/entry.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-01-27 23:14:29 -0500
committerBenji Dial <benji@benjidial.net>2024-01-27 23:14:29 -0500
commita8a80d326de9550b2a25b1255a2093ab43219ede (patch)
treed42a800f735caf93679d1728e2d5f20004db3b65 /kernel/entry.cpp
parent7199e74aa22e592a3b77bdd81f735edca5470596 (diff)
downloadhilbert-os-a8a80d326de9550b2a25b1255a2093ab43219ede.tar.gz
keyboard input
Diffstat (limited to 'kernel/entry.cpp')
-rw-r--r--kernel/entry.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/kernel/entry.cpp b/kernel/entry.cpp
index 3a42df7..cc74e69 100644
--- a/kernel/entry.cpp
+++ b/kernel/entry.cpp
@@ -4,6 +4,8 @@
#include <hilbert/kernel/framebuffer.hpp>
#include <hilbert/kernel/terminal.hpp>
#include <hilbert/kernel/paging.hpp>
+#include <hilbert/kernel/input.hpp>
+#include <hilbert/kernel/panic.hpp>
#include <hilbert/kernel/vfile.hpp>
#include "../limine/limine.h"
@@ -184,12 +186,6 @@ extern "C" [[noreturn]] void entry() {
}
-[[noreturn]] static void print_and_halt(const char *msg) {
- terminal::put_string_sz(msg);
- while (1)
- asm ("hlt");
-}
-
extern "C" [[noreturn]] void start_user_mode(
uint64_t rip, uint64_t rsp, uint64_t p4_paddr);
@@ -208,22 +204,25 @@ extern "C" [[noreturn]] void start_user_mode(
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.");
+ panic("failed to get root node of initfs.");
vfile::set_root(initfs_root);
+ input::init_input();
+
utility::string init_path_string("/bin/init.elf", 13);
vfile::canon_path init_path;
vfile::canonize_path(init_path_string, init_path);
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 (vfile::lookup_path(init_path, init_file, true) !=
+ storage::fs_result::success)
+ panic("failed to look up /bin/init.elf.");
application::app_instance *init;
if (application::create_app(init_file, init, initfs_root) !=
application::create_app_result::success)
- print_and_halt("failed to parse /bin/init.elf.");
+ panic("failed to parse /bin/init.elf.");
application::running_app = init;
start_user_mode(init->saved_regs.rip, init->saved_regs.rsp, init->p4_paddr);