mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-03 16:35:46 +00:00
target/sparc: Fix SPARC target initialization
Brings up the SPARC target so it's able to be used for emulation purposes.
This commit is contained in:
parent
44ca501cd3
commit
0a759bf7f3
|
@ -38,11 +38,9 @@
|
||||||
|
|
||||||
static int leon3_generic_hw_init(struct uc_struct *uc, MachineState *machine)
|
static int leon3_generic_hw_init(struct uc_struct *uc, MachineState *machine)
|
||||||
{
|
{
|
||||||
const char *cpu_type = parse_cpu_model(uc, "LEON3");
|
uc->cpu = cpu_create(uc, machine->cpu_type);
|
||||||
SPARCCPU *cpu;
|
|
||||||
|
|
||||||
uc->cpu = cpu_create(uc, cpu_type);
|
SPARCCPU *cpu = SPARC_CPU(uc, uc->cpu);
|
||||||
cpu = SPARC_CPU(uc, uc->cpu);
|
|
||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
|
fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -36,11 +36,9 @@
|
||||||
/* Sun4u hardware initialisation */
|
/* Sun4u hardware initialisation */
|
||||||
static int sun4u_init(struct uc_struct *uc, MachineState *machine)
|
static int sun4u_init(struct uc_struct *uc, MachineState *machine)
|
||||||
{
|
{
|
||||||
const char *cpu_type = parse_cpu_model(uc, "Sun UltraSparc IV");
|
uc->cpu = cpu_create(uc, machine->cpu_type);
|
||||||
SPARCCPU *cpu;
|
|
||||||
|
|
||||||
uc->cpu = cpu_create(uc, cpu_type);
|
SPARCCPU *cpu = SPARC_CPU(uc, uc->cpu);
|
||||||
cpu = SPARC_CPU(uc, uc->cpu);
|
|
||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
fprintf(stderr, "Unable to find Sparc CPU definition\n");
|
fprintf(stderr, "Unable to find Sparc CPU definition\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -869,12 +869,12 @@ static void sparc_cpu_cpudef_class_init(struct uc_struct *uc, ObjectClass *oc, v
|
||||||
static void sparc_register_cpudef_type(struct uc_struct *uc, const struct sparc_def_t *def)
|
static void sparc_register_cpudef_type(struct uc_struct *uc, const struct sparc_def_t *def)
|
||||||
{
|
{
|
||||||
char *typename = sparc_cpu_type_name(def->name);
|
char *typename = sparc_cpu_type_name(def->name);
|
||||||
TypeInfo ti = {
|
const TypeInfo ti = {
|
||||||
typename,
|
typename,
|
||||||
TYPE_SPARC_CPU,
|
TYPE_SPARC_CPU,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
NULL,
|
uc,
|
||||||
|
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -914,8 +914,7 @@ void sparc_cpu_register_types(void *opaque)
|
||||||
true,
|
true,
|
||||||
};
|
};
|
||||||
|
|
||||||
//printf(">>> sparc_cpu_register_types\n");
|
type_register(opaque, &sparc_cpu_type_info);
|
||||||
type_register_static(opaque, &sparc_cpu_type_info);
|
|
||||||
for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) {
|
for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) {
|
||||||
sparc_register_cpudef_type(opaque, &sparc_defs[i]);
|
sparc_register_cpudef_type(opaque, &sparc_defs[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5950,6 +5950,9 @@ static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
*/
|
*/
|
||||||
bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4;
|
bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4;
|
||||||
dc->base.max_insns = MIN(dc->base.max_insns, bound);
|
dc->base.max_insns = MIN(dc->base.max_insns, bound);
|
||||||
|
|
||||||
|
// Unicorn: Initialize specifics for Unicorn
|
||||||
|
dc->uc = cs->uc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sparc_tr_tb_start(DisasContextBase *db, CPUState *cs)
|
static void sparc_tr_tb_start(DisasContextBase *db, CPUState *cs)
|
||||||
|
|
Loading…
Reference in a new issue