ia64/xen-unstable

view extras/mini-os/include/sched.h @ 17042:a905c582a406

Add stubdomain support. See stubdom/README for usage details.

- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
arch_limits.h so as to permit getting them from there without
pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
tpm and other details. A few hacks are needed:
- Align ide and scsi buffers at least on sector size to permit
direct transmission to the block backend. While we are at it, just
page-align it to possibly save a segment. Also, limit the scsi
buffer size because of limitations of the block paravirtualization
protocol.
- Allocate big tables dynamically rather that letting them go to
bss: when Mini-OS gets installed in memory, bss is not lazily
allocated, and doing so during Mini-OS is unnecessarily trick while
we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
Mini-OS compilation flags to the Makefiles of libxc and ioemu.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 12 14:35:39 2008 +0000 (2008-02-12)
parents 945820bfedb6
children 707e10c9a487
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 #ifdef HAVE_LIBC
23 struct _reent reent;
24 #endif
25 };
27 extern struct thread *idle_thread;
28 void idle_thread_fn(void *unused);
30 #define RUNNABLE_FLAG 0x00000001
32 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
33 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
34 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
36 #define switch_threads(prev, next) arch_switch_threads(prev, next)
38 /* Architecture specific setup of thread creation. */
39 struct thread* arch_create_thread(char *name, void (*function)(void *),
40 void *data);
42 void init_sched(void);
43 void run_idle_thread(void);
44 struct thread* create_thread(char *name, void (*function)(void *), void *data);
45 void exit_thread(void) __attribute__((noreturn));
46 void schedule(void);
48 #define current get_current()
51 void wake(struct thread *thread);
52 void block(struct thread *thread);
53 void msleep(u32 millisecs);
55 #endif /* __SCHED_H__ */