828f6efa0dc78a9d7743a5ba2b3d9a032e47c046
[cacao.git] / alpha / threads.h
1 /****************************** threads.h **************************************
2
3         Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
4
5         See file COPYRIGHT for information on usage and disclaimer of warranties
6
7         System dependent part of thread header file.
8
9         Authors: Mark Probst         EMAIL: cacao@complang.tuwien.ac.at
10                  Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
11
12         Last Change: 1998/11/19
13
14 *******************************************************************************/
15
16
17 #ifndef __sysdep_threads_h
18 #define __sysdep_threads_h
19
20 #include "../threads/thread.h"
21
22 /* Thread handling */
23
24 /* prototypes */
25
26 void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
27 u1*  asm_initialize_thread_stack (void *func, u1 *stack);
28 void asm_switchstackandcall (void *stack, void *func, void **stacktopsave);
29
30 /* access macros */
31
32 #define THREADSTACKSIZE         (32 * 1024)
33
34 #define THREADSWITCH(to, from)  asm_perform_threadswitch(&(from)->restorePoint,\
35                                     &(to)->restorePoint, &(from)->usedStackTop)
36
37 #define THREADINIT(to, func)    (to)->restorePoint =                         \
38                                     asm_initialize_thread_stack((u1*)(func), \
39                                                             (to)->stackEnd)
40
41 #define THREADINFO(e)                               \
42                 do {                                        \
43                         (e)->restorePoint = 0;                  \
44                         (e)->flags = THREAD_FLAGS_NOSTACKALLOC; \
45                 } while(0)
46
47 #endif