提交 012f9b19 编写于 作者: P Peter Krempa

cpu: Add recently added cpu feature flags.

Qemu has added some new feature flags. This patch adds them to libvirt.

The new features are for the cpuid function 0x7 that takes an argument
in the ecx register. Currently only 0x0 is used as the argument so I was
lazy and I just clear the registers to 0 before calling cpuid. In future
when there maybe will be some other possible arguments, we will need to
improve the cpu detection code to take this into account.
上级 a6bd7c22
...@@ -142,6 +142,9 @@ ...@@ -142,6 +142,9 @@
<feature name='pdcm'> <feature name='pdcm'>
<cpuid function='0x00000001' ecx='0x00008000'/> <cpuid function='0x00000001' ecx='0x00008000'/>
</feature> </feature>
<feature name='pcid'>
<cpuid function='0x00000001' ecx='0x00020000'/>
</feature>
<feature name='dca'> <!-- CPUID_EXT_DCA --> <feature name='dca'> <!-- CPUID_EXT_DCA -->
<cpuid function='0x00000001' ecx='0x00040000'/> <cpuid function='0x00000001' ecx='0x00040000'/>
</feature> </feature>
...@@ -261,6 +264,15 @@ ...@@ -261,6 +264,15 @@
<cpuid function='0x80000001' ecx='0x00080000'/> <cpuid function='0x80000001' ecx='0x00080000'/>
</feature> </feature>
<!-- cpuid function 0x7 ecx 0x0 features -->
<!-- We support only ecx 0x0 now as it's done by a workaround -->
<feature name='smep'>
<cpuid function='0x00000007' ebx='0x00000080'/>
</feature>
<feature name='smap'>
<cpuid function='0x00000007' ebx='0x00080000'/>
</feature>
<!-- models --> <!-- models -->
<model name='486'> <model name='486'>
<feature name='fpu'/> <feature name='fpu'/>
......
...@@ -1539,7 +1539,10 @@ static inline void ...@@ -1539,7 +1539,10 @@ static inline void
cpuidCall(struct cpuX86cpuid *cpuid) cpuidCall(struct cpuX86cpuid *cpuid)
{ {
# if __x86_64__ # if __x86_64__
asm("cpuid" asm("xor %%ebx, %%ebx;" /* clear the other registers as some cpuid */
"xor %%ecx, %%ecx;" /* functions may use them as additional */
"xor %%edx, %%edx;" /* arguments */
"cpuid;"
: "=a" (cpuid->eax), : "=a" (cpuid->eax),
"=b" (cpuid->ebx), "=b" (cpuid->ebx),
"=c" (cpuid->ecx), "=c" (cpuid->ecx),
...@@ -1550,6 +1553,9 @@ cpuidCall(struct cpuX86cpuid *cpuid) ...@@ -1550,6 +1553,9 @@ cpuidCall(struct cpuX86cpuid *cpuid)
* for global offset table on i386 with -fPIC * for global offset table on i386 with -fPIC
*/ */
asm("push %%ebx;" asm("push %%ebx;"
"xor %%ebx, %%ebx;" /* clear the other registers as some cpuid */
"xor %%ecx, %%ecx;" /* functions may use them as additional */
"xor %%edx, %%edx;" /* arguments */
"cpuid;" "cpuid;"
"mov %%ebx, %1;" "mov %%ebx, %1;"
"pop %%ebx;" "pop %%ebx;"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册