Module Name: src
Committed By: ad
Date: Wed May 27 19:40:30 UTC 2020
Modified Files:
src/sys/arch/x86/x86: svs.c
Log Message:
svs_pdir_switch(): Use MOVS to copy the PTES.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/svs.c
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/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.36 src/sys/arch/x86/x86/svs.c:1.37
--- src/sys/arch/x86/x86/svs.c:1.36 Wed May 27 19:15:08 2020
+++ src/sys/arch/x86/x86/svs.c Wed May 27 19:40:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $ */
+/* $NetBSD: svs.c,v 1.37 2020/05/27 19:40:29 ad Exp $ */
/*
* Copyright (c) 2018-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.36 2020/05/27 19:15:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.37 2020/05/27 19:40:29 ad Exp $");
#include "opt_svs.h"
#include "opt_user_ldt.h"
@@ -682,28 +682,16 @@ svs_lwp_switch(struct lwp *oldlwp, struc
}
}
-static inline pt_entry_t
-svs_pte_atomic_read(struct pmap *pmap, size_t idx)
-{
- /*
- * XXX: We don't have a basic atomic_fetch_64 function?
- */
- return atomic_cas_64(&pmap->pm_pdir[idx], 666, 666);
-}
-
/*
- * We may come here with the pmap unlocked. So read its PTEs atomically. If
- * a remote CPU is updating them at the same time, it's not a problem: the
- * remote CPU will call svs_pmap_sync afterwards, and our updirpa will be
- * synchronized properly.
+ * We may come here with the pmap unlocked. If a remote CPU is updating
+ * them at the same time, it's not a problem: the remote CPU will call
+ * svs_pmap_sync afterwards, and our updirpa will be synchronized properly.
*/
void
svs_pdir_switch(struct pmap *pmap)
{
struct cpu_info *ci = curcpu();
struct svs_utls *utls;
- pt_entry_t pte;
- size_t i;
KASSERT(kpreempt_disabled());
KASSERT(pmap != pmap_kernel());
@@ -712,14 +700,9 @@ svs_pdir_switch(struct pmap *pmap)
utls = (struct svs_utls *)ci->ci_svs_utls;
utls->kpdirpa = pmap_pdirpa(pmap, 0) | svs_pcid_kcr3;
+ /* Copy user slots. */
mutex_enter(&ci->ci_svs_mtx);
-
- /* User slots. */
- for (i = 0; i < PDIR_SLOT_USERLIM; i++) {
- pte = svs_pte_atomic_read(pmap, i);
- ci->ci_svs_updir[i] = pte;
- }
-
+ x86_movs(ci->ci_svs_updir, pmap->pm_pdir, PDIR_SLOT_USERLIM);
mutex_exit(&ci->ci_svs_mtx);
if (svs_pcid) {