summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-09-29 20:31:11 +0200
committerErwan Velu <erwan.velu@free.fr>2009-09-29 20:31:11 +0200
commit8ba991f9e17c5bdaa24dccbc5aa0a4e5db690756 (patch)
tree60a959f97ac26294cfcca3e48546934fe213d6ef
parent15c6dc79f8d488c585057987eefddd72b114534e (diff)
downloadsyslinux-8ba991f9e17c5bdaa24dccbc5aa0a4e5db690756.tar.gz
Adding VMX & SVM cpu flags
Impact: Hardware virtualization is now detected Minor update to detect vmx & svm cpu flags
-rw-r--r--com32/gplinclude/cpuid.h2
-rw-r--r--com32/gpllib/cpuid.c2
-rw-r--r--com32/hdt/hdt-cli-cpu.c4
-rw-r--r--com32/hdt/hdt-menu-processor.c4
-rw-r--r--com32/include/cpufeature.h2
-rw-r--r--com32/modules/cpuidtest.c4
6 files changed, 18 insertions, 0 deletions
diff --git a/com32/gplinclude/cpuid.h b/com32/gplinclude/cpuid.h
index 95d66e99..0b59a08f 100644
--- a/com32/gplinclude/cpuid.h
+++ b/com32/gplinclude/cpuid.h
@@ -65,6 +65,8 @@ typedef struct {
bool nowext; /* AMD 3DNow! extensions */
bool now; /* 3DNow! */
bool smp; /* A smp configuration has been found */
+ bool vmx; /* Hardware virtualization */
+ bool svm; /* Secure virtual machine */
} s_cpu_flags;
typedef struct {
diff --git a/com32/gpllib/cpuid.c b/com32/gpllib/cpuid.c
index 6d464c7e..fb69cef6 100644
--- a/com32/gpllib/cpuid.c
+++ b/com32/gpllib/cpuid.c
@@ -295,6 +295,8 @@ void set_cpu_flags(struct cpuinfo_x86 *c, s_cpu * cpu)
cpu->flags.nowext = cpu_has(c, X86_FEATURE_3DNOWEXT);
cpu->flags.now = cpu_has(c, X86_FEATURE_3DNOW);
cpu->flags.smp = find_smp_config();
+ cpu->flags.vmx = cpu_has(c, X86_FEATURE_VMX);
+ cpu->flags.svm = cpu_has(c, X86_FEATURE_SVM);
}
void set_generic_info(struct cpuinfo_x86 *c, s_cpu * cpu)
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index f0f0a1bb..d2b5979f 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -174,6 +174,10 @@ static void show_cpu(int argc __unused, char **argv __unused,
strcat(buffer1, "3dnowext ");
if (hardware->cpu.flags.now)
strcat(buffer1, "3dnow! ");
+ if (hardware->cpu.flags.svm)
+ strcat(buffer1, "svm ");
+ if (hardware->cpu.flags.vmx)
+ strcat(buffer1, "vmx ");
if (buffer1[0]) {
snprintf(buffer, sizeof buffer, "Flags : %s\n", buffer1);
more_printf(buffer);
diff --git a/com32/hdt/hdt-menu-processor.c b/com32/hdt/hdt-menu-processor.c
index a30cf0f6..4e102cb5 100644
--- a/com32/hdt/hdt-menu-processor.c
+++ b/com32/hdt/hdt-menu-processor.c
@@ -231,6 +231,10 @@ void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware)
strcat(buffer1, "3dnowext ");
if (hardware->cpu.flags.now)
strcat(buffer1, "3dnow! ");
+ if (hardware->cpu.flags.vmx)
+ strcat(buffer1, "vmx ");
+ if (hardware->cpu.flags.svm)
+ strcat(buffer1, "svm ");
snprintf(buffer, sizeof buffer, "Flags : %s", buffer1);
snprintf(statbuffer, sizeof statbuffer, "Flags: %s", buffer1);
add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
diff --git a/com32/include/cpufeature.h b/com32/include/cpufeature.h
index 2fd47579..036631a7 100644
--- a/com32/include/cpufeature.h
+++ b/com32/include/cpufeature.h
@@ -72,6 +72,7 @@
#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
#define X86_FEATURE_MWAIT (4*32+ 3) /* Monitor/Mwait support */
#define X86_FEATURE_DSCPL (4*32+ 4) /* CPL Qualified Debug Store */
+#define X86_FEATURE_VMX (4*32+ 5) /* Hardware virtualization */
#define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */
#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */
#define X86_FEATURE_CID (4*32+10) /* Context ID */
@@ -87,6 +88,7 @@
/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
+#define X86_FEATURE_SVM (6*32+ 2) /* Secure virtual machine */
#endif /* __ASM_I386_CPUFEATURE_H */
diff --git a/com32/modules/cpuidtest.c b/com32/modules/cpuidtest.c
index bfc1c190..b7688852 100644
--- a/com32/modules/cpuidtest.c
+++ b/com32/modules/cpuidtest.c
@@ -121,6 +121,10 @@ int main(void)
printf("3dnowext ");
if (cpu.flags.now)
printf("3dnow! ");
+ if (cpu.flags.vmx)
+ printf("vmx ");
+ if (cpu.flags.svm)
+ printf("svm ");
printf("\n");
printf("SMP = ");
if (cpu.flags.smp)