From 30706fa37ff628a20590bb0eb1cddfb22ac4a739 Mon Sep 17 00:00:00 2001 From: verhaegs Date: Wed, 21 Dec 2011 19:23:37 +0000 Subject: [PATCH] rom/exec: StackSwap() only available when __AROS_GIMME_DEPRECATED_STACKSWAP__ is defined. Error is given when compiler is not gcc. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@43155 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/exec/exec.conf | 28 ++++++++++++++++++++++++++++ rom/exec/stackswap.c | 8 ++++---- test/exec/mmakefile.src | 2 ++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/rom/exec/exec.conf b/rom/exec/exec.conf index 92392f5dfb..6b84e2cb81 100644 --- a/rom/exec/exec.conf +++ b/rom/exec/exec.conf @@ -27,6 +27,33 @@ __BEGIN_DECLS STRPTR NewRawDoFmt(CONST_STRPTR FormatString, VOID_FUNC PutChProc, APTR PutChData, ...); #endif +#ifdef __AROS_GIMME_DEPRECATED_STACKSWAP__ + +#ifdef __GNUC__ + +#if !defined(__EXEC_LIBAPI__) || (36 <= __EXEC_LIBAPI__) + +static inline void __attribute__((__always_inline__)) __inline_Exec_StackSwap(struct StackSwapStruct * __arg1, APTR __SysBase) +{ + AROS_LC1NR(void, StackSwap, + AROS_LCA(struct StackSwapStruct *,(__arg1),A0), + struct ExecBase *, (__SysBase), 122, Exec + ); +} + +#define StackSwap(arg1) \ + __inline_Exec_StackSwap((arg1), (APTR)SysBase) + +#endif /* !defined(__EXEC_LIBAPI__) || (36 <= __EXEC_LIBAPI__) */ + +#else + +#error no StackSwap() support for your compiler + +#endif /* __GNUC__ */ + +#endif /* __AROS_GIMME_DEPRECATED_STACKSWAP__ */ + __END_DECLS ##end cdef @@ -163,6 +190,7 @@ void FreePooled(APTR poolHeader, APTR memory, ULONG memSize) (A0, A1, D0) ULONG AttemptSemaphoreShared(struct SignalSemaphore *sigSem) (A0) void ColdReboot() () void StackSwap(struct StackSwapStruct *sss) (A0) +.private void ChildFree(ULONG tid) (D0) ULONG ChildOrphan(ULONG tid) (D0) ULONG ChildStatus(ULONG tid) (D0) diff --git a/rom/exec/stackswap.c b/rom/exec/stackswap.c index 479663821e..263f8cf10b 100644 --- a/rom/exec/stackswap.c +++ b/rom/exec/stackswap.c @@ -51,10 +51,10 @@ be used instead. StackSwap() is only retained to provide backwards compatibility. On some hosted versions with strict stack checking use of StackSwap() may cause problems. - - No proper initialization for alternative stack is done so alternative - stack can't be used after using StackSwap(). This means that on - some archs no shared library functions can be called. + By default StackSwap() will not be defined and you have to + #define __AROS_GIMME_DEPRECATED_STACKSWAP__ before including + . As said above it is highly advised to change code + to use NewStackSwap() and not define __AROS_GIMME_DEPRECATED_STACKSWAP__ EXAMPLE diff --git a/test/exec/mmakefile.src b/test/exec/mmakefile.src index a98b597ba3..b91d2c7842 100644 --- a/test/exec/mmakefile.src +++ b/test/exec/mmakefile.src @@ -31,6 +31,8 @@ FILES := \ EXEDIR := $(AROS_TESTS)/exec +USER_CFLAGS := -D__AROS_GIMME_DEPRECATED_STACKSWAP__ + #MM test-exec : includes includes-copy linklibs kernel %build_progs mmake=test-exec \ -- 2.11.4.GIT