[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 24/37] target-i386: use define for cpuid vendor stri
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 24/37] target-i386: use define for cpuid vendor string size |
Date: |
Mon, 22 Oct 2012 17:03:10 +0200 |
Signed-off-by: Igor Mammedov <address@hidden>
---
target-i386/cpu.c | 6 +++---
target-i386/cpu.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 061ee01..ec128c6 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1265,13 +1265,13 @@ static char *x86_cpuid_get_vendor(Object *obj, Error
**errp)
char *value;
int i;
- value = (char *)g_malloc(12 + 1);
+ value = (char *)g_malloc(CPUID_VENDOR_SZ + 1);
for (i = 0; i < 4; i++) {
value[i ] = env->cpuid_vendor1 >> (8 * i);
value[i + 4] = env->cpuid_vendor2 >> (8 * i);
value[i + 8] = env->cpuid_vendor3 >> (8 * i);
}
- value[12] = '\0';
+ value[CPUID_VENDOR_SZ] = '\0';
return value;
}
@@ -1282,7 +1282,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char
*value,
CPUX86State *env = &cpu->env;
int i;
- if (strlen(value) != 12) {
+ if (strlen(value) != CPUID_VENDOR_SZ) {
error_set(errp, QERR_PROPERTY_VALUE_BAD, "",
"vendor", value);
return;
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 69f8691..4296e66 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -488,6 +488,8 @@
#define CPUID_7_0_EBX_SMEP (1 << 7)
#define CPUID_7_0_EBX_SMAP (1 << 20)
+#define CPUID_VENDOR_SZ 12
+
#define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */
#define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */
#define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */
--
1.7.11.7
- [Qemu-devel] [PATCH 36/37] target-i386: use static properties to list CPUID features, (continued)
- [Qemu-devel] [PATCH 37/37] target-i386: cleanup cpu_x86_find_by_name(), only fill x86_def_t in it, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 26/37] target-i386: convert "vendor" property to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 30/37] target-i386: convert "model" to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 24/37] target-i386: use define for cpuid vendor string size,
Igor Mammedov <=
- [Qemu-devel] [PATCH 09/37] qdev: export qdev_prop_find() and allow it to be used with DeviceClass instead of Object, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 27/37] target-i386: convert "tsc-frequency" to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 15/37] target-i386: set default value of "hypervisor" feature using static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 22/37] target-i386: convert 'hv_vapic' to static property, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 05/37] target-i386: move out CPU features initialization in separate func, Igor Mammedov, 2012/10/22
- [Qemu-devel] [PATCH 32/37] target-i386: use static properties for setting cpuid features, Igor Mammedov, 2012/10/22