Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 Remove the sysretq fault handler. It is...



details:   https://anonhg.NetBSD.org/src/rev/56c2c77c365c
branches:  trunk
changeset: 321530:56c2c77c365c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Mar 20 14:26:49 2018 +0000

description:
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.

diffstat:

 sys/arch/amd64/amd64/amd64_trap.S |  20 +++++++-------------
 sys/arch/amd64/amd64/locore.S     |   4 +---
 2 files changed, 8 insertions(+), 16 deletions(-)

diffs (86 lines):

diff -r d037601f74a1 -r 56c2c77c365c sys/arch/amd64/amd64/amd64_trap.S
--- a/sys/arch/amd64/amd64/amd64_trap.S Tue Mar 20 13:30:40 2018 +0000
+++ b/sys/arch/amd64/amd64/amd64_trap.S Tue Mar 20 14:26:49 2018 +0000
@@ -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 @@
 
 /*
  * 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 @@
        /* 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 @@
        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
diff -r d037601f74a1 -r 56c2c77c365c sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Tue Mar 20 13:30:40 2018 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Tue Mar 20 14:26:49 2018 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index