[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:
@@ -1,26 +1,17 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <j6/errors.h>
|
||||
#include <j6/syscalls.h>
|
||||
|
||||
namespace __j6libc {
|
||||
|
||||
using j6_status_t = uint64_t;
|
||||
using j6_handle_t = uint64_t;
|
||||
|
||||
constexpr j6_handle_t j6_handle_invalid = -1ull;
|
||||
constexpr j6_status_t j6_status_ok = 0;
|
||||
|
||||
static j6_handle_t core_handle = j6_handle_invalid;
|
||||
static intptr_t core_size = 0;
|
||||
|
||||
static const uintptr_t core_base = 0x1c0000000;
|
||||
static uintptr_t core_base = 0x1c0000000;
|
||||
|
||||
static const void *error_val = (void*)-1;
|
||||
|
||||
extern "C" {
|
||||
j6_status_t j6_vma_create_map(j6_handle_t *, size_t, uintptr_t, unsigned);
|
||||
j6_status_t j6_vma_resize(j6_handle_t, size_t *);
|
||||
}
|
||||
|
||||
void * increase_core(intptr_t i)
|
||||
{
|
||||
if (i == 0)
|
||||
@@ -30,7 +21,7 @@ void * increase_core(intptr_t i)
|
||||
if (i < 0)
|
||||
return (void*)-1;
|
||||
|
||||
j6_status_t result = j6_vma_create_map(&core_handle, i, core_base, 1);
|
||||
j6_status_t result = j6_vma_create_map(&core_handle, i, &core_base, 1);
|
||||
if (result != j6_status_ok)
|
||||
return (void*)-1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user