diff options
| author | DrChat <arkolbed@gmail.com> | 2018-02-09 19:23:24 -0600 |
|---|---|---|
| committer | DrChat <arkolbed@gmail.com> | 2018-02-09 19:23:24 -0600 |
| commit | a1677d34e15c081c403c0b5fef3df8dc35c2c87f (patch) | |
| tree | 1aa823b0de70db45517ca09f9cc8dffc2e04b4fa | |
| parent | 45ba1d0bf3abc31d97e12c02808fef5ef09e732e (diff) | |
[CPU] MMIOHandler IsRangeWatched now returns true if the entire range is watched.
| -rw-r--r-- | src/xenia/cpu/mmio_handler.cc | 16 | ||||
| -rw-r--r-- | src/xenia/cpu/mmio_handler.h | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/xenia/cpu/mmio_handler.cc b/src/xenia/cpu/mmio_handler.cc index f12cb65d9..33bdaf889 100644 --- a/src/xenia/cpu/mmio_handler.cc +++ b/src/xenia/cpu/mmio_handler.cc @@ -240,12 +240,20 @@ bool MMIOHandler::IsRangeWatched(uint32_t physical_address, size_t length) { for (auto it = access_watches_.begin(); it != access_watches_.end(); ++it) { auto entry = *it; if ((entry->address <= physical_address && - entry->address + entry->length > physical_address) || - (entry->address >= physical_address && - entry->address < physical_address + length)) { - // This watch lies within the range. + entry->address + entry->length > physical_address + length)) { + // This range lies entirely within this watch. return true; } + + // TODO(DrChat): Check if the range is partially covered, and subtract the + // covered portion if it is. + if ((entry->address <= physical_address && + entry->address + entry->length > physical_address)) { + // The beginning of range lies partially within this watch. + } else if ((entry->address < physical_address + length && + entry->address + entry->length > physical_address + length)) { + // The ending of this range lies partially within this watch. + } } return false; diff --git a/src/xenia/cpu/mmio_handler.h b/src/xenia/cpu/mmio_handler.h index e68a2e276..e61cd1c20 100644 --- a/src/xenia/cpu/mmio_handler.h +++ b/src/xenia/cpu/mmio_handler.h @@ -77,7 +77,7 @@ class MMIOHandler { // Fires and clears any access watches that overlap this range. void InvalidateRange(uint32_t physical_address, size_t length); - // Returns true if /any/ part of this range is watched. + // Returns true if /all/ of this range is watched. bool IsRangeWatched(uint32_t physical_address, size_t length); protected: |
