ia64/xen-unstable

annotate 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
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__)
keir@16434 13 /* keep in that order */
kaf24@9911 14 unsigned long sp; /* Stack pointer */
kaf24@9911 15 unsigned long ip; /* Instruction pointer */
kfraser@12543 16 #else /* !defined(__ia64__) */
kfraser@12543 17 thread_regs_t regs;
kfraser@12543 18 #endif /* !defined(__ia64__) */
kaf24@6714 19 struct list_head thread_list;
kaf24@6714 20 u32 flags;
kfraser@12473 21 s_time_t wakeup_time;
kaf24@6714 22 };
kaf24@6714 23
kfraser@12543 24 extern struct thread *idle_thread;
kfraser@12543 25 void idle_thread_fn(void *unused);
kaf24@6714 26
kfraser@12543 27 #define RUNNABLE_FLAG 0x00000001
kfraser@12543 28
kfraser@12543 29 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
kfraser@12543 30 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
kfraser@12543 31 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
kfraser@12543 32
kfraser@12543 33 #define switch_threads(prev, next) arch_switch_threads(prev, next)
kfraser@12543 34
kfraser@13522 35 /* Architecture specific setup of thread creation. */
kfraser@13522 36 struct thread* arch_create_thread(char *name, void (*function)(void *),
kfraser@13522 37 void *data);
kaf24@6714 38
kaf24@6714 39 void init_sched(void);
kaf24@6714 40 void run_idle_thread(void);
kaf24@6714 41 struct thread* create_thread(char *name, void (*function)(void *), void *data);
kaf24@6714 42 void schedule(void);
kaf24@6714 43
kaf24@6714 44 #define current get_current()
kaf24@6714 45
kaf24@6714 46
kaf24@6714 47 void wake(struct thread *thread);
kaf24@6714 48 void block(struct thread *thread);
kfraser@12473 49 void sleep(u32 millisecs);
kaf24@6714 50
kaf24@6714 51 #endif /* __SCHED_H__ */