mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-11 11:51:46 +00:00
platform/pc: remove translations after Out_of_ram
Since page tables might need to be allocated during insert_translation(), Out_of_ram or Out_of_caps exceptions might occur. Entries that have already been added by insert_translation() must thus be removed once one of those exceptions occurred. Fixes #5254
This commit is contained in:
parent
a83d7d515d
commit
09c40688e1
@ -74,10 +74,23 @@ void Intel::Io_mmu::Domain<TABLE>::add_range(Range const & range,
|
|||||||
Page_flags flags { RW, NO_EXEC, USER, NO_GLOBAL,
|
Page_flags flags { RW, NO_EXEC, USER, NO_GLOBAL,
|
||||||
RAM, Genode::CACHED };
|
RAM, Genode::CACHED };
|
||||||
|
|
||||||
_translation_table.insert_translation(vaddr, paddr, size, flags,
|
auto cleanup_partial_translations = [&] () {
|
||||||
_table_allocator,
|
_translation_table.remove_translation(vaddr, size, _table_allocator,
|
||||||
!_intel_iommu.coherent_page_walk(),
|
!_intel_iommu.coherent_page_walk());
|
||||||
_intel_iommu.supported_page_sizes());
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
_translation_table.insert_translation(vaddr, paddr, size, flags,
|
||||||
|
_table_allocator,
|
||||||
|
!_intel_iommu.coherent_page_walk(),
|
||||||
|
_intel_iommu.supported_page_sizes());
|
||||||
|
} catch (Out_of_ram) {
|
||||||
|
cleanup_partial_translations();
|
||||||
|
throw;
|
||||||
|
} catch (Out_of_caps) {
|
||||||
|
cleanup_partial_translations();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
if (_skip_invalidation)
|
if (_skip_invalidation)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user