mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
UserspaceEmulator: Use for_each_region_of_type
in find_text_region
Since we now have this helper template, we can make our code cleaner.
This commit is contained in:
parent
c1d6637dc7
commit
e9dd9d1f2c
1 changed files with 3 additions and 6 deletions
|
@ -378,13 +378,10 @@ Vector<FlatPtr> Emulator::raw_backtrace()
|
|||
MmapRegion const* Emulator::find_text_region(FlatPtr address)
|
||||
{
|
||||
MmapRegion const* matching_region = nullptr;
|
||||
mmu().for_each_region([&](auto& region) {
|
||||
if (!is<MmapRegion>(region))
|
||||
mmu().for_each_region_of_type<MmapRegion>([&](auto& region) {
|
||||
if (!(region.is_executable() && address >= region.base() && address < region.base() + region.size()))
|
||||
return IterationDecision::Continue;
|
||||
auto const& mmap_region = static_cast<MmapRegion const&>(region);
|
||||
if (!(mmap_region.is_executable() && address >= mmap_region.base() && address < mmap_region.base() + mmap_region.size()))
|
||||
return IterationDecision::Continue;
|
||||
matching_region = &mmap_region;
|
||||
matching_region = ®ion;
|
||||
return IterationDecision::Break;
|
||||
});
|
||||
return matching_region;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue