fix guarded region

This commit is contained in:
Aurel Feer 2022-04-14 15:39:35 +02:00
parent 2bebc35bd6
commit 42925eb214
2 changed files with 3 additions and 17 deletions

View File

@ -258,7 +258,7 @@ void * paging_malloc(size_t bytes, size_t * retbytes, size_t guarded_region_size
aligned_bytes = 0;
}
*retbytes = aligned_bytes;
debug_printf("[paging_malloc]: bytes = %x, aligned_bytes = %x, base = %p\n", bytes, aligned_bytes, ret);
// debug_printf("[paging_malloc]: bytes = %x, aligned_bytes = %x, base = %p, guarded_region_size = %x\n", bytes, aligned_bytes, ret, guarded_region_size);
return ret;
}
@ -693,7 +693,7 @@ errval_t paging_alloc_ext(struct paging_state *st, void **buf, size_t bytes, siz
errval_t err;
thread_mutex_lock_nested(&st->lock);
err = _paging_alloc_ext(st, buf, bytes, alignment, heap, 0);
err = _paging_alloc_ext(st, buf, bytes, alignment, heap, guarded_region_size);
thread_mutex_unlock(&st->lock);
return err;
@ -812,6 +812,7 @@ static errval_t _paging_map_fixed_attr(struct paging_state *st, lvaddr_t vaddr,
for(;vaddr_reg != NULL; vaddr_reg = vaddr_reg->next) {
// we have found the region it belongs to
if(vaddr_reg->base <= vaddr && end_vaddr <= vaddr_reg->base + vaddr_reg->size) {
// debug_printf("[paging_map_fixed_attr] found vaddr_reg!, base = %p, size = %x, guarded_region_size = %x\n", vaddr_reg->base, vaddr_reg->size, vaddr_reg->guarded_region_size);
//check if we try to map anything in the guarded region!
if (vaddr < vaddr_reg->base + vaddr_reg->guarded_region_size) {
debug_printf("[paging_map_fixed_attr] attempt to map guarded region!, vaddr = %p, guarded_region_size = %x\n", vaddr, vaddr_reg->guarded_region_size);

View File

@ -16,19 +16,4 @@ void do_test_threads(void) {
debug_printf("TEST_THREADS: spawn %u\n", i);
CHECK_ERR(spawn_load_by_name("mallocator", &(si[i]), &(pid[i])));
}
// while (true) {
// debug_printf("[do_test_threads]: processes alive: ");
// struct spawninfo* process = spawn_get_process_list();
// while (process != NULL) {
// printf("%d, ", process->pid);
// process = process->next;
// }
// printf("\n");
// //wait for 1 second but handle events in the mean time
// barrelfish_usleep(1000000);
// }
}