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 Zero out the scratch value in the UTLS ...
details: https://anonhg.NetBSD.org/src/rev/c3f3b146e235
branches: trunk
changeset: 359040:c3f3b146e235
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Jan 26 14:38:46 2018 +0000
description:
Zero out the scratch value in the UTLS page during context switches. We
temporarily put %rax there when processing syscalls, and we wouldn't
want the new lwp to see the %rax value of the previous lwp.
diffstat:
sys/arch/amd64/amd64/machdep.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r bd547bcc9cf8 -r c3f3b146e235 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Fri Jan 26 14:10:15 2018 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Fri Jan 26 14:38:46 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.295 2018/01/21 11:21:40 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.296 2018/01/26 14:38:46 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.295 2018/01/21 11:21:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.296 2018/01/26 14:38:46 maxv Exp $");
/* #define XENDEBUG_LOW */
@@ -2522,6 +2522,7 @@
svs_lwp_switch(struct lwp *oldlwp, struct lwp *newlwp)
{
struct cpu_info *ci = curcpu();
+ struct svs_utls *utls;
struct pcb *pcb;
pt_entry_t *pte;
uintptr_t rsp0;
@@ -2551,6 +2552,9 @@
KASSERT((ci->ci_svs_krsp0 % PAGE_SIZE) ==
(ci->ci_svs_ursp0 % PAGE_SIZE));
+ utls = (struct svs_utls *)ci->ci_svs_utls;
+ utls->scratch = 0;
+
/*
* Enter the user rsp0. We don't need to flush the TLB here, since
* the user page tables are not loaded.
Home |
Main Index |
Thread Index |
Old Index