Store mapping size in page table metadata
This commit is contained in:
parent
10371dc78f
commit
2dd4f8d45f
@ -45,6 +45,8 @@ struct pt_t {
|
||||
struct capref cap_pt;
|
||||
// capref that maps this page table in the higher level page table
|
||||
struct capref cap_mapping;
|
||||
// store number of slots that were mapped to be able to unmap later
|
||||
size_t mapping_size;
|
||||
|
||||
// NOTE rueegges: points to an array with pointers for every potential next level page table
|
||||
// it is NULL for mapping a frame instead of a page table
|
||||
|
||||
@ -641,9 +641,7 @@ errval_t paging_map_fixed_attr(struct paging_state *st, lvaddr_t vaddr,
|
||||
vaddr_reg = vaddr_reg->next;
|
||||
// we have found the region it belongs to
|
||||
if(vaddr_reg->base <= vaddr && vaddr + bytes <= vaddr_reg->base + vaddr_reg->size) {
|
||||
if (vaddr_reg->size >= bytes && vaddr_reg->free == 0) {
|
||||
// this region was probably allocated with paging_alloc beforehand and that is ok
|
||||
} else {
|
||||
if (vaddr_reg->free == true) {
|
||||
// make sure the virtual memory is not used by anyone else
|
||||
err = paging_insert_vaddr_reg(st, vaddr_reg, vaddr - vaddr_reg->base, bytes);
|
||||
if (err_is_fail(err)) {
|
||||
@ -660,9 +658,7 @@ errval_t paging_map_fixed_attr(struct paging_state *st, lvaddr_t vaddr,
|
||||
|
||||
// debug_printf("DEBUG rueegges: paging_map_fixed_attr(%p, 0x%lx, cap, %lu, %d)\n", st, vaddr, bytes, flags);
|
||||
|
||||
// TODO rueegges: nicefy simple fix for mapping over multiple l3?
|
||||
// TODO rueegges: cleanup partially completed mapping?
|
||||
|
||||
size_t mapping_size;
|
||||
for(lvaddr_t current_vaddr = vaddr; current_vaddr < vaddr + bytes; current_vaddr += mapping_size * BASE_PAGE_SIZE) {
|
||||
capaddr_t l0_index = VMSAv8_64_L0_INDEX(current_vaddr);
|
||||
@ -717,6 +713,7 @@ errval_t paging_map_fixed_attr(struct paging_state *st, lvaddr_t vaddr,
|
||||
|
||||
// set to null to indicate it is a frame mapping and not a page table mapping
|
||||
pt_entry->children = NULL;
|
||||
pt_entry->mapping_size = mapping_size;
|
||||
// allocate the new mapping
|
||||
err = st->slot_alloc->alloc(st->slot_alloc, &pt_entry->cap_mapping);
|
||||
if (err_is_fail(err)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user