Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add setusergs on Xen, and simplify.
details: https://anonhg.NetBSD.org/src/rev/06d68d20dcb8
branches: trunk
changeset: 356816:06d68d20dcb8
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Oct 15 10:58:32 2017 +0000
description:
Add setusergs on Xen, and simplify.
diffstat:
sys/arch/amd64/amd64/cpufunc.S | 4 +++-
sys/arch/amd64/amd64/machdep.c | 12 ++----------
sys/arch/x86/x86/sys_machdep.c | 9 ++-------
sys/arch/xen/x86/xenfunc.c | 12 ++++++++++--
4 files changed, 17 insertions(+), 20 deletions(-)
diffs (125 lines):
diff -r db89baf6371b -r 06d68d20dcb8 sys/arch/amd64/amd64/cpufunc.S
--- a/sys/arch/amd64/amd64/cpufunc.S Sun Oct 15 09:33:25 2017 +0000
+++ b/sys/arch/amd64/amd64/cpufunc.S Sun Oct 15 10:58:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.S,v 1.27 2016/11/27 14:49:21 kamil Exp $ */
+/* $NetBSD: cpufunc.S,v 1.28 2017/10/15 10:58:32 maxv Exp $ */
/*-
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -641,6 +641,7 @@
movw %di, %fs
ret
+#ifndef XEN
ENTRY(setusergs)
CLI(ax)
swapgs
@@ -648,3 +649,4 @@
swapgs
STI(ax)
ret
+#endif
diff -r db89baf6371b -r 06d68d20dcb8 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Sun Oct 15 09:33:25 2017 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Sun Oct 15 10:58:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.264 2017/10/11 16:56:26 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.265 2017/10/15 10:58:32 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.264 2017/10/11 16:56:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.265 2017/10/15 10:58:32 maxv Exp $");
/* #define XENDEBUG_LOW */
@@ -2061,11 +2061,7 @@
tf->tf_fs = 0;
tf->tf_gs = 0;
setfs(0);
-#ifndef XEN
setusergs(0);
-#else
- HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, 0);
-#endif
if ((l->l_proc->p_flag & PK_32) == 0) {
#ifndef XEN
wrmsr(MSR_FSBASE, 0);
@@ -2103,11 +2099,7 @@
update_descriptor(&curcpu()->ci_gdt[GUFS_SEL], &pcb->pcb_fs);
update_descriptor(&curcpu()->ci_gdt[GUGS_SEL], &pcb->pcb_gs);
setfs(fssel);
-#ifndef XEN
setusergs(gssel);
-#else
- HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, gssel);
-#endif
tf->tf_fs = fssel;
tf->tf_gs = gssel;
kpreempt_enable();
diff -r db89baf6371b -r 06d68d20dcb8 sys/arch/x86/x86/sys_machdep.c
--- a/sys/arch/x86/x86/sys_machdep.c Sun Oct 15 09:33:25 2017 +0000
+++ b/sys/arch/x86/x86/sys_machdep.c Sun Oct 15 10:58:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_machdep.c,v 1.38 2017/08/30 15:44:01 maxv Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.39 2017/10/15 10:58:32 maxv Exp $ */
/*
* Copyright (c) 1998, 2007, 2009, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.38 2017/08/30 15:44:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.39 2017/10/15 10:58:32 maxv Exp $");
#include "opt_mtrr.h"
#include "opt_pmc.h"
@@ -628,12 +628,7 @@
if (l == curlwp) {
update_descriptor(&curcpu()->ci_gdt[GUGS_SEL], &usd);
#ifdef __x86_64__
-#ifndef XEN
setusergs(GSEL(GUGS_SEL, SEL_UPL));
-#else
- HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL,
- GSEL(GUGS_SEL, SEL_UPL));
-#endif
#endif
}
tf->tf_gs = GSEL(GUGS_SEL, SEL_UPL);
diff -r db89baf6371b -r 06d68d20dcb8 sys/arch/xen/x86/xenfunc.c
--- a/sys/arch/xen/x86/xenfunc.c Sun Oct 15 09:33:25 2017 +0000
+++ b/sys/arch/xen/x86/xenfunc.c Sun Oct 15 10:58:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenfunc.c,v 1.16 2017/02/05 10:42:21 maxv Exp $ */
+/* $NetBSD: xenfunc.c,v 1.17 2017/10/15 10:58:32 maxv Exp $ */
/*
*
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.16 2017/02/05 10:42:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.17 2017/10/15 10:58:32 maxv Exp $");
#include <sys/param.h>
@@ -216,3 +216,11 @@
{
return curcpu()->ci_vcpu->arch.cr2;
}
+
+#ifdef __x86_64__
+void
+setusergs(int gssel)
+{
+ HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, gssel);
+}
+#endif
Home |
Main Index |
Thread Index |
Old Index