target-i386: Add x86_cpu_unrealizefn()

First remove VCPU from exec loop and only then remove lapic.

Backports commit c884776e9dc947105827bd6c22192863f97267d2 from qemu
This commit is contained in:
Igor Mammedov 2018-02-25 20:51:31 -05:00 committed by Lioncash
parent 298b0e6529
commit d30410dc9a
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
3 changed files with 20 additions and 3 deletions

View File

@ -213,7 +213,7 @@ static int device_set_realized(struct uc_struct *uc, Object *obj, bool value, Er
}
if (dc->unrealize) {
local_errp = local_err ? NULL : &local_err;
dc->unrealize(dev, local_errp);
dc->unrealize(uc, dev, local_errp);
}
dev->pending_deleted_event = true;
}
@ -233,7 +233,7 @@ child_realize_fail:
post_realize_fail:
if (dc->unrealize) {
dc->unrealize(dev, NULL);
dc->unrealize(uc, dev, NULL);
}
fail:

View File

@ -32,7 +32,7 @@ typedef int (*qdev_initfn)(DeviceState *dev);
typedef int (*qdev_event)(DeviceState *dev);
typedef void (*qdev_resetfn)(DeviceState *dev);
typedef int (*DeviceRealize)(struct uc_struct *uc, DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(struct uc_struct *uc, DeviceState *dev, Error **errp);
typedef void (*BusRealize)(BusState *bus, Error **errp);
typedef void (*BusUnrealize)(BusState *bus, Error **errp);

View File

@ -3103,6 +3103,22 @@ out:
return 0;
}
static void x86_cpu_unrealizefn(struct uc_struct *uc, DeviceState *dev, Error **errp)
{
/* Unicorn: commented out
X86CPU *cpu = X86_CPU(uc, dev);
#ifndef CONFIG_USER_ONLY
cpu_remove_sync(CPU(dev));
qemu_unregister_reset(x86_cpu_machine_reset_cb, dev);
#endif
if (cpu->apic_state) {
object_unparent(OBJECT(cpu->apic_state));
cpu->apic_state = NULL;
}*/
}
static void x86_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
{
//printf("... X86 initialize (object)\n");
@ -3206,6 +3222,7 @@ static void x86_cpu_common_class_init(struct uc_struct *uc, ObjectClass *oc, voi
xcc->parent_realize = dc->realize;
dc->realize = x86_cpu_realizefn;
dc->unrealize = x86_cpu_unrealizefn;
dc->bus_type = TYPE_ICC_BUS;
xcc->parent_reset = cc->reset;