summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-11-11 02:24:18 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:27:20 +0200
commitaa3780032d1da66a1d0990ae519cc1f5d975d0e6 (patch)
tree1316f73db1716a311cdd519992fbfd8885d9e9e3 /i386
parenta652906986e061b69fee367ff20a87d2a6b16dd3 (diff)
2008-11-10 Samuel Thibault <samuel.thibault@ens-lyon.org>
* 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.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/i386asm.sym2
-rw-r--r--i386/i386/locore.S6
-rw-r--r--i386/intel/pmap.c8
3 files changed, 9 insertions, 7 deletions
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 */