A couple possible issues with mem.c, in alloc_page:
-The address of the start of the page is calculated by page_mem = (void *)((page - all_pages_array) * PAGE_SIZE);, however page_t has size 4 bytes, so page_mem is 4x too big as each entry in all_pages_array is 4 bytes.
-In allocating a page, you do not check if the page is part of the MMIO region, so a program could start writing data here erroneously.
Sorry if these aren't issues or I'm wrong about indexing into all_pages_array, I'm fairly new to this.
A couple possible issues with mem.c, in
alloc_page:-The address of the start of the page is calculated by
page_mem = (void *)((page - all_pages_array) * PAGE_SIZE);, however page_t has size 4 bytes, sopage_memis 4x too big as each entry inall_pages_arrayis 4 bytes.-In allocating a page, you do not check if the page is part of the MMIO region, so a program could start writing data here erroneously.
Sorry if these aren't issues or I'm wrong about indexing into all_pages_array, I'm fairly new to this.