BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
exec.h
Go to the documentation of this file.
1/* The safe forms of <inline/exec.h> for the libraries
2 (cmake/ndk-calls.cmake, libs/include/ndk/functions.list): the NDK's
3 macro, the register variable on a3 replaced by an operand in a register
4 gcc chooses, which "exg" swaps with a3 around the jsr. a3 is back
5 afterwards (the OS keeps d2-d7/a2-a6); 4 bytes per call, no stack, the
6 condition codes untouched (the NDK's own technique for a5). RawDoFmt's
7 PutChProc gets PutChData in a3 and may move it (move.b d0,(a3)+): the
8 value it leaves stays in the operand, a3 is the caller's again. */
9
10#define __RawDoFmt_base(__in_base, ___formatString, ___dataStream, ___putChProc, ___putChData) ({\
11 STRPTR __p____formatString = (STRPTR)(___formatString);\
12 APTR __p____dataStream = (APTR)(___dataStream);\
13 void *__p____putChProc = (void *)(___putChProc);\
14 APTR __p____putChData = (APTR)(___putChData);\
15 register void * __p__in_base __asm("a6") = (void *)(__in_base);\
16 register APTR __v_ret __asm("d0");\
17 register STRPTR __v0 __asm("a0") = __p____formatString;\
18 register APTR __v1 __asm("a1") = __p____dataStream;\
19 register VOID (*__v2)() __asm("a2") = __p____putChProc;\
20 __asm volatile (\
21 "exg %3,%/a3\n\tjsr %/a6@(-522:W)\n\texg %3,%/a3\n"\
22 : "=d"(__v_ret), "+a"(__v0), "+a"(__v1), "+r"(__p____putChData)\
23 : "a"(__p__in_base), "a"(__v2)\
24 : "fp0", "fp1", "cc", "memory", "d1" );\
25 __v_ret;})