summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-01-01 21:15:42 +0200
committerAvi Kivity <avi@redhat.com>2012-01-04 13:34:49 +0200
commit1d393fa2d1c16021c840e5d37f7ff74341b7c884 (patch)
tree2209ca1ed0e7db577731df5d6390b22a53dfe524 /memory.c
parent2774c6d0ae20d32d75f77e7ed063ddbb854ca4c5 (diff)
downloadqemu-1d393fa2d1c16021c840e5d37f7ff74341b7c884.tar.gz
Avoid range comparisons on io index types
The code sometimes uses range comparisons on io indexes (e.g. index =< IO_MEM_ROM). Avoid these as they make moving to objects harder. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/memory.c b/memory.c
index 63dc3dc85c..66accba608 100644
--- a/memory.c
+++ b/memory.c
@@ -312,7 +312,8 @@ static void as_memory_range_add(AddressSpace *as, FlatRange *fr)
/* cpu_register_physical_memory_log() wants region_offset for
* mmio, but prefers offseting phys_offset for RAM. Humour it.
*/
- if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) {
+ if ((phys_offset & ~TARGET_PAGE_MASK) == IO_MEM_RAM
+ || (phys_offset & ~TARGET_PAGE_MASK) == IO_MEM_ROM) {
phys_offset += region_offset;
region_offset = 0;
}