diff options
author | Ian Moffett <ian@osmora.org> | 2024-04-26 16:38:41 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-04-26 16:42:51 -0400 |
commit | 6a6717b1e4f3f85a09fa48ee11e5421771995493 (patch) | |
tree | dfd891a4633bf03b14b296fd22f70c7f16485286 /sys/kern/kern_loader.c | |
parent | f5b5210cd6c6f62f012c9fd894f5e2a2bb328cb0 (diff) |
kernel: Implement basic loader_unload()
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_loader.c')
-rw-r--r-- | sys/kern/kern_loader.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/kern_loader.c b/sys/kern/kern_loader.c index e62e2b4..a7f15e5 100644 --- a/sys/kern/kern_loader.c +++ b/sys/kern/kern_loader.c @@ -53,6 +53,18 @@ __KERNEL_META("$Hyra$: kern_loader.c, Ian Marco Moffett, " #define PHDR(hdrptr, IDX) \ (void *)((uintptr_t)hdr + (hdrptr)->e_phoff + (hdrptr->e_phentsize*IDX)) +int +loader_unload(struct vas vas, struct vm_range *exec_range) +{ + size_t start, end; + + start = exec_range->start; + end = exec_range->end; + + /* FIXME: Figure out how to free physical memory too */ + return vm_map_destroy(vas, start, (end - start)); +} + int loader_load(struct vas vas, const void *dataptr, struct auxval *auxv, size_t load_base, char **ld_path, struct vm_range *prog_range) { |