summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i386/i386/phys.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/i386/i386/phys.c b/i386/i386/phys.c
index 3af508f..d55bdd9 100644
--- a/i386/i386/phys.c
+++ b/i386/i386/phys.c
@@ -52,8 +52,9 @@ pmap_zero_page(vm_offset_t p)
assert(p != vm_page_fictitious_addr);
vm_offset_t v;
pmap_mapwindow_t *map;
+ boolean_t mapped = p >= phys_last_addr;
- if (p >= phys_last_addr)
+ if (mapped)
{
map = pmap_get_mapwindow(INTEL_PTE_W(p));
v = map->vaddr;
@@ -63,7 +64,7 @@ pmap_zero_page(vm_offset_t p)
memset((void*) v, 0, PAGE_SIZE);
- if (p >= phys_last_addr)
+ if (mapped)
pmap_put_mapwindow(map);
}
@@ -77,10 +78,12 @@ pmap_copy_page(
{
vm_offset_t src_addr_v, dst_addr_v;
pmap_mapwindow_t *src_map, *dst_map;
+ boolean_t src_mapped = src >= phys_last_addr;
+ boolean_t dst_mapped = dst >= phys_last_addr;
assert(src != vm_page_fictitious_addr);
assert(dst != vm_page_fictitious_addr);
- if (src >= phys_last_addr)
+ if (src_mapped)
{
src_map = pmap_get_mapwindow(INTEL_PTE_R(src));
src_addr_v = src_map->vaddr;
@@ -88,7 +91,7 @@ pmap_copy_page(
else
src_addr_v = phystokv(src);
- if (dst >= phys_last_addr)
+ if (dst_mapped)
{
dst_map = pmap_get_mapwindow(INTEL_PTE_W(dst));
dst_addr_v = dst_map->vaddr;
@@ -98,9 +101,9 @@ pmap_copy_page(
memcpy((void *) dst_addr_v, (void *) src_addr_v, PAGE_SIZE);
- if (src >= phys_last_addr)
+ if (src_mapped)
pmap_put_mapwindow(src_map);
- if (dst >= phys_last_addr)
+ if (dst_mapped)
pmap_put_mapwindow(dst_map);
}
@@ -117,10 +120,11 @@ copy_to_phys(
{
vm_offset_t dst_addr_v;
pmap_mapwindow_t *dst_map;
+ boolean_t mapped = dst_addr_p >= phys_last_addr;
assert(dst_addr_p != vm_page_fictitious_addr);
assert(pa_to_pte(dst_addr_p + count-1) == pa_to_pte(dst_addr_p));
- if (dst_addr_p >= phys_last_addr)
+ if (mapped)
{
dst_map = pmap_get_mapwindow(INTEL_PTE_W(dst_addr_p));
dst_addr_v = dst_map->vaddr;
@@ -130,7 +134,7 @@ copy_to_phys(
memcpy((void *)dst_addr_v, (void *)src_addr_v, count);
- if (dst_addr_p >= phys_last_addr)
+ if (mapped)
pmap_put_mapwindow(dst_map);
}
@@ -148,10 +152,11 @@ copy_from_phys(
{
vm_offset_t src_addr_v;
pmap_mapwindow_t *src_map;
+ boolean_t mapped = src_addr_p >= phys_last_addr;
assert(src_addr_p != vm_page_fictitious_addr);
assert(pa_to_pte(src_addr_p + count-1) == pa_to_pte(src_addr_p));
- if (src_addr_p >= phys_last_addr)
+ if (mapped)
{
src_map = pmap_get_mapwindow(INTEL_PTE_R(src_addr_p));
src_addr_v = src_map->vaddr;
@@ -161,7 +166,7 @@ copy_from_phys(
memcpy((void *)dst_addr_v, (void *)src_addr_v, count);
- if (src_addr_p >= phys_last_addr)
+ if (mapped)
pmap_put_mapwindow(src_map);
}