Module Name: src
Committed By: maxv
Date: Sun Feb 25 08:09:07 UTC 2018
Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/amd64_trap.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.33 src/sys/arch/amd64/amd64/amd64_trap.S:1.34
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.33 Thu Feb 22 08:36:31 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S Sun Feb 25 08:09:07 2018
@@ -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 @@ NENTRY(check_swapgs)
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