nova: avoid endless loop in core

Issue #2547
This commit is contained in:
Alexander Boettcher 2017-12-13 15:47:17 +01:00 committed by Christian Helmuth
parent 675aa2cd2f
commit 77bbe87dc8
1 changed files with 12 additions and 6 deletions

View File

@ -45,8 +45,10 @@ void Pd_session_component::map(addr_t virt, addr_t size)
addr_t region_offset) -> addr_t
{
Dataspace_component * dsc = region ? region->dataspace() : nullptr;
if (!dsc)
return ~0UL;
if (!dsc) {
struct No_dataspace{};
throw No_dataspace();
}
Mapping mapping = Region_map_component::create_map_item(region_map,
region,
@ -87,9 +89,13 @@ void Pd_session_component::map(addr_t virt, addr_t size)
return mapped;
};
while (size) {
addr_t mapped = _address_space.apply_to_dataspace(virt, lambda);
virt += mapped;
size = size < mapped ? size : size - mapped;
try {
while (size) {
addr_t mapped = _address_space.apply_to_dataspace(virt, lambda);
virt += mapped;
size = size < mapped ? size : size - mapped;
}
} catch (...) {
error(__func__, " failed ", Hex(virt), "+", Hex(size));
}
}