From ffb7cb87593a5de58f7c5183020576dac9d50fc4 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 16 May 2020 00:42:04 +0200 Subject: Non-dynamic working approach --- src/kernel/fs/elf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/kernel/fs/elf.c') diff --git a/src/kernel/fs/elf.c b/src/kernel/fs/elf.c index a67ab6a..ba9251a 100644 --- a/src/kernel/fs/elf.c +++ b/src/kernel/fs/elf.c @@ -25,6 +25,12 @@ int is_elf(struct elf_header *header) struct process *elf_load(char *path) { + u32 *prev_dir; + if (current_proc) + prev_dir = current_proc->cr3; + else + prev_dir = current_page_directory; + u8 *file = read_file(path); if (!file) { warn("File or directory not found: %s", path); @@ -71,6 +77,6 @@ struct process *elf_load(char *path) } } - paging_switch_directory(paging_kernel_directory); + paging_switch_directory(prev_dir); return proc; -} \ No newline at end of file +} -- cgit v1.2.3