Mailing List Archive

[xen staging] x86/entry: Adjustments to "reduce assembly code size of entry points"
commit 7d3c91377d121b31b9d602f8d44abdcb66b0cbe5
Author: Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 20 20:53:15 2024 +0000
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 26 18:20:27 2024 +0000

x86/entry: Adjustments to "reduce assembly code size of entry points"

Some retroactive review, for if I'd got to the patch in time.

* The new ASM-friendly BUILD_BUG_ON() should be in a header file.
* entry_int82() wants the movl->movb treatment too.

Fixes: c144b9e32427 ("x86: Reduce assembly code size of entry points")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
xen/arch/x86/include/asm/asm_defns.h | 8 ++++++++
xen/arch/x86/x86_64/compat/entry.S | 2 +-
xen/arch/x86/x86_64/entry.S | 8 --------
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index a9a6c21c76..cf9573705d 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -82,6 +82,14 @@ register unsigned long current_stack_pointer asm("rsp");

#ifdef __ASSEMBLY__

+.macro BUILD_BUG_ON condstr cond:vararg
+ .if \cond
+ .error "Condition \"\condstr\" not satisfied"
+ .endif
+.endm
+/* preprocessor macro to make error message more user friendly */
+#define BUILD_BUG_ON(cond) BUILD_BUG_ON #cond cond
+
#ifdef HAVE_AS_QUOTED_SYM
#define SUBSECTION_LBL(tag) \
.ifndef .L.tag; \
diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index d4f0e48040..93fbbeb4ae 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -15,7 +15,7 @@ FUNC(entry_int82)
ENDBR64
ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
pushq $0
- movl $HYPERCALL_VECTOR, 4(%rsp)
+ movb $HYPERCALL_VECTOR, 4(%rsp)
SAVE_ALL compat=1 /* DPL1 gate, restricted to 32bit PV guests only. */

SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo, %rdx=0, Clob: acd */
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index a7bd8f0ca5..f8938b0b42 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -22,14 +22,6 @@
#endif
.endm

-.macro BUILD_BUG_ON condstr cond:vararg
- .if \cond
- .error "Condition \"\condstr\" not satisfied"
- .endif
-.endm
-/* preprocessor macro to make error message more user friendly */
-#define BUILD_BUG_ON(cond) BUILD_BUG_ON #cond cond
-
#ifdef CONFIG_PV
/* %rbx: struct vcpu */
FUNC_LOCAL(switch_to_kernel)
--
generated by git-patchbot for /home/xen/git/xen.git#staging