summaryrefslogtreecommitdiff
path: root/kernel/source/entry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/source/entry.cpp')
-rw-r--r--kernel/source/entry.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/kernel/source/entry.cpp b/kernel/source/entry.cpp
index 5db3515..2389bb1 100644
--- a/kernel/source/entry.cpp
+++ b/kernel/source/entry.cpp
@@ -2,6 +2,7 @@
#include <hilbert/kernel/storage/fs/tarfs.hpp>
#include <hilbert/kernel/application.hpp>
#include <hilbert/kernel/framebuffer.hpp>
+#include <hilbert/kernel/load-app.hpp>
#include <hilbert/kernel/paging.hpp>
#include <hilbert/kernel/serial.hpp>
#include <hilbert/kernel/input.hpp>
@@ -201,25 +202,29 @@ extern "C" [[noreturn]] void entry() {
vfile::canonize_path(init_path_string, init_path);
vfile::vfile init_file;
- if (vfile::lookup_path(init_path, init_file, true) !=
+ if (vfile::look_up_path(init_path, init_file, true) !=
storage::fs_result::success)
panic(0x7e874d);
- application::process *init_process;
- application::thread *init_thread;
- if (application::create_application(init_file, init_process, init_thread) !=
- application::stream_result::success)
+ app_memory *init_memory = new app_memory();
+ uint64_t init_entry_point;
+ load_app_result load_init_result =
+ load_app(init_file, *init_memory, init_entry_point);
+
+ if (load_init_result != load_app_result::success)
panic(0xc39db3);
- init_process->environment.add_end({
- .a = utility::string("ARGC", 4),
- .b = utility::string("1", 1)});
- init_process->environment.add_end({
- .a = utility::string("ARGV0", 5),
- .b = utility::string("/bin/init", 9)});
+ application::process *init_process = new application::process(init_memory);
+ init_process->add_environment_variable(
+ utility::string("ARGC", 4), utility::string("1", 1));
+ init_process->add_environment_variable(
+ utility::string("ARGV0", 5), utility::string("/bin/init", 9));
+ application::add_process(init_process);
- init_thread->state = application::thread_state::paused;
+ application::thread *init_thread =
+ new application::thread(init_process, init_entry_point);
+ init_process->add_thread(init_thread);
application::paused_threads->insert(init_thread);
- application::resume_next();
+ application::resume_next_thread();
}