Skip to content

Commit 8b376fa

Browse files
joergroedelKAGA-KOKO
authored andcommitted
x86/entry/32: Introduce SAVE_ALL_NMI and RESTORE_ALL_NMI
These macros will be used in the NMI handler code and replace plain SAVE_ALL and RESTORE_REGS there. The NMI-specific CR3-switch will be added to these macros later. Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Pavel Machek <pavel@ucw.cz> Cc: "H . Peter Anvin" <hpa@zytor.com> Cc: linux-mm@kvack.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Brian Gerst <brgerst@gmail.com> Cc: David Laight <David.Laight@aculab.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Eduardo Valentin <eduval@amazon.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Will Deacon <will.deacon@arm.com> Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Waiman Long <llong@redhat.com> Cc: "David H . Gutteridge" <dhgutteridge@sympatico.ca> Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1531906876-13451-10-git-send-email-joro@8bytes.org
1 parent e5862d0 commit 8b376fa

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

arch/x86/entry/entry_32.S

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@
181181

182182
.endm
183183

184+
.macro SAVE_ALL_NMI
185+
SAVE_ALL
186+
.endm
184187
/*
185188
* This is a sneaky trick to help the unwinder find pt_regs on the stack. The
186189
* frame pointer is replaced with an encoded pointer to pt_regs. The encoding
@@ -227,6 +230,10 @@
227230
POP_GS_EX
228231
.endm
229232

233+
.macro RESTORE_ALL_NMI pop=0
234+
RESTORE_REGS pop=\pop
235+
.endm
236+
230237
.macro CHECK_AND_APPLY_ESPFIX
231238
#ifdef CONFIG_X86_ESPFIX32
232239
#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8)
@@ -1161,7 +1168,7 @@ ENTRY(nmi)
11611168
#endif
11621169

11631170
pushl %eax # pt_regs->orig_ax
1164-
SAVE_ALL
1171+
SAVE_ALL_NMI
11651172
ENCODE_FRAME_POINTER
11661173
xorl %edx, %edx # zero error code
11671174
movl %esp, %eax # pt_regs pointer
@@ -1189,7 +1196,7 @@ ENTRY(nmi)
11891196

11901197
.Lnmi_return:
11911198
CHECK_AND_APPLY_ESPFIX
1192-
RESTORE_REGS 4
1199+
RESTORE_ALL_NMI pop=4
11931200
jmp .Lirq_return
11941201

11951202
#ifdef CONFIG_X86_ESPFIX32
@@ -1205,12 +1212,12 @@ ENTRY(nmi)
12051212
pushl 16(%esp)
12061213
.endr
12071214
pushl %eax
1208-
SAVE_ALL
1215+
SAVE_ALL_NMI
12091216
ENCODE_FRAME_POINTER
12101217
FIXUP_ESPFIX_STACK # %eax == %esp
12111218
xorl %edx, %edx # zero error code
12121219
call do_nmi
1213-
RESTORE_REGS
1220+
RESTORE_ALL_NMI
12141221
lss 12+4(%esp), %esp # back to espfix stack
12151222
jmp .Lirq_return
12161223
#endif

0 commit comments

Comments
 (0)