summaryrefslogtreecommitdiff
path: root/kernel/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/application.cpp')
-rw-r--r--kernel/application.cpp16
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;
}