Bugfix Allow other threads to continue even if one fails paging
This commit is contained in:
parent
cd53dfd7f3
commit
5c6d186a3c
@ -126,29 +126,35 @@ static void pt_exception_handler(enum exception_type type, int subtype,
|
|||||||
}
|
}
|
||||||
if (vaddr_reg == NULL) {
|
if (vaddr_reg == NULL) {
|
||||||
debug_printf("[pt_exception_handler] page_addr = 0x%x\n", page_addr);
|
debug_printf("[pt_exception_handler] page_addr = 0x%x\n", page_addr);
|
||||||
|
thread_mutex_unlock(&st->lock);
|
||||||
USER_PANIC("[pt_exception_handler][ERROR] Page fault ouside valid virtual address space");
|
USER_PANIC("[pt_exception_handler][ERROR] Page fault ouside valid virtual address space");
|
||||||
}
|
}
|
||||||
if (vaddr_reg->free) {
|
if (vaddr_reg->free) {
|
||||||
debug_printf("[pt_exception_handler] page_addr = 0x%x, base = 0x%x, size = 0x%x\n", page_addr, vaddr_reg->base, vaddr_reg->size);
|
debug_printf("[pt_exception_handler] page_addr = 0x%x, base = 0x%x, size = 0x%x\n", page_addr, vaddr_reg->base, vaddr_reg->size);
|
||||||
|
thread_mutex_unlock(&st->lock);
|
||||||
USER_PANIC("[pt_exception_handler][ERROR] Page fault ouside allocated address space");
|
USER_PANIC("[pt_exception_handler][ERROR] Page fault ouside allocated address space");
|
||||||
}
|
}
|
||||||
if (!vaddr_reg->heap) {
|
if (!vaddr_reg->heap) {
|
||||||
|
thread_mutex_unlock(&st->lock);
|
||||||
USER_PANIC("[ERROR] Page fault in allocated address space but outside heap");
|
USER_PANIC("[ERROR] Page fault in allocated address space but outside heap");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_mapped(st, page_addr)) {
|
if (is_mapped(st, page_addr)) {
|
||||||
// Page has already been mapped by another thread before we took the lock.
|
// Page has already been mapped by another thread before we took the lock.
|
||||||
|
thread_mutex_unlock(&st->lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct capref frame;
|
struct capref frame;
|
||||||
err = frame_alloc(&frame, BASE_PAGE_SIZE, NULL);
|
err = frame_alloc(&frame, BASE_PAGE_SIZE, NULL);
|
||||||
if (err_is_fail(err)) {
|
if (err_is_fail(err)) {
|
||||||
|
thread_mutex_unlock(&st->lock);
|
||||||
USER_PANIC_ERR(err, "Failed to allocate frame in page fault handler");
|
USER_PANIC_ERR(err, "Failed to allocate frame in page fault handler");
|
||||||
}
|
}
|
||||||
|
|
||||||
err = _paging_map_fixed_attr(st, page_addr, frame, BASE_PAGE_SIZE, VREGION_FLAGS_READ_WRITE);
|
err = _paging_map_fixed_attr(st, page_addr, frame, BASE_PAGE_SIZE, VREGION_FLAGS_READ_WRITE);
|
||||||
if (err_is_fail(err)) {
|
if (err_is_fail(err)) {
|
||||||
|
thread_mutex_unlock(&st->lock);
|
||||||
USER_PANIC_ERR(err, "Failed to map frame in page fault handler");
|
USER_PANIC_ERR(err, "Failed to map frame in page fault handler");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user