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 cpu_fsgs_zero: clear %fs and %gs even i...
details: https://anonhg.NetBSD.org/src/rev/d3d1464b3e72
branches: trunk
changeset: 758142:d3d1464b3e72
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Oct 21 11:27:46 2010 +0000
description:
cpu_fsgs_zero: clear %fs and %gs even in the case of !PK_32.
diffstat:
sys/arch/amd64/amd64/machdep.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diffs (48 lines):
diff -r 8c79e768eaf1 -r d3d1464b3e72 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Thu Oct 21 11:22:55 2010 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Thu Oct 21 11:27:46 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.151 2010/10/21 11:22:55 yamt Exp $ */
+/* $NetBSD: machdep.c,v 1.152 2010/10/21 11:27:46 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.151 2010/10/21 11:22:55 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.152 2010/10/21 11:27:46 yamt Exp $");
/* #define XENDEBUG_LOW */
@@ -1831,24 +1831,22 @@
void
cpu_fsgs_zero(struct lwp *l)
{
- struct trapframe *tf;
+ struct trapframe * const tf = l->l_md.md_regs;
struct pcb *pcb;
uint64_t zero = 0;
pcb = lwp_getpcb(l);
if (l == curlwp) {
- tf = l->l_md.md_regs;
kpreempt_disable();
tf->tf_fs = 0;
tf->tf_gs = 0;
- if (l->l_proc->p_flag & PK_32) {
- setfs(0);
+ setfs(0);
#ifndef XEN
- setusergs(0);
+ setusergs(0);
#else
- HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, 0);
+ HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, 0);
#endif
- } else {
+ if ((l->l_proc->p_flag & PK_32) == 0) {
#ifndef XEN
wrmsr(MSR_FSBASE, 0);
wrmsr(MSR_KERNELGSBASE, 0);
Home |
Main Index |
Thread Index |
Old Index