ia64/xen-unstable

annotate extras/mini-os/include/sched.h @ 12543:a3c6479c87ef

[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>
author kfraser@localhost.localdomain
date Wed Nov 22 10:11:36 2006 +0000 (2006-11-22)
parents 0839db0aa611
children e9e327c3e81b
rev   line source
kaf24@6714 1 #ifndef __SCHED_H__
kaf24@6714 2 #define __SCHED_H__
kaf24@6714 3
kaf24@6714 4 #include <list.h>
kfraser@12473 5 #include <time.h>
kfraser@12543 6 #include <arch_sched.h>
kaf24@6714 7
kaf24@6714 8 struct thread
kaf24@6714 9 {
kaf24@6714 10 char *name;
kaf24@6714 11 char *stack;
kfraser@12543 12 #if !defined(__ia64__)
kaf24@9911 13 unsigned long sp; /* Stack pointer */
kaf24@9911 14 unsigned long ip; /* Instruction pointer */
kfraser@12543 15 #else /* !defined(__ia64__) */
kfraser@12543 16 thread_regs_t regs;
kfraser@12543 17 #endif /* !defined(__ia64__) */
kaf24@6714 18 struct list_head thread_list;
kaf24@6714 19 u32 flags;
kfraser@12473 20 s_time_t wakeup_time;
kaf24@6714 21 };
kaf24@6714 22
kfraser@12543 23 extern struct thread *idle_thread;
kfraser@12543 24 void idle_thread_fn(void *unused);
kaf24@6714 25
kfraser@12543 26 #define RUNNABLE_FLAG 0x00000001
kfraser@12543 27
kfraser@12543 28 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
kfraser@12543 29 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
kfraser@12543 30 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
kfraser@12543 31
kfraser@12543 32 #define switch_threads(prev, next) arch_switch_threads(prev, next)
kfraser@12543 33
kaf24@6714 34
kaf24@6714 35 void init_sched(void);
kaf24@6714 36 void run_idle_thread(void);
kaf24@6714 37 struct thread* create_thread(char *name, void (*function)(void *), void *data);
kaf24@6714 38 void schedule(void);
kaf24@6714 39
kaf24@6714 40 #define current get_current()
kaf24@6714 41
kaf24@6714 42
kaf24@6714 43 void wake(struct thread *thread);
kaf24@6714 44 void block(struct thread *thread);
kfraser@12473 45 void sleep(u32 millisecs);
kaf24@6714 46
kaf24@6714 47 #endif /* __SCHED_H__ */