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:
Lioncash 2018-09-03 17:23:54 -04:00
parent 44ca501cd3
commit 0a759bf7f3
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
4 changed files with 10 additions and 12 deletions

View File

@ -38,11 +38,9 @@
static int leon3_generic_hw_init(struct uc_struct *uc, MachineState *machine)
{
const char *cpu_type = parse_cpu_model(uc, "LEON3");
SPARCCPU *cpu;
uc->cpu = cpu_create(uc, machine->cpu_type);
uc->cpu = cpu_create(uc, cpu_type);
cpu = SPARC_CPU(uc, uc->cpu);
SPARCCPU *cpu = SPARC_CPU(uc, uc->cpu);
if (cpu == NULL) {
fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
return -1;

View File

@ -36,11 +36,9 @@
/* Sun4u hardware initialisation */
static int sun4u_init(struct uc_struct *uc, MachineState *machine)
{
const char *cpu_type = parse_cpu_model(uc, "Sun UltraSparc IV");
SPARCCPU *cpu;
uc->cpu = cpu_create(uc, machine->cpu_type);
uc->cpu = cpu_create(uc, cpu_type);
cpu = SPARC_CPU(uc, uc->cpu);
SPARCCPU *cpu = SPARC_CPU(uc, uc->cpu);
if (cpu == NULL) {
fprintf(stderr, "Unable to find Sparc CPU definition\n");
return -1;

View File

@ -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)
{
char *typename = sparc_cpu_type_name(def->name);
TypeInfo ti = {
const TypeInfo ti = {
typename,
TYPE_SPARC_CPU,
0,
0,
NULL,
uc,
NULL,
NULL,
@ -914,8 +914,7 @@ void sparc_cpu_register_types(void *opaque)
true,
};
//printf(">>> sparc_cpu_register_types\n");
type_register_static(opaque, &sparc_cpu_type_info);
type_register(opaque, &sparc_cpu_type_info);
for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) {
sparc_register_cpudef_type(opaque, &sparc_defs[i]);
}

View File

@ -5950,6 +5950,9 @@ static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
*/
bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4;
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)