SCCS-vsn: sys/i386/i386/vm_machdep.c 5.3
*
* %sccs.include.386.c%
*
*
* %sccs.include.386.c%
*
- * @(#)vm_machdep.c 5.2 (Berkeley) %G%
+ * @(#)vm_machdep.c 5.3 (Berkeley) %G%
+ */
+
+/*
+ * Copyright (c) 1989, 1990 William F. Jolitz
#include "buf.h"
#include "dbg.h"
#include "buf.h"
#include "dbg.h"
+
+#define load_cr3(s) {long phys; \
+ phys = (long)(s) /*| 0x80000000 */ ;\
+ __asm ( "movl %0,%%eax; movl %%eax,%%cr3" : : "g" (phys) : "ax" ) ; }
+
/*
* Set a red zone in the kernel stack after the u. area.
*/
/*
* Set a red zone in the kernel stack after the u. area.
*/
#ifdef lint
pte = pte;
#endif
#ifdef lint
pte = pte;
#endif
+ load_cr3(u.u_pcb.pcb_ptd);
}
*(u_int *)pte &= ~PG_PROT;
*(u_int *)pte |= tprot;
}
*(u_int *)pte &= ~PG_PROT;
*(u_int *)pte |= tprot;
+ load_cr3(u.u_pcb.pcb_ptd);
ptaddr[i] &= ~PG_PROT;
ptaddr[i] |= tprot;
}
ptaddr[i] &= ~PG_PROT;
ptaddr[i] |= tprot;
}
+ load_cr3(u.u_pcb.pcb_ptd);
*(u_int *)pte++ = 0;
} while (--change);
/* short cut newptes */
*(u_int *)pte++ = 0;
} while (--change);
/* short cut newptes */
+ load_cr3(u.u_pcb.pcb_ptd);
+ load_cr3(u.u_pcb.pcb_ptd);
if (size % CLBYTES)
panic("pagemove");
if (size % CLBYTES)
panic("pagemove");
- fpte = &Sysmap[btop(from)];
- tpte = &Sysmap[btop(to)];
+ fpte = &Sysmap[btop(from-0xfe000000)];
+ tpte = &Sysmap[btop(to-0xfe000000)];
while (size > 0) {
*tpte++ = *fpte;
*(int *)fpte++ = 0;
while (size > 0) {
*tpte++ = *fpte;
*(int *)fpte++ = 0;
to += NBPG;
size -= NBPG;
}
to += NBPG;
size -= NBPG;
}
+ load_cr3(u.u_pcb.pcb_ptd);
initcr3(p)
register struct proc *p;
{
initcr3(p)
register struct proc *p;
{
- return((int)Usrptmap[btokmx(p->p_p0br) + p->p_szpt].pg_pfnum);
+ return(ctob(Usrptmap[btokmx(p->p_p0br+p->p_szpt*NPTEPG)].pg_pfnum));
+ /*return((int)Usrptmap[btokmx(p->p_p0br) + p->p_szpt].pg_pfnum);*/
/*pg("initpdt");*/
/* clear entire map */
pde = vtopde(p, 0);
/*pg("initpdt");*/
/* clear entire map */
pde = vtopde(p, 0);
/* map kernel */
pde = vtopde(p, &Sysbase);
for (i = 0; i < 5; i++, pde++) {
/* map kernel */
pde = vtopde(p, &Sysbase);
for (i = 0; i < 5; i++, pde++) {
pde->pd_pfnum = Usrptmap[k++].pg_pfnum;
/*pg("pde %x pf %x", pde, *(int *)pde);*/
}
pde->pd_pfnum = Usrptmap[k++].pg_pfnum;
/*pg("pde %x pf %x", pde, *(int *)pde);*/
}
+ load_cr3(u.u_pcb.pcb_ptd);
a = ((bp - swbuf) * CLSIZE) * KLMAX;
bp->b_un.b_addr = (caddr_t)ctob(dptov(&proc[2], a));
}
a = ((bp - swbuf) * CLSIZE) * KLMAX;
bp->b_un.b_addr = (caddr_t)ctob(dptov(&proc[2], a));
}
+ load_cr3(u.u_pcb.pcb_ptd);