Commit e9179ce1a07ff8699fae89dc1cd87efc3dd80c9d

Authored by Avi Kivity
Committed by Anthony Liguori
1 parent 1eed09cb

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>
Showing 1 changed file with 21 additions and 26 deletions
... ... @@ -3029,32 +3029,6 @@ static int get_free_io_mem_idx(void)
3029 3029 return -1;
3030 3030 }
3031 3031  
3032   -static int cpu_register_io_memory_fixed(int io_index,
3033   - CPUReadMemoryFunc **mem_read,
3034   - CPUWriteMemoryFunc **mem_write,
3035   - void *opaque);
3036   -
3037   -static void io_mem_init(void)
3038   -{
3039   - int i;
3040   -
3041   - cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read, unassigned_mem_write, NULL);
3042   - cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read, unassigned_mem_write, NULL);
3043   - cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read, notdirty_mem_write, NULL);
3044   - for (i=0; i<5; i++)
3045   - io_mem_used[i] = 1;
3046   -
3047   - io_mem_watch = cpu_register_io_memory(watch_mem_read,
3048   - watch_mem_write, NULL);
3049   -#ifdef CONFIG_KQEMU
3050   - if (kqemu_phys_ram_base) {
3051   - /* alloc dirty bits array */
3052   - phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS);
3053   - memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS);
3054   - }
3055   -#endif
3056   -}
3057   -
3058 3032 /* mem_read and mem_write are arrays of functions containing the
3059 3033 function to access byte (index 0), word (index 1) and dword (index
3060 3034 2). Functions can be omitted with a NULL function pointer.
... ... @@ -3109,6 +3083,27 @@ void cpu_unregister_io_memory(int io_table_address)
3109 3083 io_mem_used[io_index] = 0;
3110 3084 }
3111 3085  
  3086 +static void io_mem_init(void)
  3087 +{
  3088 + int i;
  3089 +
  3090 + cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read, unassigned_mem_write, NULL);
  3091 + cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read, unassigned_mem_write, NULL);
  3092 + cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read, notdirty_mem_write, NULL);
  3093 + for (i=0; i<5; i++)
  3094 + io_mem_used[i] = 1;
  3095 +
  3096 + io_mem_watch = cpu_register_io_memory(watch_mem_read,
  3097 + watch_mem_write, NULL);
  3098 +#ifdef CONFIG_KQEMU
  3099 + if (kqemu_phys_ram_base) {
  3100 + /* alloc dirty bits array */
  3101 + phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS);
  3102 + memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS);
  3103 + }
  3104 +#endif
  3105 +}
  3106 +
3112 3107 #endif /* !defined(CONFIG_USER_ONLY) */
3113 3108  
3114 3109 /* physical memory access (slow version, mainly for debug) */
... ...