Re: [PATCH kvm-unit-tests] x86: add and use *_BIT constants for CR0, CR4, EFLAGS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 26, 2022, Paolo Bonzini wrote:
> The "BIT" macro cannot be used in top-level assembly statements
> (it can be used in functions through the "i" constraint).  To
> avoid having to hard-code EFLAGS.AC being bit 18, define the
> constants for CR0, CR4 and EFLAGS bits in terms of new macros
> for just the bit number.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---

...

> diff --git a/x86/smap.c b/x86/smap.c
> index 0994c29..3f63ee1 100644
> --- a/x86/smap.c
> +++ b/x86/smap.c
> @@ -39,7 +39,7 @@ asm ("pf_tss:\n"
>  #endif
>  	"add $"S", %"R "sp\n"
>  #ifdef __x86_64__
> -	"orl $" xstr(X86_EFLAGS_AC) ", 2*"S"(%"R "sp)\n"  // set EFLAGS.AC and retry

I don't understand, this compiles cleanly on both gcc and clang, and generates the
correct code.  What am I missing?

> +	"orl $(1<<" xstr(X86_EFLAGS_AC_BIT) "), 2*"S"(%"R "sp)\n"  // set EFLAGS.AC and retry
>  #endif
>          "iret"W" \n\t"
>          "jmp pf_tss\n\t");
> -- 
> 2.36.1
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux