bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] Handle proxy memory objects with offset


From: olafBuddenhagen
Subject: [PATCH 1/2] Handle proxy memory objects with offset
Date: Mon, 18 May 2009 07:47:40 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

diff --git a/vm/memory_object_proxy.c b/vm/memory_object_proxy.c
index 4d81a68..3474cd1 100644
--- a/vm/memory_object_proxy.c
+++ b/vm/memory_object_proxy.c
@@ -54,6 +54,7 @@ struct memory_object_proxy
 
   ipc_port_t object;
   vm_prot_t max_protection;
+  vm_offset_t offset;
 };
 typedef struct memory_object_proxy *memory_object_proxy_t;
 
@@ -143,10 +144,6 @@ memory_object_create_proxy (ipc_space_t space, vm_prot_t 
max_protection,
   if (!IP_VALID(object[0]))
     return KERN_INVALID_NAME;
 
-  /* FIXME: Support a different offset from 0.  */
-  if (offset[0] != 0)
-    return KERN_INVALID_ARGUMENT;
-
   /* FIXME: Support a different range from total.  */
   if (start[0] != 0 || len[0] != (vm_offset_t) ~0)
     return KERN_INVALID_ARGUMENT;
@@ -171,13 +168,14 @@ memory_object_create_proxy (ipc_space_t space, vm_prot_t 
max_protection,
 
   proxy->object = ipc_port_copy_send (object[0]);
   proxy->max_protection = max_protection;
+  proxy->offset = offset[0];
 
   *port = ipc_port_make_send (proxy->port);
   return KERN_SUCCESS;
 }
 
 
-/* Lookup the real memory object and maximum protection for the proxy
+/* Lookup the real memory object, maximum protection, and offset for the proxy
    memory object port PORT, for which the caller holds a reference.
    *OBJECT is only guaranteed to be valid as long as the caller holds
    the reference to PORT (unless the caller acquires its own reference
@@ -185,7 +183,7 @@ memory_object_create_proxy (ipc_space_t space, vm_prot_t 
max_protection,
    KERN_INVALID_ARGUMENT.  */
 kern_return_t
 memory_object_proxy_lookup (ipc_port_t port, ipc_port_t *object,
-                           vm_prot_t *max_protection)
+                           vm_prot_t *max_protection, vm_offset_t *offset)
 {
   memory_object_proxy_t proxy;
 
@@ -195,6 +193,7 @@ memory_object_proxy_lookup (ipc_port_t port, ipc_port_t 
*object,
 
    *object = proxy->object;
    *max_protection = proxy->max_protection;
+   *offset = proxy->offset;
 
   return KERN_SUCCESS;
 }
diff --git a/vm/vm_user.c b/vm/vm_user.c
index 672daab..522e1ed 100644
--- a/vm/vm_user.c
+++ b/vm/vm_user.c
@@ -280,7 +280,7 @@ kern_return_t vm_copy(map, source_address, size, 
dest_address)
 /* XXX From memory_object_proxy.c  */
 kern_return_t
 memory_object_proxy_lookup (ipc_port_t proxy_object, ipc_port_t *object,
-                            vm_prot_t *max_protection);
+                            vm_prot_t *max_protection, vm_offset_t *offset);
 
 /*
  *     Routine:        vm_map
@@ -334,8 +334,9 @@ kern_return_t vm_map(
          {
            ipc_port_t real_memobj;
            vm_prot_t prot;
+           vm_offset_t offs;
            result = memory_object_proxy_lookup (memory_object, &real_memobj,
-                                                &prot);
+                                                &prot, &offs);
            if (result != KERN_SUCCESS)
              return result;
 
@@ -343,6 +344,8 @@ kern_return_t vm_map(
            max_protection &= prot;
            cur_protection &= prot;
 
+           offset += offs;
+
            if ((object = vm_object_enter(real_memobj, size, FALSE))
                == VM_OBJECT_NULL)
              return KERN_INVALID_ARGUMENT;
-- 
1.5.6.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]