mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
hw: error message on unmap on broken RM clients
In the past, unmap sometimes occured on RM clients that have no thread, PD, or translation table assigned. However, this shouldn't be the case anymore. Fixes #504
This commit is contained in:
parent
657646e76e
commit
d312f840bd
@ -31,21 +31,29 @@ using namespace Genode;
|
|||||||
|
|
||||||
void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
|
void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
|
||||||
{
|
{
|
||||||
/* remove mapping from the translation table of the thread that we serve */
|
/* determine and lock PD */
|
||||||
Platform_thread * const pt = (Platform_thread *)badge();
|
Platform_thread * const pt = (Platform_thread *)badge();
|
||||||
if (!pt || !pt->pd()) return;
|
if (!pt) {
|
||||||
|
PERR("failed to get thread of RM client");
|
||||||
Lock::Guard guard(*pt->pd()->lock());
|
|
||||||
|
|
||||||
Translation_table * const tt = pt->pd()->translation_table();
|
|
||||||
if (!tt) {
|
|
||||||
PWRN("failed to get translation table of RM client");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tt->remove_translation(virt_base, size,pt->pd()->page_slab());
|
Platform_pd * const pd = pt->pd();
|
||||||
|
if (!pd) {
|
||||||
|
PERR("failed to get PD of RM client");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Lock::Guard guard(*pd->lock());
|
||||||
|
|
||||||
/* update translation caches of all CPUs */
|
/* update translation table of the PD */
|
||||||
Kernel::update_pd(pt->pd()->id());
|
Translation_table * const tt = pd->translation_table();
|
||||||
|
if (!tt) {
|
||||||
|
PERR("failed to get translation table of RM client");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tt->remove_translation(virt_base, size, pd->page_slab());
|
||||||
|
|
||||||
|
/* update translation caches */
|
||||||
|
Kernel::update_pd(pd->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user