ia64/xen-unstable

annotate extras/mini-os/include/sched.h @ 9911:f6507937cb7c

Fix x86/64 version of Mini-OS. It encompasses the following:
a) 64-bit switch_to scheduler macro (by Aravindh Puthiyaparambil)
b) implements 64-bit hypervisor_callback
c) fixes thread creation issues (thread_starter used to perform
initialisation)

Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 02 09:12:39 2006 +0100 (2006-05-02)
parents 06d84bf87159
children 0839db0aa611
rev   line source
kaf24@6714 1 #ifndef __SCHED_H__
kaf24@6714 2 #define __SCHED_H__
kaf24@6714 3
kaf24@6714 4 #include <list.h>
kaf24@6714 5
kaf24@6714 6 struct thread
kaf24@6714 7 {
kaf24@6714 8 char *name;
kaf24@6714 9 char *stack;
kaf24@9911 10 unsigned long sp; /* Stack pointer */
kaf24@9911 11 unsigned long ip; /* Instruction pointer */
kaf24@6714 12 struct list_head thread_list;
kaf24@6714 13 u32 flags;
kaf24@6714 14 };
kaf24@6714 15
kaf24@6714 16
kaf24@6714 17
kaf24@6714 18 void init_sched(void);
kaf24@6714 19 void run_idle_thread(void);
kaf24@6714 20 struct thread* create_thread(char *name, void (*function)(void *), void *data);
kaf24@6714 21 void schedule(void);
kaf24@6714 22
kaf24@6714 23 static inline struct thread* get_current(void)
kaf24@6714 24 {
kaf24@6714 25 struct thread **current;
kaf24@6714 26 #ifdef __i386__
kaf24@6714 27 __asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
kaf24@9911 28 #else
kaf24@9911 29 __asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
kaf24@9911 30 #endif
kaf24@6714 31 return *current;
kaf24@6714 32 }
kaf24@6714 33
kaf24@6714 34 #define current get_current()
kaf24@6714 35
kaf24@6714 36
kaf24@6714 37 void wake(struct thread *thread);
kaf24@6714 38 void block(struct thread *thread);
kaf24@6714 39
kaf24@6714 40 #endif /* __SCHED_H__ */