Rearrange io_mem_init()

Move io_mem_init() downwards to avoid a forward declaration.  No code change.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Avi Kivity 2009-06-14 11:38:52 +03:00 committed by Anthony Liguori
parent 1eed09cb4a
commit e9179ce1a0

47
exec.c
View File

@ -3029,32 +3029,6 @@ static int get_free_io_mem_idx(void)
return -1; return -1;
} }
static int cpu_register_io_memory_fixed(int io_index,
CPUReadMemoryFunc **mem_read,
CPUWriteMemoryFunc **mem_write,
void *opaque);
static void io_mem_init(void)
{
int i;
cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read, unassigned_mem_write, NULL);
cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read, unassigned_mem_write, NULL);
cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read, notdirty_mem_write, NULL);
for (i=0; i<5; i++)
io_mem_used[i] = 1;
io_mem_watch = cpu_register_io_memory(watch_mem_read,
watch_mem_write, NULL);
#ifdef CONFIG_KQEMU
if (kqemu_phys_ram_base) {
/* alloc dirty bits array */
phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS);
memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS);
}
#endif
}
/* mem_read and mem_write are arrays of functions containing the /* mem_read and mem_write are arrays of functions containing the
function to access byte (index 0), word (index 1) and dword (index function to access byte (index 0), word (index 1) and dword (index
2). Functions can be omitted with a NULL function pointer. 2). Functions can be omitted with a NULL function pointer.
@ -3109,6 +3083,27 @@ void cpu_unregister_io_memory(int io_table_address)
io_mem_used[io_index] = 0; io_mem_used[io_index] = 0;
} }
static void io_mem_init(void)
{
int i;
cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read, unassigned_mem_write, NULL);
cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read, unassigned_mem_write, NULL);
cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read, notdirty_mem_write, NULL);
for (i=0; i<5; i++)
io_mem_used[i] = 1;
io_mem_watch = cpu_register_io_memory(watch_mem_read,
watch_mem_write, NULL);
#ifdef CONFIG_KQEMU
if (kqemu_phys_ram_base) {
/* alloc dirty bits array */
phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS);
memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS);
}
#endif
}
#endif /* !defined(CONFIG_USER_ONLY) */ #endif /* !defined(CONFIG_USER_ONLY) */
/* physical memory access (slow version, mainly for debug) */ /* physical memory access (slow version, mainly for debug) */