From f08246e1976e3ae483c2568e4e510cb3f2b6e44d Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 2 May 2006 09:12:39 +0100 Subject: Fix x86/64 version of Mini-OS. It encompasses the following: a) 64-bit switch_to scheduler macro (by Aravindh Puthiyaparambil) b) implements 64-bit hypervisor_callback c) fixes thread creation issues (thread_starter used to perform initialisation) Signed-off-by: Grzegorz Milos --- extras/mini-os/events.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'extras/mini-os/events.c') diff --git a/extras/mini-os/events.c b/extras/mini-os/events.c index b70eae0b1c..e45a1364fe 100644 --- a/extras/mini-os/events.c +++ b/extras/mini-os/events.c @@ -106,6 +106,17 @@ void unbind_virq( u32 port ) unbind_evtchn(port); } +#if defined(__x86_64__) +/* Allocate 4 pages for the irqstack */ +#define STACK_PAGES 4 +char irqstack[1024 * 4 * STACK_PAGES]; + +static struct pda +{ + int irqcount; /* offset 0 (used in x86_64.S) */ + char *irqstackptr; /* 8 */ +} cpu0_pda; +#endif /* * Initially all events are without a handler and disabled @@ -113,7 +124,12 @@ void unbind_virq( u32 port ) 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 = irqstack + 1024 * 4 * STACK_PAGES; +#endif /* inintialise event handler */ for ( i = 0; i < NR_EVS; i++ ) { -- cgit v1.2.3