Fix warning about unused shm_regions
[qemu/mini2440.git] / hw / dummy_m68k.c
blob7931b6dbaaa2f91f33f8eee5c02325773e6211ec
1 /*
2 * Dummy board with just RAM and CPU for use as an ISS.
4 * Copyright (c) 2007 CodeSourcery.
6 * This code is licenced under the GPL
7 */
9 #include "hw.h"
10 #include "sysemu.h"
11 #include "boards.h"
13 #define KERNEL_LOAD_ADDR 0x10000
15 /* Board init. */
17 static void dummy_m68k_init(ram_addr_t ram_size, int vga_ram_size,
18 const char *boot_device, DisplayState *ds,
19 const char *kernel_filename, const char *kernel_cmdline,
20 const char *initrd_filename, const char *cpu_model)
22 CPUState *env;
23 int kernel_size;
24 uint64_t elf_entry;
25 target_ulong entry;
27 if (!cpu_model)
28 cpu_model = "cfv4e";
29 env = cpu_init(cpu_model);
30 if (!env) {
31 fprintf(stderr, "Unable to find m68k CPU definition\n");
32 exit(1);
35 /* Initialize CPU registers. */
36 env->vbr = 0;
38 /* RAM at address zero */
39 cpu_register_physical_memory(0, ram_size,
40 qemu_ram_alloc(ram_size) | IO_MEM_RAM);
42 /* Load kernel. */
43 if (kernel_filename) {
44 kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL);
45 entry = elf_entry;
46 if (kernel_size < 0) {
47 kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL);
49 if (kernel_size < 0) {
50 kernel_size = load_image(kernel_filename,
51 phys_ram_base + KERNEL_LOAD_ADDR);
52 entry = KERNEL_LOAD_ADDR;
54 if (kernel_size < 0) {
55 fprintf(stderr, "qemu: could not load kernel '%s'\n",
56 kernel_filename);
57 exit(1);
59 } else {
60 entry = 0;
62 env->pc = entry;
65 QEMUMachine dummy_m68k_machine = {
66 .name = "dummy",
67 .desc = "Dummy board",
68 .init = dummy_m68k_init,