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>
This commit is contained in:
Avi Kivity 2012-01-01 21:15:42 +02:00
parent 2774c6d0ae
commit 1d393fa2d1
4 changed files with 27 additions and 21 deletions

View file

@ -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;
}