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