aboutsummaryrefslogtreecommitdiff
path: root/softmmu_template.h
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 /softmmu_template.h
parent2774c6d0ae20d32d75f77e7ed063ddbb854ca4c5 (diff)
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 'softmmu_template.h')
-rw-r--r--softmmu_template.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/softmmu_template.h b/softmmu_template.h
index a030b5f05e..726744c814 100644
--- a/softmmu_template.h
+++ b/softmmu_template.h
@@ -65,7 +65,8 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr,
index = (physaddr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
env->mem_io_pc = (unsigned long)retaddr;
- if (index > (IO_MEM_NOTDIRTY >> IO_MEM_SHIFT)
+ if (index != IO_MEM_RAM && index != IO_MEM_ROM
+ && index != IO_MEM_UNASSIGNED && index != IO_MEM_NOTDIRTY
&& !can_do_io(env)) {
cpu_io_recompile(env, retaddr);
}
@@ -207,7 +208,8 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr,
int index;
index = (physaddr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
- if (index > (IO_MEM_NOTDIRTY >> IO_MEM_SHIFT)
+ if (index != IO_MEM_RAM && index != IO_MEM_ROM
+ && index != IO_MEM_UNASSIGNED && index != IO_MEM_NOTDIRTY
&& !can_do_io(env)) {
cpu_io_recompile(env, retaddr);
}