base-nova: 'Rm_client::unmap()' fix

Areas of an attached dataspace which have never been accessed cannot get
unmapped. With this patch this case is not treated as error anymore.

Fixes #398.
This commit is contained in:
Christian Prochaska 2012-10-09 20:47:02 +02:00 committed by Norman Feske
parent 837f913094
commit 330980378c
1 changed files with 20 additions and 12 deletions

View File

@ -35,20 +35,28 @@ void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
Nova::Mem_crd crd(core_local_base >> 12, 32, rwx);
Nova::lookup(crd);
if (crd.is_null()) {
PERR("Invalid unmap at local: %08lx virt: %08lx",
core_local_base, core_local_base + core_to_virt);
return;
if (!crd.is_null()) {
if (verbose)
PINF("Unmapping local: %08lx virt: %08lx base: %lx order: %lx size: %lx is null: %d",
core_local_base, core_local_base + core_to_virt, crd.base(), crd.order(),
(0x1000UL << crd.order()), crd.is_null());
unmap_local(crd, false);
core_local_base = (crd.base() << 12) /* base address of mapping */
+ (0x1000 << crd.order()); /* size of mapping */
} else {
/* This can happen if the region has never been touched */
if (verbose)
PINF("Nothing mapped at local: %08lx virt: %08lx",
core_local_base, core_local_base + core_to_virt);
core_local_base += 0x1000;
}
if (verbose)
PINF("Lookup core_addr: %08lx base: %lx order: %lx is null %d", core_local_base, crd.base(), crd.order(), crd.is_null());
unmap_local(crd, false);
core_local_base = (crd.base() << 12) /* base address of mapping */
+ (0x1000 << crd.order()); /* size of mapping */
if (core_local_base > core_local_end)
return;
}