2015-08-21 07:04:50 +00:00
|
|
|
/*
|
|
|
|
* 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 */
|
|
|
|
|
2018-02-24 06:23:15 +00:00
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#include "cpu.h"
|
2015-08-21 07:04:50 +00:00
|
|
|
#include "hw/hw.h"
|
|
|
|
#include "hw/m68k/m68k.h"
|
|
|
|
#include "hw/boards.h"
|
|
|
|
#include "exec/address-spaces.h"
|
|
|
|
|
|
|
|
/* Board init. */
|
2015-11-11 17:43:41 +00:00
|
|
|
static int dummy_m68k_init(struct uc_struct *uc, MachineState *machine)
|
2015-08-21 07:04:50 +00:00
|
|
|
{
|
|
|
|
const char *cpu_model = machine->cpu_model;
|
|
|
|
CPUM68KState *env;
|
|
|
|
|
2018-03-20 11:17:30 +00:00
|
|
|
if (!cpu_model) {
|
2015-08-21 07:04:50 +00:00
|
|
|
cpu_model = "cfv4e";
|
2018-03-20 11:17:30 +00:00
|
|
|
}
|
2015-08-21 07:04:50 +00:00
|
|
|
|
2018-03-20 11:17:30 +00:00
|
|
|
uc->cpu = cpu_init(uc, cpu_model);
|
|
|
|
if (!uc->cpu) {
|
2015-08-21 07:04:50 +00:00
|
|
|
fprintf(stderr, "Unable to find m68k CPU definition\n");
|
2015-11-11 17:43:41 +00:00
|
|
|
return -1;
|
2015-08-21 07:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize CPU registers. */
|
2018-03-20 11:17:30 +00:00
|
|
|
env = uc->cpu->env_ptr;
|
2015-08-21 07:04:50 +00:00
|
|
|
env->vbr = 0;
|
|
|
|
env->pc = 0;
|
2015-11-11 17:43:41 +00:00
|
|
|
|
|
|
|
return 0;
|
2015-08-21 07:04:50 +00:00
|
|
|
}
|
|
|
|
|
2018-03-11 18:49:09 +00:00
|
|
|
static void dummy_m68k_machine_init(struct uc_struct *uc, MachineClass *mc)
|
2015-08-21 07:04:50 +00:00
|
|
|
{
|
2018-03-11 18:49:09 +00:00
|
|
|
mc->init = dummy_m68k_init;
|
|
|
|
mc->is_default = 1;
|
|
|
|
mc->arch = UC_ARCH_M68K;
|
2015-08-21 07:04:50 +00:00
|
|
|
}
|
2018-03-11 18:49:09 +00:00
|
|
|
|
|
|
|
DEFINE_MACHINE("dummy", dummy_m68k_machine_init)
|