ia64/xen-unstable

annotate extras/mini-os/include/sched.h @ 18020:707e10c9a487

stubdom: fixes to compile with qemu-xen

This adds fixes to the stub domain build into compiling Ian Jackson's
qemu-xen. The most notable change is that mini-os headers now
#include each other through a mini-os/ prefix, so that we can turn all
-I into -isystem and still be sure that we include Mini-OS headers
(and not qemu's console.h or blktaplib's list.h for instance...).

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jul 10 14:15:46 2008 +0100 (2008-07-10)
parents a905c582a406
children 3ab0e76fb8e2
rev   line source
kaf24@6714 1 #ifndef __SCHED_H__
kaf24@6714 2 #define __SCHED_H__
kaf24@6714 3
keir@18020 4 #include <mini-os/list.h>
keir@18020 5 #include <mini-os/time.h>
keir@18020 6 #include <mini-os/arch_sched.h>
keir@18020 7 #ifdef HAVE_LIBC
keir@18020 8 #include <sys/reent.h>
keir@18020 9 #endif
kaf24@6714 10
kaf24@6714 11 struct thread
kaf24@6714 12 {
kaf24@6714 13 char *name;
kaf24@6714 14 char *stack;
kfraser@12543 15 #if !defined(__ia64__)
keir@16434 16 /* keep in that order */
kaf24@9911 17 unsigned long sp; /* Stack pointer */
kaf24@9911 18 unsigned long ip; /* Instruction pointer */
kfraser@12543 19 #else /* !defined(__ia64__) */
kfraser@12543 20 thread_regs_t regs;
kfraser@12543 21 #endif /* !defined(__ia64__) */
kaf24@6714 22 struct list_head thread_list;
kaf24@6714 23 u32 flags;
kfraser@12473 24 s_time_t wakeup_time;
keir@17042 25 #ifdef HAVE_LIBC
keir@17042 26 struct _reent reent;
keir@17042 27 #endif
kaf24@6714 28 };
kaf24@6714 29
kfraser@12543 30 extern struct thread *idle_thread;
kfraser@12543 31 void idle_thread_fn(void *unused);
kaf24@6714 32
kfraser@12543 33 #define RUNNABLE_FLAG 0x00000001
kfraser@12543 34
kfraser@12543 35 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
kfraser@12543 36 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
kfraser@12543 37 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
kfraser@12543 38
kfraser@12543 39 #define switch_threads(prev, next) arch_switch_threads(prev, next)
kfraser@12543 40
kfraser@13522 41 /* Architecture specific setup of thread creation. */
kfraser@13522 42 struct thread* arch_create_thread(char *name, void (*function)(void *),
kfraser@13522 43 void *data);
kaf24@6714 44
kaf24@6714 45 void init_sched(void);
kaf24@6714 46 void run_idle_thread(void);
kaf24@6714 47 struct thread* create_thread(char *name, void (*function)(void *), void *data);
keir@16732 48 void exit_thread(void) __attribute__((noreturn));
kaf24@6714 49 void schedule(void);
kaf24@6714 50
kaf24@6714 51 #define current get_current()
kaf24@6714 52
kaf24@6714 53
kaf24@6714 54 void wake(struct thread *thread);
kaf24@6714 55 void block(struct thread *thread);
keir@16838 56 void msleep(u32 millisecs);
kaf24@6714 57
kaf24@6714 58 #endif /* __SCHED_H__ */