asm_switchstackandcall now defined in asmpart.h
[cacao.git] / i386 / threads.h
1 /* i386/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: $Id: threads.h 526 2003-10-22 21:14:50Z twisti $
13
14 *******************************************************************************/
15
16
17 #ifndef __sysdep_threads_h
18 #define __sysdep_threads_h
19
20 #include "config.h"
21 #include "threads/thread.h"
22
23 /* Thread handling */
24
25 /* prototypes */
26
27 void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop);
28 u1*  asm_initialize_thread_stack (void *func, u1 *stack);
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