summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/paravirt_types.h
diff options
context:
space:
mode:
authorHou Wenlong <houwenlong.hwl@antgroup.com>2023-06-09 12:45:31 +0300
committerBorislav Petkov (AMD) <bp@alien8.de>2023-11-13 14:23:27 +0300
commit5c22c4726e4a9c6b2e182c0b21c2d3dd63f608c4 (patch)
tree40ef340dd4cb669c419f31e696a5c9066218b3de /arch/x86/include/asm/paravirt_types.h
parentb85ea95d086471afb4ad062012a4d73cd328fa86 (diff)
downloadlinux-5c22c4726e4a9c6b2e182c0b21c2d3dd63f608c4.tar.xz
x86/paravirt: Use relative reference for the original instruction offset
Similar to the alternative patching, use a relative reference for original instruction offset rather than absolute one, which saves 8 bytes for one PARA_SITE entry on x86_64. As a result, a R_X86_64_PC32 relocation is generated instead of an R_X86_64_64 one, which also reduces relocation metadata on relocatable builds. Hardcode the alignment to 4 now. [ bp: Massage commit message. ] Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/9e6053107fbaabc0d33e5d2865c5af2c67ec9925.1686301237.git.houwenlong.hwl@antgroup.com
Diffstat (limited to 'arch/x86/include/asm/paravirt_types.h')
-rw-r--r--arch/x86/include/asm/paravirt_types.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 772d03487520..e1bfb719fca3 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -5,7 +5,7 @@
#ifndef __ASSEMBLY__
/* These all sit in the .parainstructions section to tell us what to patch. */
struct paravirt_patch_site {
- u8 *instr; /* original instructions */
+ s32 instr_offset; /* original instructions */
u8 type; /* type of this instruction */
u8 len; /* length of original instruction */
};
@@ -263,11 +263,11 @@ extern struct paravirt_patch_template pv_ops;
#define _paravirt_alt(insn_string, type) \
"771:\n\t" insn_string "\n" "772:\n" \
".pushsection .parainstructions,\"a\"\n" \
- _ASM_ALIGN "\n" \
- _ASM_PTR " 771b\n" \
+ " .align 4\n" \
+ " .long 771b-.\n" \
" .byte " type "\n" \
" .byte 772b-771b\n" \
- _ASM_ALIGN "\n" \
+ " .align 4\n" \
".popsection\n"
/* Generate patchable code, with the default asm parameters. */