unicorn/qemu/hw/m68k/dummy_m68k.c
Eduardo Habkost 074865ff98
cpu: Generify CPU init functions
Backports commits 2994fd96d986578a342f2342501b4ad30f6d0a85,
701e3c78ce45fa630ffc6826c4b9a4218954bc7f, and
d1853231c60d16af78cf4d1608d043614bfbac0b from qemuu
2018-03-20 08:21:51 -04:00

51 lines
1 KiB
C

/*
* Dummy board with just RAM and CPU for use as an ISS.
*
* Copyright (c) 2007 CodeSourcery.
*
* This code is licensed under the GPL
*/
/* Unicorn Emulator Engine */
/* By Nguyen Anh Quynh, 2015 */
#include "qemu/osdep.h"
#include "cpu.h"
#include "hw/hw.h"
#include "hw/m68k/m68k.h"
#include "hw/boards.h"
#include "exec/address-spaces.h"
/* Board init. */
static int dummy_m68k_init(struct uc_struct *uc, MachineState *machine)
{
const char *cpu_model = machine->cpu_model;
CPUM68KState *env;
if (!cpu_model) {
cpu_model = "cfv4e";
}
uc->cpu = cpu_init(uc, cpu_model);
if (!uc->cpu) {
fprintf(stderr, "Unable to find m68k CPU definition\n");
return -1;
}
/* Initialize CPU registers. */
env = uc->cpu->env_ptr;
env->vbr = 0;
env->pc = 0;
return 0;
}
static void dummy_m68k_machine_init(struct uc_struct *uc, MachineClass *mc)
{
mc->init = dummy_m68k_init;
mc->is_default = 1;
mc->arch = UC_ARCH_M68K;
}
DEFINE_MACHINE("dummy", dummy_m68k_machine_init)