1 #ifndef __EXEC_PLATFORM_H
2 #define __EXEC_PLATFORM_H
4 #define SCHEDQUANTUM_VALUE 4
7 /* Android is not a true Linux ;-) */
13 /* On Darwin this definition is required by ucontext.h (which is marked as deprecated)
14 * At least on Debian 8, _XOPEN_SOURCE is already defined in /usr/include/features.h
23 #define LIBC_NAME "libc.so.6"
27 #define LIBC_NAME "libSystem.dylib"
31 #define LIBC_NAME "libc.so"
36 void (*exit
)(int status
);
37 #ifdef HAVE_SWAPCONTEXT
38 int (*getcontext
)(ucontext_t
*ucp
);
39 void (*makecontext
)(ucontext_t
*ucp
, void *func(), int argc
, ...);
40 int (*swapcontext
)(ucontext_t
*oucp
, ucontext_t
*ucp
);
44 struct Exec_PlatformData
47 struct LibCInterface
*SysIFace
;
50 #ifndef __AROS_KERNEL__
51 #define HostLibBase PD(SysBase).HostLibBase
54 #ifdef AROS_NO_ATOMIC_OPERATIONS
55 #define IDNESTCOUNT_INC SysBase->IDNestCnt++
56 #define IDNESTCOUNT_DEC SysBase->IDNestCnt--
57 #define TDNESTCOUNT_INC SysBase->TDNestCnt++
58 #define TDNESTCOUNT_DEC SysBase->TDNestCnt--
59 #define FLAG_SCHEDQUANTUM_CLEAR SysBase->SysFlags &= ~SFF_QuantumOver
60 #define FLAG_SCHEDQUANTUM_SET SysBase->SysFlags |= SFF_QuantumOver
61 #define FLAG_SCHEDSWITCH_CLEAR SysBase->AttnResched &= ~ARF_AttnSwitch
62 #define FLAG_SCHEDSWITCH_SET SysBase->AttnResched |= ARF_AttnSwitch
63 #define FLAG_SCHEDDISPATCH_CLEAR SysBase->AttnResched &= ~ARF_AttnDispatch
64 #define FLAG_SCHEDDISPATCH_SET SysBase->AttnResched |= ARF_AttnDispatch
66 #define IDNESTCOUNT_INC AROS_ATOMIC_INC(SysBase->IDNestCnt)
67 #define IDNESTCOUNT_DEC AROS_ATOMIC_DEC(SysBase->IDNestCnt)
68 #define TDNESTCOUNT_INC AROS_ATOMIC_INC(SysBase->TDNestCnt)
69 #define TDNESTCOUNT_DEC AROS_ATOMIC_DEC(SysBase->TDNestCnt)
70 #define FLAG_SCHEDQUANTUM_CLEAR AROS_ATOMIC_AND(SysBase->SysFlags, ~SFF_QuantumOver)
71 #define FLAG_SCHEDQUANTUM_SET AROS_ATOMIC_OR(SysBase->SysFlags, SFF_QuantumOver)
72 #define FLAG_SCHEDSWITCH_CLEAR AROS_ATOMIC_AND(SysBase->AttnResched, ~ARF_AttnSwitch)
73 #define FLAG_SCHEDSWITCH_SET AROS_ATOMIC_OR(SysBase->AttnResched, ARF_AttnSwitch)
74 #define FLAG_SCHEDDISPATCH_CLEAR AROS_ATOMIC_AND(SysBase->AttnResched, ~ARF_AttnDispatch)
75 #define FLAG_SCHEDDISPATCH_SET AROS_ATOMIC_OR(SysBase->AttnResched, ARF_AttnDispatch)
77 #define SCHEDQUANTUM_SET(val) (SysBase->Quantum=(val))
78 #define SCHEDQUANTUM_GET (SysBase->Quantum)
79 #define SCHEDELAPSED_SET(val) (SysBase->Elapsed=(val))
80 #define SCHEDELAPSED_GET (SysBase->Elapsed)
81 #define IDNESTCOUNT_GET (SysBase->IDNestCnt)
82 #define IDNESTCOUNT_SET(val) (SysBase->IDNestCnt=(val))
83 #define TDNESTCOUNT_GET (SysBase->TDNestCnt)
84 #define TDNESTCOUNT_SET(val) (SysBase->TDNestCnt=(val))
85 #define FLAG_SCHEDQUANTUM_ISSET (SysBase->SysFlags & SFF_QuantumOver)
86 #define FLAG_SCHEDSWITCH_ISSET (SysBase->AttnResched & ARF_AttnSwitch)
87 #define FLAG_SCHEDDISPATCH_ISSET (SysBase->AttnResched & ARF_AttnDispatch)
89 #define GET_THIS_TASK (SysBase->ThisTask)
90 #define SET_THIS_TASK(x) (SysBase->ThisTask=(x))
92 #endif /* __EXEC_PLATFORM_H */