Files
xen/extras/mini-os/include/sched.h
T
kfraser@localhost.localdomain 4aad88265b [MINIOS] Add timer support.
Based on an original patch by Robert Kaiser.

Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
2006-11-15 09:33:01 +00:00

44 lines
879 B
C

#ifndef __SCHED_H__
#define __SCHED_H__
#include <list.h>
#include <time.h>
struct thread
{
char *name;
char *stack;
unsigned long sp; /* Stack pointer */
unsigned long ip; /* Instruction pointer */
struct list_head thread_list;
u32 flags;
s_time_t wakeup_time;
};
void init_sched(void);
void run_idle_thread(void);
struct thread* create_thread(char *name, void (*function)(void *), void *data);
void schedule(void);
static inline struct thread* get_current(void)
{
struct thread **current;
#ifdef __i386__
__asm__("andl %%esp,%0; ":"=r" (current) : "r" (~8191UL));
#else
__asm__("andq %%rsp,%0; ":"=r" (current) : "r" (~8191UL));
#endif
return *current;
}
#define current get_current()
void wake(struct thread *thread);
void block(struct thread *thread);
void sleep(u32 millisecs);
#endif /* __SCHED_H__ */