mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 20:17:42 +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* Emulator::find_text_region(FlatPtr address)
|
||||||
{
|
{
|
||||||
MmapRegion const* matching_region = nullptr;
|
MmapRegion const* matching_region = nullptr;
|
||||||
mmu().for_each_region([&](auto& region) {
|
mmu().for_each_region_of_type<MmapRegion>([&](auto& region) {
|
||||||
if (!is<MmapRegion>(region))
|
if (!(region.is_executable() && address >= region.base() && address < region.base() + region.size()))
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
auto const& mmap_region = static_cast<MmapRegion const&>(region);
|
matching_region = ®ion;
|
||||||
if (!(mmap_region.is_executable() && address >= mmap_region.base() && address < mmap_region.base() + mmap_region.size()))
|
|
||||||
return IterationDecision::Continue;
|
|
||||||
matching_region = &mmap_region;
|
|
||||||
return IterationDecision::Break;
|
return IterationDecision::Break;
|
||||||
});
|
});
|
||||||
return matching_region;
|
return matching_region;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue