From 3434ff5a2266b4215fe9d80f494f74f0f7c86b7e Mon Sep 17 00:00:00 2001 From: guenther Date: Thu, 12 Jul 2018 14:24:54 +0000 Subject: [PATCH] Unbreak the nmi handler (again): I placed INTR_CLEAR_GPRS in the wrong place and GS.base was horked on return. Also, the frame passed to ddb didn't have the %rbp<-->tf_err swap, which would have confused backtraces. Now if we can just come up with a way to automate testing the NMI handler with qemu... --- sys/arch/amd64/amd64/vector.S | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/arch/amd64/amd64/vector.S b/sys/arch/amd64/amd64/vector.S index 5bd895307e7..e06547f9b92 100644 --- a/sys/arch/amd64/amd64/vector.S +++ b/sys/arch/amd64/amd64/vector.S @@ -1,4 +1,4 @@ -/* $OpenBSD: vector.S,v 1.72 2018/07/12 14:11:11 guenther Exp $ */ +/* $OpenBSD: vector.S,v 1.73 2018/07/12 14:24:54 guenther Exp $ */ /* $NetBSD: vector.S,v 1.5 2004/06/28 09:13:11 fvdl Exp $ */ /* @@ -121,7 +121,9 @@ IDTVEC(trap02) pushq $0 pushq $T_NMI calltrap_specstk: # special stack path - INTR_REENTRY + INTR_ENTRY_KERN + INTR_SAVE_MOST_GPRS_NO_ADJ + INTR_CLEAR_GPRS movl $MSR_GSBASE,%ecx # save current GS.base... rdmsr movq %rax,%r12 # ...in %r12 and %r13 @@ -139,7 +141,6 @@ calltrap_specstk: # special stack path .text .globl INTRENTRY_LABEL(calltrap_specstk) INTRENTRY_LABEL(calltrap_specstk): - INTR_CLEAR_GPRS cld SMAP_CLAC movq %rsp,%rdi @@ -163,10 +164,11 @@ INTRENTRY_LABEL(calltrap_specstk): KUENTRY(calltrap_specstk_tramp) movq %r15,%cr3 # restore %cr3 popq %r15 - popq %rbp + addq $8,%rsp # ignore tf_err popq %rbx popq %rax - addq $16,%rsp + addq $8,%rsp # ignore tf_trapno + popq %rbp iretq IDTVEC(trap03) -- 2.20.1