From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests] x86: add and use *_BIT constants for CR0, CR4, EFLAGS
Date: Tue, 26 Jul 2022 17:32:14 +0000 [thread overview]
Message-ID: <YuAlHgkpBZS0QJ5e@google.com> (raw)
In-Reply-To: <20220726151232.92584-1-pbonzini@redhat.com>
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@redhat.com>
> ---
...
> 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
>
next prev parent reply other threads:[~2022-07-26 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 15:12 [PATCH kvm-unit-tests] x86: add and use *_BIT constants for CR0, CR4, EFLAGS Paolo Bonzini
2022-07-26 17:32 ` Sean Christopherson [this message]
2022-07-27 6:04 ` Paolo Bonzini
2022-07-27 18:00 ` Sean Christopherson
2022-07-28 15:13 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2022-07-26 17:35 Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YuAlHgkpBZS0QJ5e@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.