diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-30 17:17:28 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-11-30 17:17:28 +0000 |
commit | 89f64447946ccfaa906987c3ce72ab3788c5705d (patch) | |
tree | 55a66e274d0f303a448427df745bc3e278763dbb /extras | |
parent | f446b44935ec9e42dba073dccffec738a5feaa37 (diff) | |
download | xen-89f64447946ccfaa906987c3ce72ab3788c5705d.tar.gz xen-89f64447946ccfaa906987c3ce72ab3788c5705d.tar.bz2 xen-89f64447946ccfaa906987c3ce72ab3788c5705d.zip |
[MINIOS] Improved unbind_all_ports().
Signed-off-by: Jacob Gorm Hansen <jacobg@diku.dk>
Diffstat (limited to 'extras')
-rw-r--r-- | extras/mini-os/events.c | 27 | ||||
-rw-r--r-- | extras/mini-os/include/events.h | 1 |
2 files changed, 16 insertions, 12 deletions
diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c index 5d60ab70fc..dad8e42377 100644 --- a/extras/mini-os/events.c +++ b/extras/mini-os/events.c @@ -31,26 +31,27 @@ typedef struct _ev_action_t { u32 count; } ev_action_t; - static ev_action_t ev_actions[NR_EVS]; void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data); +static unsigned long bound_ports[NR_EVS/(8*sizeof(unsigned long))]; + void unbind_all_ports(void) { int i; - for(i=0;i<NR_EVS;i++) - { - if(ev_actions[i].handler != default_handler) - { - struct evtchn_close close; - mask_evtchn(i); - close.port = i; - HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); - } - } + for (i = 0; i < NR_EVS; i++) + { + if (test_and_clear_bit(i, bound_ports)) + { + struct evtchn_close close; + mask_evtchn(i); + close.port = i; + HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); + } + } } - + /* * Demux events to different handlers. */ @@ -114,6 +115,7 @@ int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data) printk("Failed to bind virtual IRQ %d\n", virq); return 1; } + set_bit(op.port,bound_ports); bind_evtchn(op.port, handler, data); return 0; } @@ -188,6 +190,7 @@ int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port, int err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op); if (err) return err; + set_bit(op.local_port,bound_ports); evtchn_port_t port = op.local_port; clear_evtchn(port); /* Without, handler gets invoked now! */ *local_port = bind_evtchn(port, handler, data); diff --git a/extras/mini-os/include/events.h b/extras/mini-os/include/events.h index 45b47c1549..5cc9fa8a9f 100644 --- a/extras/mini-os/include/events.h +++ b/extras/mini-os/include/events.h @@ -36,6 +36,7 @@ int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler, int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port, evtchn_handler_t handler, void *data, evtchn_port_t *local_port); +void unbind_all_ports(void); static inline int notify_remote_via_evtchn(evtchn_port_t port) { |