cputest: Add support for MSR features to cpu-parse.sh

The script just parses whatever cpu-gather.sh printed out.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2019-03-26 21:20:38 +01:00
parent ab3d6ea0da
commit 8904492e21
2 changed files with 7 additions and 3 deletions

View File

@ -23,12 +23,15 @@ fname="x86_64-cpuid-$fname"
xml()
{
hex='\(0x[0-9a-f]\+\)'
match="$hex $hex: eax=$hex ebx=$hex ecx=$hex edx=$hex"
subst="<cpuid eax_in='\\1' ecx_in='\\2' eax='\\3' ebx='\\4' ecx='\\5' edx='\\6'\\/>"
matchCPUID="$hex $hex: eax=$hex ebx=$hex ecx=$hex edx=$hex"
substCPUID="<cpuid eax_in='\\1' ecx_in='\\2' eax='\\3' ebx='\\4' ecx='\\5' edx='\\6'\\/>"
matchMSR="$hex: $hex\(.......[0-9a-f]\)"
substMSR="<msr index='\\1' edx='\\2' eax='0x\\3'\\/>"
echo "<!-- $model -->"
echo "<cpudata arch='x86'>"
sed -ne "s/^ *$match$/ $subst/p"
sed -ne "s/^ *$matchCPUID$/ $substCPUID/p; s/^ *$matchMSR$/ $substMSR/p"
echo "</cpudata>"
}

View File

@ -51,4 +51,5 @@
<cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x0000302e' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x00000b54' ebx='0x00000f3c' ecx='0x00000064' edx='0x00000000'/>
<cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x00000b54' ebx='0x00000f3c' ecx='0x00000064' edx='0x00000000'/>
<msr index='0x10a' edx='0x00000000' eax='0x0000002b'/>
</cpudata>