Add translation from elf to paging flags

This commit is contained in:
Sparchatus 2022-03-23 09:27:54 +00:00
parent e682cbc0b8
commit c62530f230

View File

@ -84,10 +84,16 @@ static errval_t elf_allocate(
);
if (err_is_fail(err)) return err;
// TODO: Map into child address space
// translate elf flags to paging flags
uint32_t paging_flags = 0;
if (flags & PF_X) paging_flags |= KPI_PAGING_FLAGS_EXECUTE;
if (flags & PF_W) paging_flags |= KPI_PAGING_FLAGS_WRITE;
if (flags & PF_R) paging_flags |= KPI_PAGING_FLAGS_READ;
// Map into child address space
err = paging_map_fixed_attr(
st->paging_state, base, frame,
alloc_bytes, VREGION_FLAGS_READ_WRITE
alloc_bytes, paging_flags
);
if (err_is_fail(err)) return err;