From 1d393fa2d1c16021c840e5d37f7ff74341b7c884 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 1 Jan 2012 21:15:42 +0200 Subject: 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 Reviewed-by: Richard Henderson --- softmmu_template.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'softmmu_template.h') 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); } -- cgit v1.2.3