diff options
author | Benji Dial <benji@benjidial.net> | 2024-01-20 17:59:40 -0500 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-01-20 17:59:40 -0500 |
commit | 7199e74aa22e592a3b77bdd81f735edca5470596 (patch) | |
tree | 66e935372acc5d6e013f764965f2a9d81814f809 /kernel/application.cpp | |
parent | 53135e2592c21cb9b2609bf95242aaf1f19233da (diff) | |
download | hilbert-os-7199e74aa22e592a3b77bdd81f735edca5470596.tar.gz |
update
Diffstat (limited to 'kernel/application.cpp')
-rw-r--r-- | kernel/application.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/application.cpp b/kernel/application.cpp index ed8795b..af31a09 100644 --- a/kernel/application.cpp +++ b/kernel/application.cpp @@ -72,6 +72,15 @@ namespace hilbert::kernel::application { } + bool app_instance::is_page_owned(uint64_t vaddr) { + uint64_t i = ((vaddr / 4096) / 512) / 512; + uint64_t j = ((vaddr / 4096) / 512) % 512; + uint64_t k = (vaddr / 4096) % 512; + return + i < 512 && p1s[i] != 0 && p1s[i][j] != 0 && + p1s[i][j][k] != 0 && p1es_to_free_on_exit[i][j][k]; + } + uint64_t app_instance::get_free_vaddr_pages(uint64_t count) { uint64_t start = 0x200000 / 4096; uint64_t length = 0; @@ -129,7 +138,10 @@ namespace hilbert::kernel::application { bool executable; }; - create_app_result create_app(const vfile::vfile &file, app_instance *&out) { + create_app_result create_app( + const vfile::vfile &file, app_instance *&out, + const vfile::vfile &working_dir + ) { uint8_t magic[16]; if (file.dir_entry.length < 64) @@ -259,6 +271,8 @@ namespace hilbert::kernel::application { out->saved_regs.rsp = 0x1ff000; out->saved_regs.rip = entry_point; + out->working_dir = working_dir; + return create_app_result::success; } |