|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/alternatives: Factor out access to ideal_nops[]
commit 0d32eb28447ebc9800d53a573839dbc4441cc3b2
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed May 21 22:40:52 2025 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 4 18:15:59 2026 +0100
x86/alternatives: Factor out access to ideal_nops[]
... in order to rework the calculation.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/alternative.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index c87665bffe..f0644055d3 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -86,6 +86,11 @@ static bool init_or_livepatch_read_mostly
toolchain_nops_are_ideal;
# define toolchain_nops_are_ideal false
#endif
+static const unsigned char *init_or_livepatch get_ideal_nops(unsigned int
noplen)
+{
+ return ideal_nops[noplen];
+}
+
static void __init arch_init_ideal_nops(void)
{
switch ( boot_cpu_data.vendor )
@@ -116,7 +121,7 @@ static void __init arch_init_ideal_nops(void)
}
#ifdef HAVE_AS_NOPS_DIRECTIVE
- if ( memcmp(ideal_nops[ASM_NOP_MAX], toolchain_nops, ASM_NOP_MAX) == 0 )
+ if ( memcmp(get_ideal_nops(ASM_NOP_MAX), toolchain_nops, ASM_NOP_MAX) == 0
)
toolchain_nops_are_ideal = true;
#endif
}
@@ -127,9 +132,11 @@ void init_or_livepatch add_nops(void *insns, unsigned int
len)
while ( len > 0 )
{
unsigned int noplen = len;
+
if ( noplen > ASM_NOP_MAX )
noplen = ASM_NOP_MAX;
- memcpy(insns, ideal_nops[noplen], noplen);
+
+ memcpy(insns, get_ideal_nops(noplen), noplen);
insns += noplen;
len -= noplen;
}
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |