From: Sean Christopherson <seanjc@google.com>
To: Hou Wenlong <houwenlong.hwl@antgroup.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [kvm-unit-tests PATCH v3 3/3] x86/emulator: Add some tests for far jmp instruction emulation
Date: Thu, 10 Feb 2022 16:41:30 +0000 [thread overview]
Message-ID: <YgVAOuWPJhqyLbZJ@google.com> (raw)
In-Reply-To: <9c1d2125cb8680aff8a69e04461c4d84edb85760.1644481282.git.houwenlong.hwl@antgroup.com>
On Thu, Feb 10, 2022, Hou Wenlong wrote:
> @@ -76,6 +96,17 @@ static struct far_xfer_test far_ret_test = {
> : "eax", "memory"); \
> })
>
> +#define TEST_FAR_JMP_ASM(seg, prefix) \
> +({ \
> + *(uint16_t *)(&fep_jmp_buf[1]) = seg; \
> + asm volatile("lea 1f(%%rip), %%rax\n\t" \
> + "movq $1f, (%[mem])\n\t" \
> + prefix "rex64 ljmp *(%[mem])\n\t"\
> + "1:" \
> + : : [mem]"r"(fep_jmp_buf_ptr)\
> + : "eax", "memory"); \
Align the backslashes for a given macro, even though it means the two TEST_FAR_*_ASM
macros won't share alignment. This needs an -fPIC tweak for the movq too, but this
one is easy since RAX already holds what we want.
With the below fixup...
Reviewed-and-tested-by: Sean Christopherson <seanjc@google.com>
---
x86/emulator.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/x86/emulator.c b/x86/emulator.c
index 22a5c9d..56a263e 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -97,15 +97,15 @@ static unsigned long *fep_jmp_buf_ptr = &fep_jmp_buf[0];
: "eax", "memory"); \
})
-#define TEST_FAR_JMP_ASM(seg, prefix) \
-({ \
- *(uint16_t *)(&fep_jmp_buf[1]) = seg; \
- asm volatile("lea 1f(%%rip), %%rax\n\t" \
- "movq $1f, (%[mem])\n\t" \
- prefix "rex64 ljmp *(%[mem])\n\t"\
- "1:" \
- : : [mem]"r"(fep_jmp_buf_ptr)\
- : "eax", "memory"); \
+#define TEST_FAR_JMP_ASM(seg, prefix) \
+({ \
+ *(uint16_t *)(&fep_jmp_buf[1]) = seg; \
+ asm volatile("lea 1f(%%rip), %%rax\n\t" \
+ "movq %%rax, (%[mem])\n\t" \
+ prefix "rex64 ljmp *(%[mem])\n\t" \
+ "1:" \
+ : : [mem]"r"(fep_jmp_buf_ptr) \
+ : "eax", "memory"); \
})
struct regs {
base-commit: 6bd9c4b6a79ed51c0e3e6a997654f4a9feb9c377
--
prev parent reply other threads:[~2022-02-10 16:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 8:46 [kvm-unit-tests PATCH v3 0/2] x86/emulator: Add some tests for loading segment descriptor in emulator Hou Wenlong
2022-02-10 8:46 ` [kvm-unit-tests PATCH v3 1/3] x86/emulator: Add some tests for far ret instruction emulation Hou Wenlong
2022-02-10 16:39 ` Sean Christopherson
2022-02-10 8:46 ` [kvm-unit-tests PATCH v3 2/3] x86/emulator: Rename test_ljmp() as test_far_jmp() Hou Wenlong
2022-02-10 16:39 ` Sean Christopherson
2022-02-10 8:46 ` [kvm-unit-tests PATCH v3 3/3] x86/emulator: Add some tests for far jmp instruction emulation Hou Wenlong
2022-02-10 16:41 ` Sean Christopherson [this message]
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=YgVAOuWPJhqyLbZJ@google.com \
--to=seanjc@google.com \
--cc=houwenlong.hwl@antgroup.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.