Module Name: src
Committed By: maxv
Date: Tue Mar 20 14:26:49 UTC 2018
Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S locore.S
Log Message:
Remove the sysretq fault handler. It is broken with SVS, and not really
needed anyway. Initially I had added it so that if such a fault was
received the kernel would panic "cleanly" instead of crashing in a
potentially undefined way.
I'll re-add this handler later.
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/amd64/amd64/locore.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.37 src/sys/arch/amd64/amd64/amd64_trap.S:1.38
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.37 Sun Feb 25 12:37:16 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S Tue Mar 20 14:26:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: amd64_trap.S,v 1.37 2018/02/25 12:37:16 maxv Exp $ */
+/* $NetBSD: amd64_trap.S,v 1.38 2018/03/20 14:26:49 maxv Exp $ */
/*
* Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -377,9 +377,8 @@ IDTVEC_END(intrspurious)
/*
* It is possible that we received a trap in kernel mode, but with the user
- * context loaded. There are six cases where this can happen:
+ * context loaded. There are five cases where this can happen:
*
- * o Execution of SYSRETQ.
* o Execution of IRETQ.
* o Reload of ES.
* o Reload of DS.
@@ -446,12 +445,7 @@ LABEL(kernuser_reenter)
/* We will clobber %rdi */
pushq %rdi
- /* Case 1: fault on sysretq? */
- leaq do_sysret(%rip),%rdi
- cmpq %rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
- je .Lkernelmode_but_user
-
- /* Case 2: fault on iretq? */
+ /* Case 1: fault on iretq? */
leaq do_iret(%rip),%rdi
cmpq %rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
jne 5f
@@ -461,22 +455,22 @@ LABEL(kernuser_reenter)
jmp .Lkernelmode_but_user /* to user - must restore %gs */
5:
- /* Case 3: move to %es? */
+ /* Case 2: move to %es? */
leaq do_mov_es(%rip),%rdi
cmpq %rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
je .Lkernelmode_but_user
- /* Case 4: move to %ds? */
+ /* Case 3: move to %ds? */
leaq do_mov_ds(%rip),%rdi
cmpq %rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
je .Lkernelmode_but_user
- /* Case 5: move to %fs? */
+ /* Case 4: move to %fs? */
leaq do_mov_fs(%rip),%rdi
cmpq %rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
je .Lkernelmode_but_user
- /* Case 6: move to %gs? */
+ /* Case 5: move to %gs? */
leaq do_mov_gs(%rip),%rdi
cmpq %rdi,TF_SMALL_REGPUSHED(TF_RIP, %rsp)
je .Lkernelmode_but_user
Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.157 src/sys/arch/amd64/amd64/locore.S:1.158
--- src/sys/arch/amd64/amd64/locore.S:1.157 Sun Feb 25 12:37:16 2018
+++ src/sys/arch/amd64/amd64/locore.S Tue Mar 20 14:26:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.157 2018/02/25 12:37:16 maxv Exp $ */
+/* $NetBSD: locore.S,v 1.158 2018/03/20 14:26:49 maxv Exp $ */
/*
* Copyright-o-rama!
@@ -330,7 +330,6 @@
.globl _C_LABEL(biosbasemem)
.globl _C_LABEL(biosextmem)
.globl _C_LABEL(lwp0uarea)
- .globl do_sysret
.globl do_mov_es
.globl do_mov_ds
.globl do_mov_fs
@@ -1471,7 +1470,6 @@ LABEL(syscall_sysret)
movq TF_RIP(%rsp),%rcx /* %rip for sysret */
movq TF_RFLAGS(%rsp),%r11 /* %flags for sysret */
movq TF_RSP(%rsp),%rsp
-do_sysret:
sysretq
#else
addq $TF_RIP,%rsp