Il 05/06/2014 17:04, H. Peter Anvin ha scritto:
On 06/05/2014 08:02 AM, Nadav Amit wrote:
I'm sorry, I'm missing the place where 64-bit mode is taken into account?
It is not, since on 32-bit mode the high-order 16 bits of a register destination are undefined.
If I recall correctly, in this case the high-order 16-bits on native
system actually reflect the high-order 16-bits of CR0.
This sounds like something that really should be verified
experimentally. The above claim seems... odd.
Here is a test program:
#if __SIZEOF_LONG__ == 4
#define V "12345678"
#define R "e"
#else
#define V "1234567812345678"
#define R "r"
#endif
#include <stdio.h>
int main()
{
register volatile unsigned long ecx asm("ecx");
#if __SIZEOF_LONG__ > 4
asm volatile("mov $0x" V ", %%" R "cx; smswq %%rcx": : :"ecx");
printf("smswq: %lx\n", ecx);
#endif
asm volatile("mov $0x" V ", %%" R "cx; smswl %%ecx": : :"ecx");
printf("smswl: %lx\n", ecx);
asm volatile("mov $0x" V ", %%" R "cx; smsww %%cx": : :"ecx");
printf("smsww: %lx\n", ecx);
}
Output in 32-bit mode:
smswq: 80050033
smswl: 12340033
Output in 64-bit mode:
smswq: 80050033
smswl: 80050033
smsww: 1234567812340033
Can you please make a test case for kvm-unit-tests (x86/emulator.c), in
order to check the validity of the patch?
Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html