sync with arch/i386/i386/pmap.c:
1.172/yamt - keep cr3 register and its copy in TSS synchronized. - defer LDTR loading as well as cr3.
This commit is contained in:
parent
1cfcb16460
commit
e688fd0596
|
@ -1,5 +1,5 @@
|
|||
/* $NetBSD: pmap.c,v 1.2 2004/04/10 23:31:41 cl Exp $ */
|
||||
/* NetBSD: pmap.c,v 1.171 2004/02/20 17:35:01 yamt Exp */
|
||||
/* $NetBSD: pmap.c,v 1.3 2004/04/17 12:53:27 cl Exp $ */
|
||||
/* NetBSD: pmap.c,v 1.172 2004/04/12 13:17:46 yamt Exp */
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.2 2004/04/10 23:31:41 cl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3 2004/04/17 12:53:27 cl Exp $");
|
||||
|
||||
#include "opt_cputype.h"
|
||||
#include "opt_user_ldt.h"
|
||||
|
@ -2076,12 +2076,11 @@ pmap_activate(l)
|
|||
struct lwp *l;
|
||||
{
|
||||
struct cpu_info *ci = curcpu();
|
||||
struct pcb *pcb = &l->l_addr->u_pcb;
|
||||
struct pmap *pmap = vm_map_pmap(&l->l_proc->p_vmspace->vm_map);
|
||||
|
||||
pcb->pcb_ldt_sel = pmap->pm_ldt_sel;
|
||||
pcb->pcb_cr3 = pmap->pm_pdirpa;
|
||||
if (l == ci->ci_curlwp) {
|
||||
struct pcb *pcb;
|
||||
|
||||
KASSERT(ci->ci_want_pmapload == 0);
|
||||
KASSERT(ci->ci_tlbstate != TLBSTATE_VALID);
|
||||
#ifdef KSTACK_CHECK_DR0
|
||||
|
@ -2104,6 +2103,9 @@ pmap_activate(l)
|
|||
return;
|
||||
}
|
||||
|
||||
pcb = &l->l_addr->u_pcb;
|
||||
pcb->pcb_ldt_sel = pmap->pm_ldt_sel;
|
||||
|
||||
ci->ci_want_pmapload = 1;
|
||||
}
|
||||
}
|
||||
|
@ -2156,6 +2158,7 @@ pmap_load()
|
|||
struct pmap *pmap;
|
||||
struct pmap *oldpmap;
|
||||
struct lwp *l;
|
||||
struct pcb *pcb;
|
||||
int s;
|
||||
|
||||
KASSERT(ci->ci_want_pmapload);
|
||||
|
@ -2166,8 +2169,10 @@ pmap_load()
|
|||
KASSERT(pmap != pmap_kernel());
|
||||
oldpmap = ci->ci_pmap;
|
||||
|
||||
KASSERT(pmap->pm_ldt_sel == l->l_addr->u_pcb.pcb_ldt_sel);
|
||||
lldt(pmap->pm_ldt_sel);
|
||||
pcb = ci->ci_curpcb;
|
||||
KASSERT(pcb == &l->l_addr->u_pcb);
|
||||
/* loaded by pmap_activate */
|
||||
KASSERT(pcb->pcb_ldt_sel == pmap->pm_ldt_sel);
|
||||
|
||||
if (pmap == oldpmap) {
|
||||
if (!pmap_reactivate(pmap)) {
|
||||
|
@ -2205,9 +2210,21 @@ pmap_load()
|
|||
ci->ci_pmap = pmap;
|
||||
ci->ci_tlbstate = TLBSTATE_VALID;
|
||||
splx(s);
|
||||
|
||||
/*
|
||||
* clear apdp slot before loading %cr3 since Xen only allows
|
||||
* linear pagetable mappings in the current pagetable.
|
||||
*/
|
||||
KDASSERT(curapdp == 0);
|
||||
PDE_CLEAR(APDP_PDE);
|
||||
lcr3(pmap->pm_pdirpa);
|
||||
|
||||
/*
|
||||
* update tss and load corresponding registers.
|
||||
*/
|
||||
|
||||
lldt(pcb->pcb_ldt_sel);
|
||||
pcb->pcb_cr3 = pmap->pm_pdirpa;
|
||||
lcr3(pcb->pcb_cr3);
|
||||
|
||||
ci->ci_want_pmapload = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue