aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include/sched.h
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-11-22 10:11:36 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-11-22 10:11:36 +0000
commit531616bf98610766d45f9747f737db0c26c8207a (patch)
treeb134d36e69e9baeb619015370a08c77e46e1efa4 /extras/mini-os/include/sched.h
parent47186797ce247ec18bcf8c95a7384972cd4aa0f3 (diff)
downloadxen-531616bf98610766d45f9747f737db0c26c8207a.tar.gz
xen-531616bf98610766d45f9747f737db0c26c8207a.tar.bz2
xen-531616bf98610766d45f9747f737db0c26c8207a.zip
[MINIOS] Refactored mm.c and sched.c. x86 arch specific code got moved to
arch/x86/mm.c and arch/x86/sched.c. Header files were also refactored: arch specific code got moved to include/x86/arch_mm.h and include/x86/sched_mm.h. Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com> Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
Diffstat (limited to 'extras/mini-os/include/sched.h')
-rw-r--r--extras/mini-os/include/sched.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/extras/mini-os/include/sched.h b/extras/mini-os/include/sched.h
index 058941a0a1..f162062c45 100644
--- a/extras/mini-os/include/sched.h
+++ b/extras/mini-os/include/sched.h
@@ -3,36 +3,40 @@
#include <list.h>
#include <time.h>
+#include <arch_sched.h>
struct thread
{
char *name;
char *stack;
+#if !defined(__ia64__)
unsigned long sp; /* Stack pointer */
unsigned long ip; /* Instruction pointer */
+#else /* !defined(__ia64__) */
+ thread_regs_t regs;
+#endif /* !defined(__ia64__) */
struct list_head thread_list;
u32 flags;
s_time_t wakeup_time;
};
+extern struct thread *idle_thread;
+void idle_thread_fn(void *unused);
+#define RUNNABLE_FLAG 0x00000001
+
+#define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
+#define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
+#define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
+
+#define switch_threads(prev, next) arch_switch_threads(prev, next)
+
void init_sched(void);
void run_idle_thread(void);
struct thread* create_thread(char *name, void (*function)(void *), void *data);
void schedule(void);
-static inline struct thread* get_current(void)
-{
- struct thread **current;
-#ifdef __i386__
- __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
-#else
- __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
-#endif
- return *current;
-}
-
#define current get_current()