Implement freeing ressource on uAS destroy
This commit is contained in:
parent
37f5040d54
commit
9ff45cb497
@ -127,12 +127,21 @@ int uAddrSpaceDelete(struct uAddrSpace *addr)
|
||||
struct uAddrVirtualReg *reg;
|
||||
|
||||
list_collapse_named(addr->listVirtualReg, reg, nextInAddrSpace, prevInAddrSpace) {
|
||||
// TODO Implement me with real ressources
|
||||
assertmsg(reg->res == NULL, "Unsupported mapper ressource");
|
||||
// This is memory allocated for the heap just unmap it to free it
|
||||
pr_devel("Freeing heap 0x%lx for process %s\n", reg->addr, processGetName(addr->process));
|
||||
pageUnmap(reg->addr);
|
||||
free(reg);
|
||||
if (reg->res == NULL) {
|
||||
// This is memory allocated for the heap just unmap it to free it
|
||||
pr_devel("Freeing heap 0x%lx for process %s\n", reg->addr,
|
||||
processGetName(addr->process));
|
||||
pageUnmap(reg->addr);
|
||||
free(reg);
|
||||
} else {
|
||||
if(reg->res->ops){
|
||||
if(reg->res->ops->unmap)
|
||||
reg->res->ops->unmap(reg, reg->addr, reg->size);
|
||||
if(reg->res->ops->close)
|
||||
reg->res->ops->close(reg);
|
||||
}
|
||||
free(reg);
|
||||
}
|
||||
}
|
||||
return mmuContextUnref(addr->ctx);
|
||||
}
|
||||
@ -387,7 +396,7 @@ int uAddrSpaceSolvePageFault(struct uAddrSpace *as, vaddr_t faultAddr, int isWri
|
||||
return -EFAULT;
|
||||
|
||||
if (isWriteAccess && !(reg->right & PAGING_MEM_WRITE))
|
||||
return -EFAULT;
|
||||
return -EACCES;
|
||||
|
||||
if (isWriteAccess)
|
||||
rights |= PAGING_MEM_WRITE;
|
||||
|
Loading…
Reference in New Issue
Block a user