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

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