ia64/xen-unstable

changeset 10850:97ffb7856239

[MINI-OS] Extend alloc_unbound so that the remote domain isn't always dom0.

Signed-off-by: John D. Ramsdell <ramsdell@mitre.org>
Signed-off-by: Steven Smith <sos22@cam.ac.uk>
author sos22@douglas.cl.cam.ac.uk
date Fri Jul 28 14:03:54 2006 +0100 (2006-07-28)
parents 98a802d25848
children cbfced5fcdb3
files extras/mini-os/events.c extras/mini-os/include/events.h
line diff
     1.1 --- a/extras/mini-os/events.c	Fri Jul 28 14:02:49 2006 +0100
     1.2 +++ b/extras/mini-os/events.c	Fri Jul 28 14:03:54 2006 +0100
     1.3 @@ -141,25 +141,23 @@ void default_handler(evtchn_port_t port,
     1.4      printk("[Port %d] - event received\n", port);
     1.5  }
     1.6  
     1.7 +/* Create a port available to the pal for exchanging notifications.
     1.8 +   Returns the result of the hypervisor call. */
     1.9 +
    1.10  /* Unfortunate confusion of terminology: the port is unbound as far
    1.11     as Xen is concerned, but we automatically bind a handler to it
    1.12     from inside mini-os. */
    1.13 -evtchn_port_t evtchn_alloc_unbound(evtchn_handler_t handler, void *data)
    1.14 +
    1.15 +int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
    1.16 +						 void *data, evtchn_port_t *port)
    1.17  {
    1.18 -	evtchn_port_t port;
    1.19 -	evtchn_op_t op;
    1.20 -	int err;
    1.21 -
    1.22 -	op.cmd = EVTCHNOP_alloc_unbound;
    1.23 -	op.u.alloc_unbound.dom = DOMID_SELF;
    1.24 -	op.u.alloc_unbound.remote_dom = 0;
    1.25 -
    1.26 -	err = HYPERVISOR_event_channel_op(&op);
    1.27 -	if (err) {
    1.28 -		printk("Failed to alloc unbound evtchn: %d.\n", err);
    1.29 -		return -1;
    1.30 -	}
    1.31 -	port = op.u.alloc_unbound.port;
    1.32 -	bind_evtchn(port, handler, data);
    1.33 -	return port;
    1.34 +    evtchn_op_t op;
    1.35 +    op.cmd = EVTCHNOP_alloc_unbound;
    1.36 +    op.u.alloc_unbound.dom = DOMID_SELF;
    1.37 +    op.u.alloc_unbound.remote_dom = pal;
    1.38 +    int err = HYPERVISOR_event_channel_op(&op);
    1.39 +    if (err)
    1.40 +		return err;
    1.41 +    *port = bind_evtchn(op.u.alloc_unbound.port, handler, data);
    1.42 +    return err;
    1.43  }
     2.1 --- a/extras/mini-os/include/events.h	Fri Jul 28 14:02:49 2006 +0100
     2.2 +++ b/extras/mini-os/include/events.h	Fri Jul 28 14:03:54 2006 +0100
     2.3 @@ -31,8 +31,8 @@ evtchn_port_t bind_evtchn(evtchn_port_t 
     2.4  						  void *data);
     2.5  void unbind_evtchn(evtchn_port_t port);
     2.6  void init_events(void);
     2.7 -evtchn_port_t evtchn_alloc_unbound(evtchn_handler_t handler,
     2.8 -								   void *data);
     2.9 +int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
    2.10 +						 void *data, evtchn_port_t *port);
    2.11  
    2.12  static inline int notify_remote_via_evtchn(evtchn_port_t port)
    2.13  {