ia64/xen-unstable

view extras/mini-os/include/sched.h @ 16434:d46265d21dc5

[Mini-OS] Fix x86 arch_switch_thread

Fix x86 arch_switch_thread by making it pure assembly.
There were missing general register clobbers for x86_64, and BP should
theorically be clobbered too, but gcc does not believe that, so the
only simple safe solution is to use pure assembly.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 23 16:23:28 2007 +0000 (2007-11-23)
parents e9e327c3e81b
children b18f70656fdb
line source
1 #ifndef __SCHED_H__
2 #define __SCHED_H__
4 #include <list.h>
5 #include <time.h>
6 #include <arch_sched.h>
8 struct thread
9 {
10 char *name;
11 char *stack;
12 #if !defined(__ia64__)
13 /* keep in that order */
14 unsigned long sp; /* Stack pointer */
15 unsigned long ip; /* Instruction pointer */
16 #else /* !defined(__ia64__) */
17 thread_regs_t regs;
18 #endif /* !defined(__ia64__) */
19 struct list_head thread_list;
20 u32 flags;
21 s_time_t wakeup_time;
22 };
24 extern struct thread *idle_thread;
25 void idle_thread_fn(void *unused);
27 #define RUNNABLE_FLAG 0x00000001
29 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
30 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
31 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
33 #define switch_threads(prev, next) arch_switch_threads(prev, next)
35 /* Architecture specific setup of thread creation. */
36 struct thread* arch_create_thread(char *name, void (*function)(void *),
37 void *data);
39 void init_sched(void);
40 void run_idle_thread(void);
41 struct thread* create_thread(char *name, void (*function)(void *), void *data);
42 void schedule(void);
44 #define current get_current()
47 void wake(struct thread *thread);
48 void block(struct thread *thread);
49 void sleep(u32 millisecs);
51 #endif /* __SCHED_H__ */