From f45a37e7054baf06b1d691e3b2dd24c5c410bda4 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sat, 24 Apr 2021 18:23:12 +0200 Subject: [PATCH] Added MMU.get_bin_containing --- riscemu/MMU.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/riscemu/MMU.py b/riscemu/MMU.py index 5c3c735..0f2e40e 100644 --- a/riscemu/MMU.py +++ b/riscemu/MMU.py @@ -127,6 +127,12 @@ class MMU: return sec return None + def get_bin_containing(self, addr: int) -> Optional[LoadedExecutable]: + for exe in self.binaries: + if exe.base_addr <= addr < exe.base_addr + exe.size: + return exe + return None + def read_ins(self, addr: int) -> LoadedInstruction: """ Read a single instruction located at addr