aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/load.c
diff options
context:
space:
mode:
authorMarvin Borner2021-03-12 17:27:01 +0100
committerMarvin Borner2021-03-12 17:27:01 +0100
commit0aef683b9d1e08555791426ba12223ed78051353 (patch)
tree324cbc61b7fb38f648a82041656f5fea48e53856 /kernel/features/load.c
parentf1751c121d48f2d8936c72bdc347777d1e7402d9 (diff)
Boots successfully...
Diffstat (limited to 'kernel/features/load.c')
-rw-r--r--kernel/features/load.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/kernel/features/load.c b/kernel/features/load.c
index ec9a387..4ad2cbf 100644
--- a/kernel/features/load.c
+++ b/kernel/features/load.c
@@ -8,25 +8,16 @@
#define PROC_STACK_SIZE 0x4000
-/*void proc_load(struct proc *proc, u32 entry)
-{
- u32 stack = (u32)memory_alloc(proc->page_dir, PROC_STACK_SIZE, MEMORY_USER | MEMORY_CLEAR);
-
- proc->regs.ebp = stack;
- proc->regs.useresp = stack;
- proc->regs.eip = entry;
- proc->entry = entry;
-}*/
-
int bin_load(const char *path, struct proc *proc)
{
struct stat s = { 0 };
vfs_stat(path, &s);
- struct proc *current = proc_current();
- struct page_dir *prev = current ? current->page_dir : virtual_kernel_dir();
- u32 size = PAGE_ALIGN_UP(s.size);
+ struct page_dir *prev;
+ memory_backup_dir(&prev);
memory_switch_dir(proc->page_dir);
+
+ u32 size = PAGE_ALIGN_UP(s.size);
u32 data = (u32)memory_alloc(proc->page_dir, size, MEMORY_USER | MEMORY_CLEAR);
if (!vfs_read(path, (void *)data, 0, s.size)) {