ia64/xen-unstable

view extras/mini-os/include/sched.h @ 12473:0839db0aa611

[MINIOS] Add timer support.

Based on an original patch by Robert Kaiser.

Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
author kfraser@localhost.localdomain
date Wed Nov 15 09:33:01 2006 +0000 (2006-11-15)
parents f6507937cb7c
children a3c6479c87ef
line source
1 #ifndef __SCHED_H__
2 #define __SCHED_H__
4 #include <list.h>
5 #include <time.h>
7 struct thread
8 {
9 char *name;
10 char *stack;
11 unsigned long sp; /* Stack pointer */
12 unsigned long ip; /* Instruction pointer */
13 struct list_head thread_list;
14 u32 flags;
15 s_time_t wakeup_time;
16 };
20 void init_sched(void);
21 void run_idle_thread(void);
22 struct thread* create_thread(char *name, void (*function)(void *), void *data);
23 void schedule(void);
25 static inline struct thread* get_current(void)
26 {
27 struct thread **current;
28 #ifdef __i386__
29 __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
30 #else
31 __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
32 #endif
33 return *current;
34 }
36 #define current get_current()
39 void wake(struct thread *thread);
40 void block(struct thread *thread);
41 void sleep(u32 millisecs);
43 #endif /* __SCHED_H__ */