From f75d72bc3d4dd183b3bd31efdd27226872a483de Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 12 Feb 2018 20:49:49 -0500 Subject: [PATCH] target-i386: Make level and xlevel properties static Static properties require only 1 line of code, much simpler than the existing code that requires writing new getters/setters. As a nice side-effect, this fixes an existing bug where the setters were incorrectly allowing the properties to be changed after the CPU was already realized. Backports commit b9472b76d273c7796d877c49af50969c0a879c50 from qemu --- qemu/target-i386/cpu.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/qemu/target-i386/cpu.c b/qemu/target-i386/cpu.c index 64970562..6a2c08e1 100644 --- a/qemu/target-i386/cpu.c +++ b/qemu/target-i386/cpu.c @@ -1361,42 +1361,6 @@ static int x86_cpuid_version_set_stepping(struct uc_struct *uc, Object *obj, Vis return 0; } -static void x86_cpuid_get_level(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) -{ - X86CPU *cpu = X86_CPU(uc, obj); - - visit_type_uint32(v, &cpu->env.cpuid_level, name, errp); -} - -static int x86_cpuid_set_level(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) -{ - X86CPU *cpu = X86_CPU(uc, obj); - - visit_type_uint32(v, &cpu->env.cpuid_level, name, errp); - - return 0; -} - -static void x86_cpuid_get_xlevel(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) -{ - X86CPU *cpu = X86_CPU(uc, obj); - - visit_type_uint32(v, &cpu->env.cpuid_xlevel, name, errp); -} - -static int x86_cpuid_set_xlevel(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) -{ - X86CPU *cpu = X86_CPU(uc, obj); - - visit_type_uint32(v, &cpu->env.cpuid_xlevel, name, errp); - - return 0; -} - static char *x86_cpuid_get_vendor(struct uc_struct *uc, Object *obj, Error **errp) { X86CPU *cpu = X86_CPU(uc, obj); @@ -2449,12 +2413,6 @@ static void x86_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque) object_property_add(obj, "stepping", "int", x86_cpuid_version_get_stepping, x86_cpuid_version_set_stepping, NULL, NULL, NULL); - object_property_add(obj, "level", "int", - x86_cpuid_get_level, - x86_cpuid_set_level, NULL, NULL, NULL); - object_property_add(obj, "xlevel", "int", - x86_cpuid_get_xlevel, - x86_cpuid_set_xlevel, NULL, NULL, NULL); object_property_add_str(obj, "vendor", x86_cpuid_get_vendor, x86_cpuid_set_vendor, NULL);