2 * Dummy board with just RAM and CPU for use as an ISS.
4 * Copyright (c) 2007 CodeSourcery.
6 * This code is licensed under the GPL
10 #include "hw/boards.h"
11 #include "hw/loader.h"
13 #include "exec/address-spaces.h"
15 #define KERNEL_LOAD_ADDR 0x10000
19 static void dummy_m68k_init(QEMUMachineInitArgs
*args
)
21 ram_addr_t ram_size
= args
->ram_size
;
22 const char *cpu_model
= args
->cpu_model
;
23 const char *kernel_filename
= args
->kernel_filename
;
25 MemoryRegion
*address_space_mem
= get_system_memory();
26 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
33 env
= cpu_init(cpu_model
);
35 fprintf(stderr
, "Unable to find m68k CPU definition\n");
39 /* Initialize CPU registers. */
42 /* RAM at address zero */
43 memory_region_init_ram(ram
, "dummy_m68k.ram", ram_size
);
44 vmstate_register_ram_global(ram
);
45 memory_region_add_subregion(address_space_mem
, 0, ram
);
48 if (kernel_filename
) {
49 kernel_size
= load_elf(kernel_filename
, NULL
, NULL
, &elf_entry
,
50 NULL
, NULL
, 1, ELF_MACHINE
, 0);
52 if (kernel_size
< 0) {
53 kernel_size
= load_uimage(kernel_filename
, &entry
, NULL
, NULL
);
55 if (kernel_size
< 0) {
56 kernel_size
= load_image_targphys(kernel_filename
,
58 ram_size
- KERNEL_LOAD_ADDR
);
59 entry
= KERNEL_LOAD_ADDR
;
61 if (kernel_size
< 0) {
62 fprintf(stderr
, "qemu: could not load kernel '%s'\n",
72 static QEMUMachine dummy_m68k_machine
= {
74 .desc
= "Dummy board",
75 .init
= dummy_m68k_init
,
76 DEFAULT_MACHINE_OPTIONS
,
79 static void dummy_m68k_machine_init(void)
81 qemu_register_machine(&dummy_m68k_machine
);
84 machine_init(dummy_m68k_machine_init
);