|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/7] mini-os: Moved events code under arch
From: Karim Raslan <karim.allah.ahmed@xxxxxxxxx>
Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@xxxxxxxxx>
[talex5@xxxxxxxxx: separated from big ARM commit]
Signed-off-by: Thomas Leonard <talex5@xxxxxxxxx>
---
extras/mini-os/arch/x86/events.c | 28 ++++++++++++++++++++++++++++
extras/mini-os/events.c | 26 ++++++--------------------
2 files changed, 34 insertions(+), 20 deletions(-)
create mode 100644 extras/mini-os/arch/x86/events.c
diff --git a/extras/mini-os/arch/x86/events.c b/extras/mini-os/arch/x86/events.c
new file mode 100644
index 0000000..87f8b77
--- /dev/null
+++ b/extras/mini-os/arch/x86/events.c
@@ -0,0 +1,28 @@
+#include <mini-os/os.h>
+#include <mini-os/mm.h>
+
+#if defined(__x86_64__)
+char irqstack[2 * STACK_SIZE];
+
+static struct pda
+{
+ int irqcount; /* offset 0 (used in x86_64.S) */
+ char *irqstackptr; /* 8 */
+} cpu0_pda;
+#endif
+
+void arch_init_events(void) {
+#if defined(__x86_64__)
+ asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
+ wrmsrl(0xc0000101, &cpu0_pda); /* 0xc0000101 is MSR_GS_BASE */
+ cpu0_pda.irqcount = -1;
+ cpu0_pda.irqstackptr = (void*) (((unsigned long)irqstack + 2 * STACK_SIZE)
+ & ~(STACK_SIZE - 1));
+#endif
+}
+
+void arch_fini_events(void) {
+#if defined(__x86_64__)
+ wrmsrl(0xc0000101, NULL); /* 0xc0000101 is MSR_GS_BASE */
+#endif
+}
diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c
index 2da9b01..c2bda1a 100644
--- a/extras/mini-os/events.c
+++ b/extras/mini-os/events.c
@@ -167,44 +167,30 @@ evtchn_port_t bind_pirq(uint32_t pirq, int will_share,
return op.port;
}
-#if defined(__x86_64__)
-char irqstack[2 * STACK_SIZE];
-
-static struct pda
-{
- int irqcount; /* offset 0 (used in x86_64.S) */
- char *irqstackptr; /* 8 */
-} cpu0_pda;
-#endif
-
+void arch_init_events(void);
/*
* Initially all events are without a handler and disabled
*/
void init_events(void)
{
int i;
-#if defined(__x86_64__)
- asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
- wrmsrl(0xc0000101, &cpu0_pda); /* 0xc0000101 is MSR_GS_BASE */
- cpu0_pda.irqcount = -1;
- cpu0_pda.irqstackptr = (void*) (((unsigned long)irqstack + 2 * STACK_SIZE)
- & ~(STACK_SIZE - 1));
-#endif
+
/* initialize event handler */
for ( i = 0; i < NR_EVS; i++ )
{
ev_actions[i].handler = default_handler;
mask_evtchn(i);
}
+
+ arch_init_events();
}
+void arch_fini_events(void);
void fini_events(void)
{
/* Dealloc all events */
unbind_all_ports();
-#if defined(__x86_64__)
- wrmsrl(0xc0000101, NULL); /* 0xc0000101 is MSR_GS_BASE */
-#endif
+ arch_fini_events();
}
void default_handler(evtchn_port_t port, struct pt_regs *regs, void *ignore)
--
2.0.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |