BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
wb.h
Go to the documentation of this file.
1/* The safe forms of <inline/wb.h> for the libraries
2 (cmake/ndk-calls.cmake, libs/include/ndk/functions.list): the NDK's
3 macro, the register variables on a3 and a4 replaced by operands in
4 registers gcc chooses, which "exg" swaps with a3 and a4 around the jsr.
5 Both are back afterwards (the OS keeps d2-d7/a2-a6); 4 bytes per call
6 and register, no stack, the condition codes untouched (the NDK's own
7 technique for a5, and for a4 with -fbaserel, which no library uses). */
8
9#ifdef __baserel__
10#error "the safe AddAppIconA is the form without -fbaserel (the NDK's own saves a4 there)"
11#endif
12
13#define __AddAppIconA_base(__in_base, ___id, ___userdata, ___text, ___msgport, ___lock, ___diskobj, ___taglist) ({\
14 ULONG __p____id = (ULONG)(___id);\
15 ULONG __p____userdata = (ULONG)(___userdata);\
16 STRPTR __p____text = (STRPTR)(___text);\
17 struct MsgPort * __p____msgport = (struct MsgPort *)(___msgport);\
18 BPTR __p____lock = (BPTR)(___lock);\
19 struct DiskObject * __p____diskobj = (struct DiskObject *)(___diskobj);\
20 struct TagItem * __p____taglist = (struct TagItem *)(___taglist);\
21 register void * __p__in_base __asm("a6") = (void *)(__in_base);\
22 register struct AppIcon * __v_ret __asm("d0");\
23 register ULONG __v0 __asm("d0") = __p____id;\
24 register ULONG __v1 __asm("d1") = __p____userdata;\
25 register STRPTR __v2 __asm("a0") = __p____text;\
26 register struct MsgPort * __v3 __asm("a1") = __p____msgport;\
27 register BPTR __v4 __asm("a2") = __p____lock;\
28 __asm volatile (\
29 "exg %4,%/a3\n\texg %5,%/a4\n\tjsr %/a6@(-60:W)\n\texg %5,%/a4\n\texg %4,%/a3\n"\
30 : "=d"(__v_ret), "+d"(__v1), "+a"(__v2), "+a"(__v3), "+r"(__p____diskobj), "+r"(__p____taglist)\
31 : "a"(__p__in_base), "d"(__v0), "a"(__v4)\
32 : "fp0", "fp1", "cc", "memory" );\
33 __v_ret;})