mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 21:57:55 +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,
|
||||
RAM, Genode::CACHED };
|
||||
|
||||
_translation_table.insert_translation(vaddr, paddr, size, flags,
|
||||
_table_allocator,
|
||||
!_intel_iommu.coherent_page_walk(),
|
||||
_intel_iommu.supported_page_sizes());
|
||||
auto cleanup_partial_translations = [&] () {
|
||||
_translation_table.remove_translation(vaddr, size, _table_allocator,
|
||||
!_intel_iommu.coherent_page_walk());
|
||||
};
|
||||
|
||||
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)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user