static void moxiesim_init(MachineState *machine)

{

    MoxieCPU *cpu = NULL;

    ram_addr_t ram_size = machine->ram_size;

    const char *cpu_model = machine->cpu_model;

    const char *kernel_filename = machine->kernel_filename;

    const char *kernel_cmdline = machine->kernel_cmdline;

    const char *initrd_filename = machine->initrd_filename;

    CPUMoxieState *env;

    MemoryRegion *address_space_mem = get_system_memory();

    MemoryRegion *ram = g_new(MemoryRegion, 1);

    MemoryRegion *rom = g_new(MemoryRegion, 1);

    hwaddr ram_base = 0x200000;

    LoaderParams loader_params;



    /* Init CPUs. */

    if (cpu_model == NULL) {

        cpu_model = "MoxieLite-moxie-cpu";

    }

    cpu = MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, cpu_model));

    if (!cpu) {

        fprintf(stderr, "Unable to find CPU definition\n");

        exit(1);

    }

    env = &cpu->env;



    qemu_register_reset(main_cpu_reset, cpu);



    /* Allocate RAM. */

    memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fatal);

    memory_region_add_subregion(address_space_mem, ram_base, ram);



    memory_region_init_ram(rom, NULL, "moxie.rom", 128 * 0x1000, &error_fatal);

    memory_region_add_subregion(get_system_memory(), 0x1000, rom);



    if (kernel_filename) {

        loader_params.ram_size = ram_size;

        loader_params.kernel_filename = kernel_filename;

        loader_params.kernel_cmdline = kernel_cmdline;

        loader_params.initrd_filename = initrd_filename;

        load_kernel(cpu, &loader_params);

    }



    /* A single 16450 sits at offset 0x3f8.  */

    if (serial_hds[0]) {

        serial_mm_init(address_space_mem, 0x3f8, 0, env->irq[4],

                       8000000/16, serial_hds[0], DEVICE_LITTLE_ENDIAN);

    }

}

static void moxiesim_init(MachineState *machine)

{

    MoxieCPU *cpu = NULL;

    ram_addr_t ram_size = machine->ram_size;

    const char *cpu_model = machine->cpu_model;

    const char *kernel_filename = machine->kernel_filename;

    const char *kernel_cmdline = machine->kernel_cmdline;

    const char *initrd_filename = machine->initrd_filename;

    CPUMoxieState *env;

    MemoryRegion *address_space_mem = get_system_memory();

    MemoryRegion *ram = g_new(MemoryRegion, 1);

    MemoryRegion *rom = g_new(MemoryRegion, 1);

    hwaddr ram_base = 0x200000;

    LoaderParams loader_params;



    

    if (cpu_model == NULL) {

        cpu_model = "MoxieLite-moxie-cpu";

    }

    cpu = MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, cpu_model));

    if (!cpu) {

        fprintf(stderr, "Unable to find CPU definition\n");

        exit(1);

    }

    env = &cpu->env;



    qemu_register_reset(main_cpu_reset, cpu);



    

    memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fatal);

    memory_region_add_subregion(address_space_mem, ram_base, ram);



    memory_region_init_ram(rom, NULL, "moxie.rom", 128 * 0x1000, &error_fatal);

    memory_region_add_subregion(get_system_memory(), 0x1000, rom);



    if (kernel_filename) {

        loader_params.ram_size = ram_size;

        loader_params.kernel_filename = kernel_filename;

        loader_params.kernel_cmdline = kernel_cmdline;

        loader_params.initrd_filename = initrd_filename;

        load_kernel(cpu, &loader_params);

    }



    

    if (serial_hds[0]) {

        serial_mm_init(address_space_mem, 0x3f8, 0, env->irq[4],

                       8000000/16, serial_hds[0], DEVICE_LITTLE_ENDIAN);

    }

}

    if (!cpu) {         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);     if (!cpu) {         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         exit(1);         exit(1);         exit(1);         exit(1);     if (!cpu) {         exit(1);     if (!cpu) {         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);     if (!cpu) {         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         exit(1);         exit(1);     if (!cpu) {         exit(1);         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         fprintf(stderr, "Unable to find CPU definition\n");         exit(1);         exit(1);         exit(1);         exit(1);     if (!cpu) {         exit(1);     if (!cpu) {         exit(1);     if (!cpu) {         fprintf(stderr, "Unable to find CPU definition\n");
static void FUNC_0(MachineState *VAR_0)

{

    MoxieCPU *cpu = NULL;

    ram_addr_t ram_size = VAR_0->ram_size;

    const char *VAR_1 = VAR_0->VAR_1;

    const char *VAR_2 = VAR_0->VAR_2;

    const char *VAR_3 = VAR_0->VAR_3;

    const char *VAR_4 = VAR_0->VAR_4;

    CPUMoxieState *env;

    MemoryRegion *address_space_mem = get_system_memory();

    MemoryRegion *ram = g_new(MemoryRegion, 1);

    MemoryRegion *rom = g_new(MemoryRegion, 1);

    hwaddr ram_base = 0x200000;

    LoaderParams loader_params;



    

    if (VAR_1 == NULL) {

        VAR_1 = "MoxieLite-moxie-cpu";

    }

    cpu = MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, VAR_1));

    if (!cpu) {

        fprintf(stderr, "Unable to find CPU definition\n");

        exit(1);

    }

    env = &cpu->env;



    qemu_register_reset(main_cpu_reset, cpu);



    

    memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fatal);

    memory_region_add_subregion(address_space_mem, ram_base, ram);



    memory_region_init_ram(rom, NULL, "moxie.rom", 128 * 0x1000, &error_fatal);

    memory_region_add_subregion(get_system_memory(), 0x1000, rom);



    if (VAR_2) {

        loader_params.ram_size = ram_size;

        loader_params.VAR_2 = VAR_2;

        loader_params.VAR_3 = VAR_3;

        loader_params.VAR_4 = VAR_4;

        load_kernel(cpu, &loader_params);

    }



    

    if (serial_hds[0]) {

        serial_mm_init(address_space_mem, 0x3f8, 0, env->irq[4],

                       8000000/16, serial_hds[0], DEVICE_LITTLE_ENDIAN);

    }

}

static void FUNC_0(MachineState *VAR_0)
{ MoxieCPU *cpu = NULL; ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; CPUMoxieState *env; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *rom = g_new(MemoryRegion, 1); hwaddr ram_base = 0x200000; LoaderParams loader_params; if (VAR_1 == NULL) { VAR_1 = "MoxieLite-moxie-cpu"; } cpu = MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, VAR_1)); if (!cpu) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; qemu_register_reset(main_cpu_reset, cpu); memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fatal); memory_region_add_subregion(address_space_mem, ram_base, ram); memory_region_init_ram(rom, NULL, "moxie.rom", 128 * 0x1000, &error_fatal); memory_region_add_subregion(get_system_memory(), 0x1000, rom); if (VAR_2) { loader_params.ram_size = ram_size; loader_params.VAR_2 = VAR_2; loader_params.VAR_3 = VAR_3; loader_params.VAR_4 = VAR_4; load_kernel(cpu, &loader_params); } if (serial_hds[0]) { serial_mm_init(address_space_mem, 0x3f8, 0, env->irq[4],
8000000/16, serial_hds[0], DEVICE_LITTLE_ENDIAN); } }