On 27/03/17 13:09, Jan Beulich wrote:
>>>> On 27.03.17 at 11:56, <andrew.coop...@citrix.com> wrote:
>> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
>> ---
>> CC: Jan Beulich <jbeul...@suse.com>
>> CC: George Dunlap <george.dun...@eu.citrix.com>
>> CC: Ian Jackson <ian.jack...@eu.citrix.com>
>> CC: Wei Liu <wei.l...@citrix.com>
>> ---
>>  tools/tests/x86_emulator/x86_emulate.c | 41 
>> ++++++++++++++++++++++++----------
>>  1 file changed, 29 insertions(+), 12 deletions(-)
>>
>> diff --git a/tools/tests/x86_emulator/x86_emulate.c 
>> b/tools/tests/x86_emulator/x86_emulate.c
>> index cea0595..2c49954 100644
>> --- a/tools/tests/x86_emulator/x86_emulate.c
>> +++ b/tools/tests/x86_emulator/x86_emulate.c
>> @@ -73,20 +73,37 @@ int emul_test_cpuid(
>>           : "a" (leaf), "c" (subleaf));
>>  
>>      /*
>> -     * The emulator doesn't itself use MOVBE, so we can always run the
>> -     * respective tests.
>> +     * Some instructions and features can be emulated without specific
>> +     * hardware support.  These features are unconditionally reported here,
>> +     * for testing and fuzzing-coverage purposes.
>>       */
>> -    if ( leaf == 1 )
>> -        res->c |= 1U << 22;
>> -
>> -    /*
>> -     * The emulator doesn't itself use ADCX/ADOX/RDPID, so we can always 
>> run
>> -     * the respective tests.
>> -     */
>> -    if ( leaf == 7 && subleaf == 0 )
>> +    switch ( leaf )
>>      {
>> -        res->b |= 1U << 19;
>> -        res->c |= 1U << 22;
>> +    case 1:
>> +        res->c |= 1U << 22; /* MOVBE */
>> +        break;
>> +
>> +    case 7:
>> +        switch ( subleaf )
>> +        {
>> +        case 0:
>> +            res->b |= 1U << 11; /* rtm */
> Upper case?

I was trying to visually separate the instructions from the features.

>
>> +            res->b |= 1U << 19; /* ADCX/ADOX */
>> +            res->b |= 1U << 20; /* STAC/CLAC */
> SMAP?
>
>> +            res->b |= 1U << 24; /* CLWB */
>> +
>> +            res->c |= 1U << 22; /* RDPID */
>> +            break;
>> +        }
>> +        break;
>> +
>> +    case 0x80000001:
>> +        res->c |= 1U << 4; /* cr8_legacy */
> I think this one is AMD-only, just like ...
>
>> +        if ( ctxt->vendor == X86_VENDOR_AMD )
>> +            res->c |= 1U << 7; /* misalignsse */
> ... this.

The difference is that cr8_legacy is a straight "is this specific
encoding valid to use", while misalignsse causes rather larger changes
in how SSE arguments get handled.

> And what about LAHF_LM, LZCNT, and CLFLUSH{,OPT}?

This list was only the instructions I had encountered.  I can add all of
these.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to