[kernel] Change VMA syscall addr param to inout

This change allows the `vma_map` and `vma_create_map` syscalls to map to
addresses other than the one specified, and therefore makes the address
parameter to those syscalls `inout` in order to return the mapped
address.

Also add the `exact` flag for specifying that mapping needs to be done
at the exact address given. If the mapping collides with another, the
new `j6_err_collision` error is returned.
This commit is contained in:
Justin C. Miller
2023-08-31 19:40:02 -07:00
parent 8cbde13139
commit fc16ed54b3
16 changed files with 93 additions and 69 deletions

View File

@@ -10,7 +10,6 @@
static uint64_t initfs_running = 1;
static constexpr size_t buffer_size = 2048;
static constexpr uintptr_t load_addr = 0xf00000000;
j6_status_t
handle_load_request(j6romfs::fs &fs, const char *path, j6_handle_t &vma)
@@ -21,7 +20,8 @@ handle_load_request(j6romfs::fs &fs, const char *path, j6_handle_t &vma)
return j6_status_ok;
}
j6_vma_create_map(&vma, in->size, load_addr, j6_vm_flag_write);
uintptr_t load_addr = 0;
j6_vma_create_map(&vma, in->size, &load_addr, j6_vm_flag_write);
util::buffer dest = util::buffer::from(load_addr, in->size);
fs.load_inode_data(in, dest);
j6_vma_unmap(vma, 0);