]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/AT386/himem.c
xnu-792.25.20.tar.gz
[apple/xnu.git] / osfmk / i386 / AT386 / himem.c
index f9abdb912dc39a6c2b67171c8cd7a20d548c6044..c01c1f37e0275c4fb0179f106c6ecd49bd41883b 100644 (file)
 #include <mach/boolean.h>
 #include <kern/misc_protos.h>
 #include <i386/AT386/misc_protos.h>
+#include <i386/pmap.h>
 
 hil_t          hil_head;
 decl_simple_lock_data(,hil_lock)
@@ -151,7 +152,7 @@ void
 himem_init(
        void)
 {
-       simple_lock_init(&hil_lock, ETAP_VM_HIMEM);
+       simple_lock_init(&hil_lock, 0);
 }
 
 /* 
@@ -168,10 +169,11 @@ himem_reserve(
        vm_page_t               low;
        hil_t                   hil;
        spl_t                   ipl;
-       extern vm_offset_t      avail_end;
+       extern pmap_paddr_t_t   avail_end;
 
        if (avail_end <= HIGH_MEM)
                return;
+       kprintf("looking for low mem pages\n");
        hil = (hil_t)kalloc(npages*sizeof(struct himem_link));
        if (hil == (hil_t)0) 
                panic("himem_reserve: kalloc failed\n");
@@ -195,7 +197,7 @@ himem_reserve(
                        i++;
                }
        }
-
+       kprintf("freeing high pages back\n");
        for (low = free_head; low; low = free_head) {
                free_head = (vm_page_t) low->pageq.next;
                VM_PAGE_FREE(low);
@@ -248,7 +250,7 @@ himem_convert(
        h->high_addr = phys_addr;
 
        if (io_op == D_WRITE) {
-         bcopy((char *)phystokv(phys_addr), (char *)phystokv(h->low_page + offset),
+         bcopy_phys((addr64_t)phys_addr, (addr64_t)(h->low_page + offset),
                length);
          h->length = 0;
        } else {
@@ -279,8 +281,8 @@ himem_revert(
 
        while(hil) {
                if (hil->length) {
-                       bcopy((char *)phystokv(hil->low_page + hil->offset),
-                               (char *)phystokv(hil->high_addr),
+                       bcopy_phys((addr64_t)hil->low_page + hil->offset),
+                               (addr64_t)(hil->high_addr),
                              hil->length);
                }
                hil->high_addr = 0;