]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/vm/device_vm.c
xnu-2422.90.20.tar.gz
[apple/xnu.git] / osfmk / vm / device_vm.c
index 4f32ac7231e356be82f06cab67d68ca11aaddf54..f3df12b70644fdf8122dbc8515d4ac96019ff780 100644 (file)
@@ -75,17 +75,18 @@ const struct memory_object_pager_ops device_pager_ops = {
        device_pager_synchronize,
        device_pager_map,
        device_pager_last_unmap,
+       NULL, /* data_reclaim */
        "device pager"
 };
 
-typedef int device_port_t;
+typedef uintptr_t device_port_t;
 
 /*
  * The start of "struct device_pager" MUST match a "struct memory_object".
  */
 typedef struct device_pager {
+       struct ipc_object_header        pager_header;   /* fake ip_kotype()     */
        memory_object_pager_ops_t pager_ops; /* == &device_pager_ops    */
-       unsigned int    pager_ikot;     /* fake ip_kotype()             */
        unsigned int    ref_count;      /* reference count              */
        memory_object_control_t control_handle; /* mem object's cntrl handle */
        device_port_t   device_handle;  /* device_handle */
@@ -93,7 +94,7 @@ typedef struct device_pager {
        int             flags;
 } *device_pager_t;
 
-
+#define pager_ikot pager_header.io_bits
 
 
 device_pager_t
@@ -126,7 +127,7 @@ device_pager_bootstrap(void)
        size = (vm_size_t) sizeof(struct device_pager);
        device_pager_zone = zinit(size, (vm_size_t) MAX_DNODE*size,
                                PAGE_SIZE, "device node pager structures");
-
+       zone_change(device_pager_zone, Z_CALLERACCT, FALSE);
        return;
 }
 
@@ -136,7 +137,7 @@ device_pager_bootstrap(void)
 memory_object_t
 device_pager_setup(
        __unused memory_object_t device,
-       int             device_handle,
+       uintptr_t               device_handle,
        vm_size_t       size,
        int             flags)
 {
@@ -184,10 +185,12 @@ device_pager_populate_object(
 
        if(!vm_object->phys_contiguous) {
                unsigned int null_size = 0;
+               assert((upl_size_t) size == size);
                kr = vm_object_upl_request(vm_object,
-                       (vm_object_offset_t)offset, size, &upl,  NULL,
-                       &null_size, (UPL_NO_SYNC | UPL_CLEAN_IN_PLACE)); 
-
+                                          (vm_object_offset_t)offset,
+                                          (upl_size_t) size, &upl,  NULL,
+                                          &null_size,
+                                          (UPL_NO_SYNC | UPL_CLEAN_IN_PLACE));
                if(kr != KERN_SUCCESS)
                        panic("device_pager_populate_object: list_req failed");
 
@@ -220,7 +223,7 @@ kern_return_t
 device_pager_init(
        memory_object_t mem_obj, 
        memory_object_control_t control, 
-       __unused vm_size_t pg_size)
+       __unused memory_object_cluster_size_t pg_size)
 {
        device_pager_t   device_object;
        kern_return_t   kr;
@@ -278,7 +281,7 @@ kern_return_t
 device_pager_data_return(
        memory_object_t                 mem_obj,
        memory_object_offset_t          offset,
-       vm_size_t                       data_cnt,
+       memory_object_cluster_size_t                    data_cnt,
        __unused memory_object_offset_t *resid_offset,
        __unused int                    *io_error,
        __unused boolean_t              dirty,
@@ -304,7 +307,7 @@ kern_return_t
 device_pager_data_request(
        memory_object_t         mem_obj,
        memory_object_offset_t  offset,
-       vm_size_t               length,
+       memory_object_cluster_size_t            length,
        __unused vm_prot_t      protection_required,
         __unused memory_object_fault_info_t    fault_info)
 {
@@ -376,7 +379,7 @@ kern_return_t
 device_pager_data_initialize(
         __unused memory_object_t               mem_obj,
         __unused memory_object_offset_t        offset,
-        __unused vm_size_t             data_cnt)
+        __unused memory_object_cluster_size_t          data_cnt)
 {
        panic("device_pager_data_initialize");
        return KERN_FAILURE;
@@ -386,7 +389,7 @@ kern_return_t
 device_pager_data_unlock(
        __unused memory_object_t                mem_obj,
        __unused memory_object_offset_t offset,
-       __unused vm_size_t              size,
+       __unused memory_object_size_t           size,
        __unused vm_prot_t              desired_access)
 {
        return KERN_FAILURE;
@@ -408,7 +411,7 @@ kern_return_t
 device_pager_synchronize(
        memory_object_t         mem_obj,
        memory_object_offset_t  offset,
-       vm_offset_t             length,
+       memory_object_size_t            length,
        __unused vm_sync_t              sync_flags)
 {
        device_pager_t  device_object;