aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/events.c
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-09-09 09:24:25 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-09-09 09:24:25 +0000
commitcdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8 (patch)
tree414d05b171df34e0125f29731a8ba12e280297d9 /extras/mini-os/events.c
parentc125eb9c047b908b2bb18e5cf4a88355a1526a25 (diff)
downloadxen-cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8.tar.gz
xen-cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8.tar.bz2
xen-cdb8b09f6b67b270b1c21f1a7f42d5e8a604caa8.zip
Xenbus implementation ported from Linux to Mini-os, simple thread support introduced
to simplify the porting. 64 bit version of Mini-os now compiles, but does not work because of the pagetables and some bits of scheduler not being written. Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
Diffstat (limited to 'extras/mini-os/events.c')
-rw-r--r--extras/mini-os/events.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c
index 8ca49d284b..5263c8757e 100644
--- a/extras/mini-os/events.c
+++ b/extras/mini-os/events.c
@@ -17,13 +17,13 @@
*/
#include <os.h>
+#include <mm.h>
#include <hypervisor.h>
#include <events.h>
#include <lib.h>
-#include <xen/event_channel.h>
static ev_action_t ev_actions[NR_EVS];
-void default_handler(u32 port, struct pt_regs *regs);
+void default_handler(int port, struct pt_regs *regs);
/*
@@ -32,7 +32,6 @@ void default_handler(u32 port, struct pt_regs *regs);
int do_event(u32 port, struct pt_regs *regs)
{
ev_action_t *action;
-
if (port >= NR_EVS) {
printk("Port number too large: %d\n", port);
return 0;
@@ -57,11 +56,23 @@ int do_event(u32 port, struct pt_regs *regs)
}
+void bind_evtchn( u32 port, void (*handler)(int, struct pt_regs *) )
+{
+ if(ev_actions[port].handler)
+ printk("WARN: Handler for port %d already registered, replacing\n",
+ port);
+
+ ev_actions[port].handler = handler;
+ ev_actions[port].status &= ~EVS_DISABLED;
+
+ /* Finally unmask the port */
+ unmask_evtchn(port);
+}
+
int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *) )
{
evtchn_op_t op;
int ret = 0;
- u32 port;
/* Try to bind the virq to a port */
op.cmd = EVTCHNOP_bind_virq;
@@ -73,22 +84,13 @@ int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *) )
printk("Failed to bind virtual IRQ %d\n", virq);
goto out;
}
-
- port = op.u.bind_virq.port;
-
- if(ev_actions[port].handler)
- printk("WARN: Handler for port %d already registered, replacing\n",
- port);
-
- ev_actions[port].handler = handler;
- ev_actions[port].status &= ~EVS_DISABLED;
-
- /* Finally unmask the port */
- unmask_evtchn(port);
+ bind_evtchn(op.u.bind_virq.port, handler);
out:
return ret;
}
+
+
/*
* Initially all events are without a handler and disabled
*/
@@ -100,10 +102,10 @@ void init_events(void)
for ( i = 0; i < NR_EVS; i++ )
{
ev_actions[i].status = EVS_DISABLED;
- ev_actions[i].handler = NULL;
+ ev_actions[i].handler = default_handler;
}
}
-void default_handler(u32 port, struct pt_regs *regs) {
+void default_handler(int port, struct pt_regs *regs) {
printk("[Port %d] - event received\n", port);
}