1
/* ==== machdep.h ============================================================
2
* Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu
13
* The first machine dependent functions are the SEMAPHORES
14
* needing the test and set instruction.
16
#define SEMAPHORE_CLEAR 0
17
#define SEMAPHORE_SET 1
19
#define SEMAPHORE_TEST_AND_SET(lock) \
21
volatile long temp = SEMAPHORE_SET; \
23
__asm__("xchgl %0,(%2)" \
25
:"0" (temp),"r" (lock)); \
29
#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR
34
typedef long semaphore;
41
struct machdep_pthread {
42
void *(*start_routine)(void *);
45
struct itimerval machdep_timer;
46
jmp_buf machdep_state;
47
char machdep_float_state[108];
51
* Static machdep_pthread initialization values.
52
* For initial thread only.
54
#define MACHDEP_PTHREAD_INIT \
55
{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 }
60
#define PTHREAD_STACK_MIN 1024
65
#define SIG_ANY(sig) (sig)
68
* Some fd flag defines that are necessary to distinguish between posix
69
* behavior and bsd4.3 behavior.
71
#define __FD_NONBLOCK O_NONBLOCK
79
#if defined(PTHREAD_KERNEL)
81
#define __machdep_stack_get(x) (x)->machdep_stack
82
#define __machdep_stack_set(x, y) (x)->machdep_stack = y
83
#define __machdep_stack_repl(x, y) \
85
if (stack = __machdep_stack_get(x)) { \
86
__machdep_stack_free(stack); \
88
__machdep_stack_set(x, y); \
91
void * __machdep_stack_alloc __P_((size_t));
92
void __machdep_stack_free __P_((void *));
94
int machdep_save_state __P_((void));