提交 2a8e7499 编写于 作者: P Paolo Bonzini

exec: eliminate io_mem_ram

It is never used, the IOTLB always goes through io_mem_notdirty.

In fact in softmmu_template.h, if it were, QEMU would crash just
below the tests, as soon as io_mem_read/write dispatches to
error_mem_read/write.
Reviewed-by: NRichard Henderson <rth@twiddle.net>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 6a4e1771
...@@ -66,7 +66,7 @@ AddressSpace address_space_io; ...@@ -66,7 +66,7 @@ AddressSpace address_space_io;
AddressSpace address_space_memory; AddressSpace address_space_memory;
DMAContext dma_context_memory; DMAContext dma_context_memory;
MemoryRegion io_mem_ram, io_mem_rom, io_mem_unassigned, io_mem_notdirty; MemoryRegion io_mem_rom, io_mem_unassigned, io_mem_notdirty;
static MemoryRegion io_mem_subpage_ram; static MemoryRegion io_mem_subpage_ram;
#endif #endif
...@@ -200,8 +200,7 @@ MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index) ...@@ -200,8 +200,7 @@ MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index)
bool memory_region_is_unassigned(MemoryRegion *mr) bool memory_region_is_unassigned(MemoryRegion *mr)
{ {
return mr != &io_mem_ram && mr != &io_mem_rom return mr != &io_mem_rom && mr != &io_mem_notdirty && !mr->rom_device
&& mr != &io_mem_notdirty && !mr->rom_device
&& mr != &io_mem_watch; && mr != &io_mem_watch;
} }
#endif #endif
...@@ -1419,18 +1418,6 @@ static uint64_t error_mem_read(void *opaque, hwaddr addr, ...@@ -1419,18 +1418,6 @@ static uint64_t error_mem_read(void *opaque, hwaddr addr,
abort(); abort();
} }
static void error_mem_write(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
abort();
}
static const MemoryRegionOps error_mem_ops = {
.read = error_mem_read,
.write = error_mem_write,
.endianness = DEVICE_NATIVE_ENDIAN,
};
static const MemoryRegionOps rom_mem_ops = { static const MemoryRegionOps rom_mem_ops = {
.read = error_mem_read, .read = error_mem_read,
.write = unassigned_mem_write, .write = unassigned_mem_write,
...@@ -1691,7 +1678,6 @@ MemoryRegion *iotlb_to_region(hwaddr index) ...@@ -1691,7 +1678,6 @@ MemoryRegion *iotlb_to_region(hwaddr index)
static void io_mem_init(void) static void io_mem_init(void)
{ {
memory_region_init_io(&io_mem_ram, &error_mem_ops, NULL, "ram", UINT64_MAX);
memory_region_init_io(&io_mem_rom, &rom_mem_ops, NULL, "rom", UINT64_MAX); memory_region_init_io(&io_mem_rom, &rom_mem_ops, NULL, "rom", UINT64_MAX);
memory_region_init_io(&io_mem_unassigned, &unassigned_mem_ops, NULL, memory_region_init_io(&io_mem_unassigned, &unassigned_mem_ops, NULL,
"unassigned", UINT64_MAX); "unassigned", UINT64_MAX);
......
...@@ -110,7 +110,6 @@ void stq_phys(hwaddr addr, uint64_t val); ...@@ -110,7 +110,6 @@ void stq_phys(hwaddr addr, uint64_t val);
void cpu_physical_memory_write_rom(hwaddr addr, void cpu_physical_memory_write_rom(hwaddr addr,
const uint8_t *buf, int len); const uint8_t *buf, int len);
extern struct MemoryRegion io_mem_ram;
extern struct MemoryRegion io_mem_rom; extern struct MemoryRegion io_mem_rom;
extern struct MemoryRegion io_mem_unassigned; extern struct MemoryRegion io_mem_unassigned;
extern struct MemoryRegion io_mem_notdirty; extern struct MemoryRegion io_mem_notdirty;
......
...@@ -68,7 +68,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, ...@@ -68,7 +68,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env,
physaddr = (physaddr & TARGET_PAGE_MASK) + addr; physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
env->mem_io_pc = retaddr; env->mem_io_pc = retaddr;
if (mr != &io_mem_ram && mr != &io_mem_rom if (mr != &io_mem_rom
&& mr != &io_mem_unassigned && mr != &io_mem_unassigned
&& mr != &io_mem_notdirty && mr != &io_mem_notdirty
&& !can_do_io(env)) { && !can_do_io(env)) {
...@@ -218,7 +218,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env, ...@@ -218,7 +218,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env,
MemoryRegion *mr = iotlb_to_region(physaddr); MemoryRegion *mr = iotlb_to_region(physaddr);
physaddr = (physaddr & TARGET_PAGE_MASK) + addr; physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
if (mr != &io_mem_ram && mr != &io_mem_rom if (mr != &io_mem_rom
&& mr != &io_mem_unassigned && mr != &io_mem_unassigned
&& mr != &io_mem_notdirty && mr != &io_mem_notdirty
&& !can_do_io(env)) { && !can_do_io(env)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册