Arrange for Disp8 JMPs to be usable. On top of the MOVL->MOVB conversion
this further reduces entry point size, such that in particular INT3 (for
guarding against straight line speculation) would then also still fit
within the same 16-byte block, irrespective of CET-IBT being enabled. Of
course when CC_SPLIT_SECTIONS=y the ordering here doesn't matter at all.
Which of the non-IST exception entry points are moved is based on
presumed / guessed frequency of use.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Arguably we could move all these entry points ahead of handle_exception,
accepting that the first few will continue to use Disp32 JMPs.
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -725,6 +725,59 @@ FUNC(common_interrupt)
jmp ret_from_intr
END(common_interrupt)
+FUNC(entry_BP)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_BP, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_BP)
+
+FUNC(entry_SS)
+ ENDBR64
+ movb $X86_EXC_SS, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_SS)
+
+FUNC(entry_AC)
+ ENDBR64
+ movb $X86_EXC_AC, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_AC)
+
+FUNC(entry_NM)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_NM, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_NM)
+
+FUNC(entry_MF)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_MF, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_MF)
+
+FUNC(entry_XM)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_XM, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_XM)
+
+FUNC(entry_UD)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_UD, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_UD)
+
+FUNC(entry_GP)
+ ENDBR64
+ movb $X86_EXC_GP, EFRAME_entry_vector(%rsp)
+ jmp handle_exception
+END(entry_GP)
+
FUNC(entry_PF)
ENDBR64
movb $X86_EXC_PF, EFRAME_entry_vector(%rsp)
@@ -908,41 +961,6 @@ FUNC(entry_DE)
jmp handle_exception
END(entry_DE)
-FUNC(entry_MF)
- ENDBR64
- pushq $0
- movb $X86_EXC_MF, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_MF)
-
-FUNC(entry_XM)
- ENDBR64
- pushq $0
- movb $X86_EXC_XM, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_XM)
-
-FUNC(entry_NM)
- ENDBR64
- pushq $0
- movb $X86_EXC_NM, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_NM)
-
-FUNC(entry_DB)
- ENDBR64
- pushq $0
- movb $X86_EXC_DB, EFRAME_entry_vector(%rsp)
- jmp handle_ist_exception
-END(entry_DB)
-
-FUNC(entry_BP)
- ENDBR64
- pushq $0
- movb $X86_EXC_BP, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_BP)
-
FUNC(entry_OF)
ENDBR64
pushq $0
@@ -957,13 +975,6 @@ FUNC(entry_BR)
jmp handle_exception
END(entry_BR)
-FUNC(entry_UD)
- ENDBR64
- pushq $0
- movb $X86_EXC_UD, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_UD)
-
FUNC(entry_TS)
ENDBR64
movb $X86_EXC_TS, EFRAME_entry_vector(%rsp)
@@ -976,24 +987,6 @@ FUNC(entry_NP)
jmp handle_exception
END(entry_NP)
-FUNC(entry_SS)
- ENDBR64
- movb $X86_EXC_SS, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_SS)
-
-FUNC(entry_GP)
- ENDBR64
- movb $X86_EXC_GP, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_GP)
-
-FUNC(entry_AC)
- ENDBR64
- movb $X86_EXC_AC, EFRAME_entry_vector(%rsp)
- jmp handle_exception
-END(entry_AC)
-
FUNC(entry_CP)
ENDBR64
movb $X86_EXC_CP, EFRAME_entry_vector(%rsp)
@@ -1025,6 +1018,20 @@ FUNC(entry_DF)
tailcall do_double_fault
END(entry_DF)
+FUNC(entry_DB)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_DB, EFRAME_entry_vector(%rsp)
+ jmp handle_ist_exception
+END(entry_DB)
+
+FUNC(entry_MC)
+ ENDBR64
+ pushq $0
+ movb $X86_EXC_MC, EFRAME_entry_vector(%rsp)
+ jmp handle_ist_exception
+END(entry_MC)
+
FUNC(entry_NMI)
ENDBR64
pushq $0
@@ -1161,13 +1168,6 @@ FUNC(handle_ist_exception)
#endif
END(handle_ist_exception)
-FUNC(entry_MC)
- ENDBR64
- pushq $0
- movb $X86_EXC_MC, EFRAME_entry_vector(%rsp)
- jmp handle_ist_exception
-END(entry_MC)
-
/* No op trap handler. Required for kexec crash path. */
FUNC(trap_nop, 0)
ENDBR64
© 2016 - 2024 Red Hat, Inc.