Annotation of qemu/hw/dummy_m68k.c, revision 1.1.1.3

1.1       root        1: /*
                      2:  * Dummy board with just RAM and CPU for use as an ISS.
                      3:  *
                      4:  * Copyright (c) 2007 CodeSourcery.
                      5:  *
                      6:  * This code is licenced under the GPL
                      7:  */
                      8: 
                      9: #include "hw.h"
                     10: #include "sysemu.h"
                     11: #include "boards.h"
                     12: 
                     13: #define KERNEL_LOAD_ADDR 0x10000
                     14: 
                     15: /* Board init.  */
                     16: 
1.1.1.3 ! root       17: static void dummy_m68k_init(ram_addr_t ram_size,
1.1.1.2   root       18:                      const char *boot_device,
1.1       root       19:                      const char *kernel_filename, const char *kernel_cmdline,
                     20:                      const char *initrd_filename, const char *cpu_model)
                     21: {
                     22:     CPUState *env;
                     23:     int kernel_size;
                     24:     uint64_t elf_entry;
                     25:     target_ulong entry;
                     26: 
                     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);
                     33:     }
                     34: 
                     35:     /* Initialize CPU registers.  */
                     36:     env->vbr = 0;
                     37: 
                     38:     /* RAM at address zero */
                     39:     cpu_register_physical_memory(0, ram_size,
                     40:         qemu_ram_alloc(ram_size) | IO_MEM_RAM);
                     41: 
                     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) {
1.1.1.2   root       47:             kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL);
1.1       root       48:         }
                     49:         if (kernel_size < 0) {
1.1.1.3 ! root       50:             kernel_size = load_image_targphys(kernel_filename,
        !            51:                                               KERNEL_LOAD_ADDR,
        !            52:                                               ram_size - KERNEL_LOAD_ADDR);
1.1       root       53:             entry = KERNEL_LOAD_ADDR;
                     54:         }
                     55:         if (kernel_size < 0) {
                     56:             fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     57:                     kernel_filename);
                     58:             exit(1);
                     59:         }
                     60:     } else {
                     61:         entry = 0;
                     62:     }
                     63:     env->pc = entry;
                     64: }
                     65: 
1.1.1.3 ! root       66: static QEMUMachine dummy_m68k_machine = {
1.1.1.2   root       67:     .name = "dummy",
                     68:     .desc = "Dummy board",
                     69:     .init = dummy_m68k_init,
1.1       root       70: };
1.1.1.3 ! root       71: 
        !            72: static void dummy_m68k_machine_init(void)
        !            73: {
        !            74:     qemu_register_machine(&dummy_m68k_machine);
        !            75: }
        !            76: 
        !            77: machine_init(dummy_m68k_machine_init);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.