mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 03:11:09 +00:00
target/arm: Set instance_align on CPUARM TypeInfo
Fix alignment of CPUARMState.vfp.zregs. Backports d03087bda4ba17076b430fd2af083020d7c5112a
This commit is contained in:
parent
86dd30850d
commit
cdf40f7ff6
23
qemu/accel.c
23
qemu/accel.c
|
@ -48,25 +48,20 @@ static int tcg_init(MachineState *ms)
|
|||
}
|
||||
|
||||
static const TypeInfo accel_type = {
|
||||
TYPE_ACCEL,
|
||||
TYPE_OBJECT,
|
||||
sizeof(AccelClass),
|
||||
sizeof(AccelState),
|
||||
.name = TYPE_ACCEL,
|
||||
.parent = TYPE_OBJECT,
|
||||
.class_size = sizeof(AccelClass),
|
||||
.instance_size = sizeof(AccelState),
|
||||
};
|
||||
|
||||
#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg")
|
||||
|
||||
static const TypeInfo tcg_accel_type = {
|
||||
TYPE_TCG_ACCEL,
|
||||
TYPE_ACCEL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
tcg_accel_class_init,
|
||||
.name = TYPE_TCG_ACCEL,
|
||||
.parent = TYPE_ACCEL,
|
||||
.class_size = 0,
|
||||
.instance_size = 0,
|
||||
.class_init = tcg_accel_class_init,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -142,20 +142,14 @@ static void virt_class_init(struct uc_struct *uc, ObjectClass *oc, void *data)
|
|||
}
|
||||
|
||||
static const TypeInfo machvirt_info = {
|
||||
TYPE_VIRT_MACHINE,
|
||||
TYPE_MACHINE,
|
||||
.name = TYPE_VIRT_MACHINE,
|
||||
.parent = TYPE_MACHINE,
|
||||
|
||||
sizeof(VirtMachineClass),
|
||||
sizeof(VirtMachineState),
|
||||
NULL,
|
||||
.class_size = sizeof(VirtMachineClass),
|
||||
.instance_size = sizeof(VirtMachineState),
|
||||
|
||||
virt_instance_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
|
||||
virt_class_init,
|
||||
.instance_init = virt_instance_init,
|
||||
.class_init = virt_class_init,
|
||||
};
|
||||
|
||||
void machvirt_machine_init(struct uc_struct *uc)
|
||||
|
|
|
@ -42,24 +42,19 @@ static void machine_finalize(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
}
|
||||
|
||||
static const TypeInfo machine_info = {
|
||||
TYPE_MACHINE,
|
||||
TYPE_OBJECT,
|
||||
.name = TYPE_MACHINE,
|
||||
.parent = TYPE_OBJECT,
|
||||
|
||||
sizeof(MachineClass),
|
||||
sizeof(MachineState),
|
||||
NULL,
|
||||
.class_size = sizeof(MachineClass),
|
||||
.instance_size = sizeof(MachineState),
|
||||
|
||||
machine_initfn,
|
||||
NULL,
|
||||
machine_finalize,
|
||||
.instance_init = machine_initfn,
|
||||
.instance_finalize = machine_finalize,
|
||||
|
||||
NULL,
|
||||
.class_base_init = machine_class_base_init,
|
||||
.class_finalize = machine_class_finalize,
|
||||
|
||||
NULL,
|
||||
machine_class_base_init,
|
||||
machine_class_finalize,
|
||||
|
||||
true,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
void machine_register_types(struct uc_struct *uc)
|
||||
|
|
|
@ -290,24 +290,20 @@ Object *qdev_get_machine(struct uc_struct *uc)
|
|||
}
|
||||
|
||||
static const TypeInfo device_type_info = {
|
||||
TYPE_DEVICE,
|
||||
TYPE_OBJECT,
|
||||
.name = TYPE_DEVICE,
|
||||
.parent = TYPE_OBJECT,
|
||||
|
||||
sizeof(DeviceClass),
|
||||
sizeof(DeviceState),
|
||||
NULL,
|
||||
.class_size = sizeof(DeviceClass),
|
||||
.instance_size = sizeof(DeviceState),
|
||||
|
||||
device_initfn,
|
||||
device_post_init,
|
||||
device_finalize,
|
||||
.instance_init = device_initfn,
|
||||
.instance_post_init = device_post_init,
|
||||
.instance_finalize = device_finalize,
|
||||
|
||||
NULL,
|
||||
.class_init = device_class_init,
|
||||
.class_base_init = device_class_base_init,
|
||||
|
||||
device_class_init,
|
||||
device_class_base_init,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static void qbus_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||
|
@ -327,24 +323,17 @@ static void qbus_finalize(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
}
|
||||
|
||||
static const TypeInfo bus_info = {
|
||||
TYPE_BUS,
|
||||
TYPE_OBJECT,
|
||||
.name = TYPE_BUS,
|
||||
.parent = TYPE_OBJECT,
|
||||
|
||||
sizeof(BusClass),
|
||||
sizeof(BusState),
|
||||
NULL,
|
||||
.class_size = sizeof(BusClass),
|
||||
.instance_size = sizeof(BusState),
|
||||
|
||||
qbus_initfn,
|
||||
NULL,
|
||||
qbus_finalize,
|
||||
.instance_init = qbus_initfn,
|
||||
.instance_finalize = qbus_finalize,
|
||||
|
||||
NULL,
|
||||
|
||||
bus_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
.class_init = bus_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
void qdev_register_types(struct uc_struct *uc)
|
||||
|
|
|
@ -144,27 +144,16 @@ static void pc_machine_class_init(struct uc_struct *uc, ObjectClass *oc, void *d
|
|||
}
|
||||
|
||||
static const TypeInfo pc_machine_info = {
|
||||
TYPE_PC_MACHINE,
|
||||
TYPE_MACHINE,
|
||||
.name = TYPE_PC_MACHINE,
|
||||
.parent = TYPE_MACHINE,
|
||||
|
||||
sizeof(PCMachineClass),
|
||||
sizeof(PCMachineState),
|
||||
NULL,
|
||||
.class_size = sizeof(PCMachineClass),
|
||||
.instance_size = sizeof(PCMachineState),
|
||||
|
||||
pc_machine_initfn,
|
||||
NULL,
|
||||
NULL,
|
||||
.instance_init = pc_machine_initfn,
|
||||
.class_init = pc_machine_class_init,
|
||||
|
||||
NULL,
|
||||
|
||||
pc_machine_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
.abstract = true,
|
||||
|
||||
// should this be added somehow?
|
||||
//.interfaces = (InterfaceInfo[]) { { } },
|
||||
|
|
|
@ -210,20 +210,13 @@ static void apic_class_init(struct uc_struct *uc, ObjectClass *klass, void *data
|
|||
}
|
||||
|
||||
static const TypeInfo apic_info = {
|
||||
"apic",
|
||||
TYPE_APIC_COMMON,
|
||||
.name = "apic",
|
||||
.parent = TYPE_APIC_COMMON,
|
||||
|
||||
0,
|
||||
sizeof(APICCommonState),
|
||||
NULL,
|
||||
.class_size = 0,
|
||||
.instance_size = sizeof(APICCommonState),
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
|
||||
apic_class_init,
|
||||
.class_init = apic_class_init,
|
||||
};
|
||||
|
||||
void apic_register_types(struct uc_struct *uc)
|
||||
|
|
|
@ -242,28 +242,18 @@ static void apic_common_class_init(struct uc_struct *uc, ObjectClass *klass, voi
|
|||
* x86_cpu_apic_create()
|
||||
*/
|
||||
dc->cannot_instantiate_with_device_add_yet = true;
|
||||
//printf("... init apic common class\n");
|
||||
}
|
||||
|
||||
static const TypeInfo apic_common_type = {
|
||||
TYPE_APIC_COMMON,
|
||||
TYPE_DEVICE,
|
||||
.name = TYPE_APIC_COMMON,
|
||||
.parent = TYPE_DEVICE,
|
||||
|
||||
sizeof(APICCommonClass),
|
||||
sizeof(APICCommonState),
|
||||
NULL,
|
||||
.class_size = sizeof(APICCommonClass),
|
||||
.instance_size = sizeof(APICCommonState),
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
.class_init = apic_common_class_init,
|
||||
|
||||
NULL,
|
||||
|
||||
apic_common_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
void apic_common_register_types(struct uc_struct *uc)
|
||||
|
|
|
@ -59,20 +59,9 @@ static void sun4u_class_init(struct uc_struct *uc, ObjectClass *oc, void *data)
|
|||
}
|
||||
|
||||
static const TypeInfo sun4u_type = {
|
||||
MACHINE_TYPE_NAME("sun4u"),
|
||||
TYPE_MACHINE,
|
||||
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
|
||||
sun4u_class_init,
|
||||
.name = MACHINE_TYPE_NAME("sun4u"),
|
||||
.parent = TYPE_MACHINE,
|
||||
.class_init = sun4u_class_init,
|
||||
};
|
||||
|
||||
void sun4u_machine_init(struct uc_struct *uc)
|
||||
|
|
|
@ -124,16 +124,9 @@ struct MachineState {
|
|||
machine_initfn(uc, mc); \
|
||||
} \
|
||||
static const TypeInfo machine_initfn##_typeinfo = { \
|
||||
MACHINE_TYPE_NAME(namestr), \
|
||||
TYPE_MACHINE, \
|
||||
0, \
|
||||
0, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
machine_initfn##_class_init, \
|
||||
.name = MACHINE_TYPE_NAME(namestr), \
|
||||
.parent = TYPE_MACHINE, \
|
||||
.class_init = machine_initfn##_class_init, \
|
||||
}; \
|
||||
void machine_initfn##_register_types(struct uc_struct *uc) \
|
||||
{ \
|
||||
|
|
|
@ -58,16 +58,9 @@ void x86_cpu_register_types(struct uc_struct *uc);
|
|||
mc->arch = UC_ARCH_X86; \
|
||||
} \
|
||||
static const TypeInfo pc_machine_type_##suffix = { \
|
||||
namestr TYPE_MACHINE_SUFFIX, \
|
||||
TYPE_PC_MACHINE, \
|
||||
0, \
|
||||
0, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
pc_machine_##suffix##_class_init, \
|
||||
.name = namestr TYPE_MACHINE_SUFFIX, \
|
||||
.parent = TYPE_PC_MACHINE, \
|
||||
.class_init = pc_machine_##suffix##_class_init, \
|
||||
}; \
|
||||
void pc_machine_init_##suffix(struct uc_struct *uc); \
|
||||
void pc_machine_init_##suffix(struct uc_struct *uc) \
|
||||
|
|
|
@ -2029,16 +2029,14 @@ struct MemoryRegionList {
|
|||
typedef QTAILQ_HEAD(queue, MemoryRegionList) MemoryRegionListHead;
|
||||
|
||||
static const TypeInfo memory_region_info = {
|
||||
TYPE_MEMORY_REGION,
|
||||
TYPE_OBJECT,
|
||||
.name = TYPE_MEMORY_REGION,
|
||||
.parent = TYPE_OBJECT,
|
||||
|
||||
0,
|
||||
sizeof(MemoryRegion),
|
||||
NULL,
|
||||
.class_size = 0,
|
||||
.instance_size = sizeof(MemoryRegion),
|
||||
|
||||
memory_region_initfn,
|
||||
NULL,
|
||||
memory_region_finalize,
|
||||
.instance_init = memory_region_initfn,
|
||||
.instance_finalize = memory_region_finalize,
|
||||
};
|
||||
|
||||
void memory_register_types(struct uc_struct *uc)
|
||||
|
|
|
@ -308,24 +308,18 @@ static void cpu_class_init(struct uc_struct *uc, ObjectClass *klass, void *data)
|
|||
}
|
||||
|
||||
static const TypeInfo cpu_type_info = {
|
||||
TYPE_CPU,
|
||||
TYPE_DEVICE,
|
||||
.name = TYPE_CPU,
|
||||
.parent = TYPE_DEVICE,
|
||||
|
||||
sizeof(CPUClass),
|
||||
sizeof(CPUState),
|
||||
NULL,
|
||||
.class_size = sizeof(CPUClass),
|
||||
.instance_size = sizeof(CPUState),
|
||||
|
||||
cpu_common_initfn,
|
||||
NULL,
|
||||
cpu_common_finalize,
|
||||
.instance_init = cpu_common_initfn,
|
||||
.instance_finalize = cpu_common_finalize,
|
||||
|
||||
NULL,
|
||||
.class_init = cpu_class_init,
|
||||
|
||||
cpu_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
void cpu_register_types(struct uc_struct *uc)
|
||||
|
|
|
@ -2012,45 +2012,18 @@ static void object_class_init(struct uc_struct *uc, ObjectClass *klass, void *op
|
|||
void register_types_object(struct uc_struct *uc)
|
||||
{
|
||||
static TypeInfo interface_info = {
|
||||
TYPE_INTERFACE, // name
|
||||
NULL,
|
||||
|
||||
sizeof(InterfaceClass), // class_size
|
||||
0,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true, // abstract
|
||||
.name = TYPE_INTERFACE,
|
||||
.class_size = sizeof(InterfaceClass),
|
||||
.instance_size = 0,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static TypeInfo object_info = {
|
||||
TYPE_OBJECT,
|
||||
NULL,
|
||||
|
||||
0,
|
||||
sizeof(Object),
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
|
||||
object_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
.name = TYPE_OBJECT,
|
||||
.class_size = 0,
|
||||
.instance_size = sizeof(Object),
|
||||
.class_init = object_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
uc->type_interface = type_register_internal(uc, &interface_info);
|
||||
|
|
|
@ -2074,6 +2074,7 @@ void arm_cpu_register(struct uc_struct *uc, const ARMCPUInfo *info)
|
|||
TypeInfo type_info = {
|
||||
.parent = TYPE_ARM_CPU,
|
||||
.instance_size = sizeof(ARMCPU),
|
||||
.instance_align = __alignof__(ARMCPU),
|
||||
.instance_init = info->initfn,
|
||||
.class_size = sizeof(ARMCPUClass),
|
||||
.class_init = info->class_init,
|
||||
|
@ -2094,6 +2095,7 @@ void arm_cpu_register_types(void *opaque)
|
|||
arm_cpu_type_info.parent = TYPE_CPU,
|
||||
arm_cpu_type_info.instance_userdata = opaque,
|
||||
arm_cpu_type_info.instance_size = sizeof(ARMCPU),
|
||||
arm_cpu_type_info.instance_align = __alignof__(ARMCPU),
|
||||
arm_cpu_type_info.instance_init = arm_cpu_initfn,
|
||||
arm_cpu_type_info.instance_post_init = arm_cpu_post_init,
|
||||
arm_cpu_type_info.instance_finalize = arm_cpu_finalizefn,
|
||||
|
|
Loading…
Reference in a new issue