bug-hurd
[Top][All Lists]
Advanced

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

Re: proxy memory objects patch


From: Thomas Bushnell, BSG
Subject: Re: proxy memory objects patch
Date: 20 Nov 2002 17:20:17 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

The implementation of memory_object_create_proxy should allow a proxy
object to be passed as the value of OBJECT, and dereference it, and
then make a proxy object with the minimum set of the two.

Note that if you add the range-restriction to this, the result will be
that proxy objects need to specify a *list* of permitted ranges, since
you might restrict to one range, and then restrict out a slice from
the middle of that.

Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:

> +/* Create a new proxy memory object from OBJECT with the maximum
> +   protection MAX_PROTECTION and return it in *PORT.  */
> +kern_return_t
> +memory_object_create_proxy (ipc_space_t space, ipc_port_t object,
> +                         vm_prot_t max_protection, ipc_port_t *port)
> +{
> +  kern_return_t kr;
> +  memory_object_proxy_t proxy;
> +  ipc_port_t notify;
> +
> +  if (space == IS_NULL)
> +    return KERN_INVALID_TASK;
> +
> +  if (!IP_VALID(object))
> +    return KERN_INVALID_NAME;
> +
> +  proxy = (memory_object_proxy_t) zalloc (memory_object_proxy_zone);
> +
> +  /* Allocate port, keeping a reference for it.  */
> +  proxy->port = ipc_port_alloc_kernel ();
> +  if (proxy->port == IP_NULL)
> +    {
> +      zfree (memory_object_proxy_zone, (vm_offset_t) proxy);
> +      return KERN_RESOURCE_SHORTAGE;
> +    }
> +  /* Associate the port with the proxy memory object.  */
> +  ipc_kobject_set (proxy->port, (ipc_kobject_t) proxy, IKOT_PAGER_PROXY);
> +
> +  /* Request no-senders notifications on the port.  */
> +  notify = ipc_port_make_sonce (proxy->port);
> +  ip_lock (proxy->port);
> +  ipc_port_nsrequest (proxy->port, 1, notify, &notify);
> +  assert (notify == IP_NULL);
> +
> +  proxy->object = ipc_port_copy_send (object);
> +  proxy->max_protection = max_protection;
> +
> +  *port = ipc_port_make_send (proxy->port);
> +  return KERN_SUCCESS;
> +}





reply via email to

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