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 There are two places where we reload %gs:



details:   https://anonhg.NetBSD.org/src/rev/f88582d19af3
branches:  trunk
changeset: 359763:f88582d19af3
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Feb 25 08:09:07 2018 +0000

description:
There are two places where we reload %gs:

 * In setusergs. Here we can't fault. So we don't need to handle this
   case.

 * In intrfastexit for 32bit processes. This case needs to be handled,
   and we already have a label.

So use the label instead of disassembling %rip.

diffstat:

 sys/arch/amd64/amd64/amd64_trap.S |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (28 lines):

diff -r 4fd77b53b2f6 -r f88582d19af3 sys/arch/amd64/amd64/amd64_trap.S
--- a/sys/arch/amd64/amd64/amd64_trap.S Sun Feb 25 01:05:09 2018 +0000
+++ b/sys/arch/amd64/amd64/amd64_trap.S Sun Feb 25 08:09:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amd64_trap.S,v 1.33 2018/02/22 08:36:31 maxv Exp $     */
+/*     $NetBSD: amd64_trap.S,v 1.34 2018/02/25 08:09:07 maxv Exp $     */
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -400,12 +400,12 @@
 5:
 
        /* Case 3: move to %gs? */
-       movq    TF_RIP(%rsp),%rax
-       movw    (%rax),%ax
-       andb    $070,%ah                /* mask mod/rm from mod/reg/rm */
-       cmpw    $0x8e+050*256,%ax       /* Any move to %gs (reg 5) */
-       jne     2b                      /* No - normal kernel fault */
-       jmp     1b                      /* Yes - restore %gs */
+       leaq    do_mov_gs(%rip),%rdi
+       cmpq    %rdi,TF_RIP(%rsp)
+       je      1b
+
+       /* None of the above cases */
+       jmp     2b      /* normal kernel fault */
 END(check_swapgs)
 #endif
 



Home | Main Index | Thread Index | Old Index