When generating stubs, Mig will will take the vm_size_array_t and define the
input request struct using rpc_vm_size_t since the size is variable. This will 
turn cause a mismatch
between types (vm_size_t* vs rpc_vm_size_t*). We could also ask Mig to produce
a prototype by using rpc_vm_size_t*, however we would need to change the 
implementation
of the RPC to use rpc_* types anyway since we want to avoid another allocation
of the array.
---
 i386/include/mach/i386/vm_types.h |  3 +++
 include/mach/mach4.defs           |  8 +++++---
 vm/memory_object_proxy.c          |  6 +++---
 vm/memory_object_proxy.h          |  8 --------
 vm/vm_map.c                       | 13 +++++++------
 5 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/i386/include/mach/i386/vm_types.h 
b/i386/include/mach/i386/vm_types.h
index 663f920a..bd07ef26 100644
--- a/i386/include/mach/i386/vm_types.h
+++ b/i386/include/mach/i386/vm_types.h
@@ -158,6 +158,9 @@ typedef long_integer_t rpc_long_integer_t;
 #define convert_long_natural_to_user convert_vm_to_user
 #define convert_long_natural_from_user convert_vm_from_user
 
+typedef        rpc_vm_size_t * rpc_vm_size_array_t;
+typedef        rpc_vm_offset_t *       rpc_vm_offset_array_t;
+
 #endif /* __ASSEMBLER__ */
 
 /*
diff --git a/include/mach/mach4.defs b/include/mach/mach4.defs
index 53cca7d3..d63d6f77 100644
--- a/include/mach/mach4.defs
+++ b/include/mach/mach4.defs
@@ -108,14 +108,16 @@ skip      /* pc_sampling reserved 4*/;
    protection MAX_PROTECTION and return it in *PORT.  */
 type vm_offset_array_t = array[*:1024] of vm_offset_t;
 type vm_size_array_t = array[*:1024] of vm_size_t;
+type rpc_vm_size_array_t = array[*:1024] of rpc_vm_size_t;
+type rpc_vm_offset_array_t = array[*:1024] of rpc_vm_offset_t;
 routine memory_object_create_proxy(
                task            : ipc_space_t;
                max_protection  : vm_prot_t;
                object          : memory_object_array_t =
                                  array[*:1024] of mach_port_send_t;
-               offset          : vm_offset_array_t;
-               start           : vm_offset_array_t;
-               len             : vm_size_array_t;
+               offset          : rpc_vm_offset_array_t;
+               start           : rpc_vm_offset_array_t;
+               len             : rpc_vm_size_array_t;
                out proxy       : mach_port_t);
 
 /* Gets a proxy to the region that ADDRESS belongs to, starting at the region
diff --git a/vm/memory_object_proxy.c b/vm/memory_object_proxy.c
index 46a57932..0f1e75e5 100644
--- a/vm/memory_object_proxy.c
+++ b/vm/memory_object_proxy.c
@@ -133,9 +133,9 @@ memory_object_proxy_notify (mach_msg_header_t *msg)
 kern_return_t
 memory_object_create_proxy (ipc_space_t space, vm_prot_t max_protection,
                            ipc_port_t *object, natural_t object_count,
-                           vm_offset_t *offset, natural_t offset_count,
-                           vm_offset_t *start, natural_t start_count,
-                           vm_size_t *len, natural_t len_count,
+                           rpc_vm_offset_t *offset, natural_t offset_count,
+                           rpc_vm_offset_t *start, natural_t start_count,
+                           rpc_vm_size_t *len, natural_t len_count,
                            ipc_port_t *port)
 {
   memory_object_proxy_t proxy;
diff --git a/vm/memory_object_proxy.h b/vm/memory_object_proxy.h
index 97f20b36..8b3f2025 100644
--- a/vm/memory_object_proxy.h
+++ b/vm/memory_object_proxy.h
@@ -36,12 +36,4 @@ extern kern_return_t memory_object_proxy_lookup (ipc_port_t 
port,
                                                  vm_offset_t *start,
                                                  vm_offset_t *len);
 
-extern kern_return_t
-memory_object_create_proxy (ipc_space_t space, vm_prot_t max_protection,
-                           ipc_port_t *object, natural_t object_count,
-                           vm_offset_t *offset, natural_t offset_count,
-                           vm_offset_t *start, natural_t start_count,
-                           vm_size_t *len, natural_t len_count,
-                           ipc_port_t *port);
-
 #endif /* _VM_MEMORY_OBJECT_PROXY_H_ */
diff --git a/vm/vm_map.c b/vm/vm_map.c
index bea84a4d..23c4c296 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -4804,7 +4804,8 @@ vm_region_create_proxy (task_t task, vm_address_t address,
   kern_return_t ret;
   vm_map_entry_t entry, tmp_entry;
   vm_object_t object;
-  vm_offset_t offset, start;
+  rpc_vm_offset_t rpc_offset, rpc_start;
+  rpc_vm_size_t rpc_len = (rpc_vm_size_t) len;
   ipc_port_t pager;
 
   if (task == TASK_NULL)
@@ -4840,16 +4841,16 @@ vm_region_create_proxy (task_t task, vm_address_t 
address,
   pager = ipc_port_copy_send(object->pager);
   vm_object_unlock(object);
 
-  start = (address - entry->vme_start) + entry->offset;
-  offset = 0;
+  rpc_start = (address - entry->vme_start) + entry->offset;
+  rpc_offset = 0;
 
   vm_map_unlock_read(task->map);
 
   ret = memory_object_create_proxy(task->itk_space, max_protection,
                                    &pager, 1,
-                                   &offset, 1,
-                                   &start, 1,
-                                   &len, 1, port);
+                                   &rpc_offset, 1,
+                                   &rpc_start, 1,
+                                   &rpc_len, 1, port);
   if (ret)
     ipc_port_release_send(pager);
 
-- 
2.39.0


Reply via email to