From aa3780032d1da66a1d0990ae519cc1f5d975d0e6 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 11 Nov 2008 02:24:18 +0000 Subject: 2008-11-10 Samuel Thibault * i386/i386/i386asm.sym (PTE_SIZE): New assembly macro. * i386/i386/locore.S (copyout_retry): take PTE_SIZE into account. * i386/intel/pmap.c (pmap_bootstrap, pmap_create): Use WRITE_PTE instead of dereference. --- i386/i386/i386asm.sym | 2 ++ i386/i386/locore.S | 6 +++--- i386/intel/pmap.c | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'i386') diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym index f31341e..45f210e 100644 --- a/i386/i386/i386asm.sym +++ b/i386/i386/i386asm.sym @@ -99,6 +99,8 @@ expr PDEMASK expr PTESHIFT expr PTEMASK +expr sizeof(pt_entry_t) PTE_SIZE + expr INTEL_PTE_PFN PTE_PFN expr INTEL_PTE_VALID PTE_V expr INTEL_PTE_WRITE PTE_W diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 2228482..9561a82 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -1270,7 +1270,7 @@ copyout_retry: #if PAE movl %edi,%eax /* get page directory pointer bits */ shrl $(PDPSHIFT),%eax /* from user address */ - movl KERNELBASE(%ecx,%eax,4),%ecx + movl KERNELBASE(%ecx,%eax,PTE_SIZE),%ecx /* get page directory pointer */ andl $(PTE_PFN),%ecx /* isolate page frame address */ #endif /* PAE */ @@ -1279,7 +1279,7 @@ copyout_retry: #if PAE andl $(PDEMASK),%eax #endif /* PAE */ - movl KERNELBASE(%ecx,%eax,4),%ecx + movl KERNELBASE(%ecx,%eax,PTE_SIZE),%ecx /* get page directory pointer */ testl $(PTE_V),%ecx /* present? */ jz 0f /* if not, fault is OK */ @@ -1287,7 +1287,7 @@ copyout_retry: movl %edi,%eax /* get page table bits */ shrl $(PTESHIFT),%eax andl $(PTEMASK),%eax /* from user address */ - leal KERNELBASE(%ecx,%eax,4),%ecx + leal KERNELBASE(%ecx,%eax,PTE_SIZE),%ecx /* point to page table entry */ movl (%ecx),%eax /* get it */ testl $(PTE_V),%eax /* present? */ diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index a648592..697e5f8 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -589,7 +589,7 @@ void pmap_bootstrap() { int i; for (i = 0; i < PDPNUM; i++) - kernel_pmap->pdpbase[i] = pa_to_pte((vm_offset_t) kernel_pmap->dirbase + i * INTEL_PGBYTES) | INTEL_PTE_VALID; + WRITE_PTE(&kernel_pmap->pdpbase[i], pa_to_pte((vm_offset_t) kernel_pmap->dirbase + i * INTEL_PGBYTES) | INTEL_PTE_VALID); } #else /* PAE */ kernel_pmap->dirbase = kernel_page_dir = (pt_entry_t*)pmap_grab_page(); @@ -625,8 +625,8 @@ void pmap_bootstrap() pt_entry_t *pte; /* Initialize the page directory entry. */ - *pde = pa_to_pte((vm_offset_t)ptable) - | INTEL_PTE_VALID | INTEL_PTE_WRITE | global; + WRITE_PTE(pde, pa_to_pte((vm_offset_t)ptable) + | INTEL_PTE_VALID | INTEL_PTE_WRITE); /* Initialize the page table. */ for (pte = ptable; (va < phys_last_addr) && (pte < ptable+NPTES); pte++) @@ -887,7 +887,7 @@ pmap_t pmap_create(size) { int i; for (i = 0; i < PDPNUM; i++) - p->pdpbase[i] = pa_to_pte(kvtophys((vm_offset_t) p->dirbase + i * INTEL_PGBYTES)) | INTEL_PTE_VALID; + WRITE_PTE(&p->pdpbase[i], pa_to_pte(kvtophys((vm_offset_t) p->dirbase + i * INTEL_PGBYTES)) | INTEL_PTE_VALID); } #endif /* PAE */ -- cgit v1.2.3