xref: /aosp_15_r20/external/fastrpc/src/adsp_current_process_stub.c (revision 418b791d679beb2078b579a3b6936cf330c41799)
1*418b791dSBob Badour #ifndef _ADSP_CURRENT_PROCESS_STUB_H
2*418b791dSBob Badour #define _ADSP_CURRENT_PROCESS_STUB_H
3*418b791dSBob Badour /*
4*418b791dSBob Badour  * Copyright (c) 2019, The Linux Foundation. All rights reserved.
5*418b791dSBob Badour  *
6*418b791dSBob Badour  * Redistribution and use in source and binary forms, with or without
7*418b791dSBob Badour  * modification, are permitted provided that the following conditions are
8*418b791dSBob Badour  * met:
9*418b791dSBob Badour  *    * Redistributions of source code must retain the above copyright
10*418b791dSBob Badour  *      notice, this list of conditions and the following disclaimer.
11*418b791dSBob Badour  *    * Redistributions in binary form must reproduce the above
12*418b791dSBob Badour  *      copyright notice, this list of conditions and the following
13*418b791dSBob Badour  *      disclaimer in the documentation and/or other materials provided
14*418b791dSBob Badour  *      with the distribution.
15*418b791dSBob Badour  *    * Neither the name of The Linux Foundation nor the names of its
16*418b791dSBob Badour  *      contributors may be used to endorse or promote products derived
17*418b791dSBob Badour  *      from this software without specific prior written permission.
18*418b791dSBob Badour  *
19*418b791dSBob Badour  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
20*418b791dSBob Badour  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21*418b791dSBob Badour  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
22*418b791dSBob Badour  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
23*418b791dSBob Badour  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*418b791dSBob Badour  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*418b791dSBob Badour  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26*418b791dSBob Badour  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*418b791dSBob Badour  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28*418b791dSBob Badour  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
29*418b791dSBob Badour  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*418b791dSBob Badour  */
31*418b791dSBob Badour #include "adsp_current_process.h"
32*418b791dSBob Badour #ifndef _QAIC_ENV_H
33*418b791dSBob Badour #define _QAIC_ENV_H
34*418b791dSBob Badour 
35*418b791dSBob Badour #ifdef __GNUC__
36*418b791dSBob Badour #ifdef __clang__
37*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunknown-pragmas"
38*418b791dSBob Badour #else
39*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wpragmas"
40*418b791dSBob Badour #endif
41*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wuninitialized"
42*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunused-parameter"
43*418b791dSBob Badour #pragma GCC diagnostic ignored "-Wunused-function"
44*418b791dSBob Badour #endif
45*418b791dSBob Badour 
46*418b791dSBob Badour #ifndef _ATTRIBUTE_UNUSED
47*418b791dSBob Badour 
48*418b791dSBob Badour #ifdef _WIN32
49*418b791dSBob Badour #define _ATTRIBUTE_UNUSED
50*418b791dSBob Badour #else
51*418b791dSBob Badour #define _ATTRIBUTE_UNUSED __attribute__ ((unused))
52*418b791dSBob Badour #endif
53*418b791dSBob Badour 
54*418b791dSBob Badour #endif // _ATTRIBUTE_UNUSED
55*418b791dSBob Badour 
56*418b791dSBob Badour #ifndef __QAIC_REMOTE
57*418b791dSBob Badour #define __QAIC_REMOTE(ff) ff
58*418b791dSBob Badour #endif //__QAIC_REMOTE
59*418b791dSBob Badour 
60*418b791dSBob Badour #ifndef __QAIC_HEADER
61*418b791dSBob Badour #define __QAIC_HEADER(ff) ff
62*418b791dSBob Badour #endif //__QAIC_HEADER
63*418b791dSBob Badour 
64*418b791dSBob Badour #ifndef __QAIC_HEADER_EXPORT
65*418b791dSBob Badour #define __QAIC_HEADER_EXPORT
66*418b791dSBob Badour #endif // __QAIC_HEADER_EXPORT
67*418b791dSBob Badour 
68*418b791dSBob Badour #ifndef __QAIC_HEADER_ATTRIBUTE
69*418b791dSBob Badour #define __QAIC_HEADER_ATTRIBUTE
70*418b791dSBob Badour #endif // __QAIC_HEADER_ATTRIBUTE
71*418b791dSBob Badour 
72*418b791dSBob Badour #ifndef __QAIC_IMPL
73*418b791dSBob Badour #define __QAIC_IMPL(ff) ff
74*418b791dSBob Badour #endif //__QAIC_IMPL
75*418b791dSBob Badour 
76*418b791dSBob Badour #ifndef __QAIC_IMPL_EXPORT
77*418b791dSBob Badour #define __QAIC_IMPL_EXPORT
78*418b791dSBob Badour #endif // __QAIC_IMPL_EXPORT
79*418b791dSBob Badour 
80*418b791dSBob Badour #ifndef __QAIC_IMPL_ATTRIBUTE
81*418b791dSBob Badour #define __QAIC_IMPL_ATTRIBUTE
82*418b791dSBob Badour #endif // __QAIC_IMPL_ATTRIBUTE
83*418b791dSBob Badour 
84*418b791dSBob Badour #ifndef __QAIC_STUB
85*418b791dSBob Badour #define __QAIC_STUB(ff) ff
86*418b791dSBob Badour #endif //__QAIC_STUB
87*418b791dSBob Badour 
88*418b791dSBob Badour #ifndef __QAIC_STUB_EXPORT
89*418b791dSBob Badour #define __QAIC_STUB_EXPORT
90*418b791dSBob Badour #endif // __QAIC_STUB_EXPORT
91*418b791dSBob Badour 
92*418b791dSBob Badour #ifndef __QAIC_STUB_ATTRIBUTE
93*418b791dSBob Badour #define __QAIC_STUB_ATTRIBUTE
94*418b791dSBob Badour #endif // __QAIC_STUB_ATTRIBUTE
95*418b791dSBob Badour 
96*418b791dSBob Badour #ifndef __QAIC_SKEL
97*418b791dSBob Badour #define __QAIC_SKEL(ff) ff
98*418b791dSBob Badour #endif //__QAIC_SKEL__
99*418b791dSBob Badour 
100*418b791dSBob Badour #ifndef __QAIC_SKEL_EXPORT
101*418b791dSBob Badour #define __QAIC_SKEL_EXPORT
102*418b791dSBob Badour #endif // __QAIC_SKEL_EXPORT
103*418b791dSBob Badour 
104*418b791dSBob Badour #ifndef __QAIC_SKEL_ATTRIBUTE
105*418b791dSBob Badour #define __QAIC_SKEL_ATTRIBUTE
106*418b791dSBob Badour #endif // __QAIC_SKEL_ATTRIBUTE
107*418b791dSBob Badour 
108*418b791dSBob Badour #ifdef __QAIC_DEBUG__
109*418b791dSBob Badour    #ifndef __QAIC_DBG_PRINTF__
110*418b791dSBob Badour    #include <stdio.h>
111*418b791dSBob Badour    #define __QAIC_DBG_PRINTF__( ee ) do { printf ee ; } while(0)
112*418b791dSBob Badour    #endif
113*418b791dSBob Badour #else
114*418b791dSBob Badour    #define __QAIC_DBG_PRINTF__( ee ) (void)0
115*418b791dSBob Badour #endif
116*418b791dSBob Badour 
117*418b791dSBob Badour 
118*418b791dSBob Badour #define _OFFSET(src, sof)  ((void*)(((char*)(src)) + (sof)))
119*418b791dSBob Badour 
120*418b791dSBob Badour #define _COPY(dst, dof, src, sof, sz)  \
121*418b791dSBob Badour    do {\
122*418b791dSBob Badour          struct __copy { \
123*418b791dSBob Badour             char ar[sz]; \
124*418b791dSBob Badour          };\
125*418b791dSBob Badour          *(struct __copy*)_OFFSET(dst, dof) = *(struct __copy*)_OFFSET(src, sof);\
126*418b791dSBob Badour    } while (0)
127*418b791dSBob Badour 
128*418b791dSBob Badour #define _COPYIF(dst, dof, src, sof, sz)  \
129*418b791dSBob Badour    do {\
130*418b791dSBob Badour       if(_OFFSET(dst, dof) != _OFFSET(src, sof)) {\
131*418b791dSBob Badour          _COPY(dst, dof, src, sof, sz); \
132*418b791dSBob Badour       } \
133*418b791dSBob Badour    } while (0)
134*418b791dSBob Badour 
135*418b791dSBob Badour _ATTRIBUTE_UNUSED
_qaic_memmove(void * dst,void * src,int size)136*418b791dSBob Badour static __inline void _qaic_memmove(void* dst, void* src, int size) {
137*418b791dSBob Badour    int i;
138*418b791dSBob Badour    for(i = 0; i < size; ++i) {
139*418b791dSBob Badour       ((char*)dst)[i] = ((char*)src)[i];
140*418b791dSBob Badour    }
141*418b791dSBob Badour }
142*418b791dSBob Badour 
143*418b791dSBob Badour #define _MEMMOVEIF(dst, src, sz)  \
144*418b791dSBob Badour    do {\
145*418b791dSBob Badour       if(dst != src) {\
146*418b791dSBob Badour          _qaic_memmove(dst, src, sz);\
147*418b791dSBob Badour       } \
148*418b791dSBob Badour    } while (0)
149*418b791dSBob Badour 
150*418b791dSBob Badour 
151*418b791dSBob Badour #define _ASSIGN(dst, src, sof)  \
152*418b791dSBob Badour    do {\
153*418b791dSBob Badour       dst = OFFSET(src, sof); \
154*418b791dSBob Badour    } while (0)
155*418b791dSBob Badour 
156*418b791dSBob Badour #define _STD_STRLEN_IF(str) (str == 0 ? 0 : strlen(str))
157*418b791dSBob Badour 
158*418b791dSBob Badour #include "AEEStdErr.h"
159*418b791dSBob Badour 
160*418b791dSBob Badour #define _TRY(ee, func) \
161*418b791dSBob Badour    do { \
162*418b791dSBob Badour       if (AEE_SUCCESS != ((ee) = func)) {\
163*418b791dSBob Badour          __QAIC_DBG_PRINTF__((__FILE__ ":%d:error:%d:%s\n", __LINE__, (int)(ee),#func));\
164*418b791dSBob Badour          goto ee##bail;\
165*418b791dSBob Badour       } \
166*418b791dSBob Badour    } while (0)
167*418b791dSBob Badour 
168*418b791dSBob Badour #define _CATCH(exception) exception##bail: if (exception != AEE_SUCCESS)
169*418b791dSBob Badour 
170*418b791dSBob Badour #define _ASSERT(nErr, ff) _TRY(nErr, 0 == (ff) ? AEE_EBADPARM : AEE_SUCCESS)
171*418b791dSBob Badour 
172*418b791dSBob Badour #ifdef __QAIC_DEBUG__
173*418b791dSBob Badour #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, __FILE_LINE__, size, alignment, (void**)&pv))
174*418b791dSBob Badour #else
175*418b791dSBob Badour #define _ALLOCATE(nErr, pal, size, alignment, pv) _TRY(nErr, _allocator_alloc(pal, 0, size, alignment, (void**)&pv))
176*418b791dSBob Badour #endif
177*418b791dSBob Badour 
178*418b791dSBob Badour 
179*418b791dSBob Badour #endif // _QAIC_ENV_H
180*418b791dSBob Badour 
181*418b791dSBob Badour #include "remote.h"
182*418b791dSBob Badour #include <string.h>
183*418b791dSBob Badour #ifndef _ALLOCATOR_H
184*418b791dSBob Badour #define _ALLOCATOR_H
185*418b791dSBob Badour 
186*418b791dSBob Badour #include <stdlib.h>
187*418b791dSBob Badour #include <stdint.h>
188*418b791dSBob Badour 
189*418b791dSBob Badour typedef struct _heap _heap;
190*418b791dSBob Badour struct _heap {
191*418b791dSBob Badour    _heap* pPrev;
192*418b791dSBob Badour    const char* loc;
193*418b791dSBob Badour    uint64_t buf;
194*418b791dSBob Badour };
195*418b791dSBob Badour 
196*418b791dSBob Badour typedef struct _allocator {
197*418b791dSBob Badour    _heap* pheap;
198*418b791dSBob Badour    uint8_t* stack;
199*418b791dSBob Badour    uint8_t* stackEnd;
200*418b791dSBob Badour    int nSize;
201*418b791dSBob Badour } _allocator;
202*418b791dSBob Badour 
203*418b791dSBob Badour _ATTRIBUTE_UNUSED
_heap_alloc(_heap ** ppa,const char * loc,int size,void ** ppbuf)204*418b791dSBob Badour static __inline int _heap_alloc(_heap** ppa, const char* loc, int size, void** ppbuf) {
205*418b791dSBob Badour    _heap* pn = 0;
206*418b791dSBob Badour    pn = malloc(size + sizeof(_heap) - sizeof(uint64_t));
207*418b791dSBob Badour    if(pn != 0) {
208*418b791dSBob Badour       pn->pPrev = *ppa;
209*418b791dSBob Badour       pn->loc = loc;
210*418b791dSBob Badour       *ppa = pn;
211*418b791dSBob Badour       *ppbuf = (void*)&(pn->buf);
212*418b791dSBob Badour       return 0;
213*418b791dSBob Badour    } else {
214*418b791dSBob Badour       return -1;
215*418b791dSBob Badour    }
216*418b791dSBob Badour }
217*418b791dSBob Badour #define _ALIGN_SIZE(x, y) (((x) + (y-1)) & ~(y-1))
218*418b791dSBob Badour 
219*418b791dSBob Badour _ATTRIBUTE_UNUSED
_allocator_alloc(_allocator * me,const char * loc,int size,unsigned int al,void ** ppbuf)220*418b791dSBob Badour static __inline int _allocator_alloc(_allocator* me,
221*418b791dSBob Badour                                     const char* loc,
222*418b791dSBob Badour                                     int size,
223*418b791dSBob Badour                                     unsigned int al,
224*418b791dSBob Badour                                     void** ppbuf) {
225*418b791dSBob Badour    if(size < 0) {
226*418b791dSBob Badour       return -1;
227*418b791dSBob Badour    } else if (size == 0) {
228*418b791dSBob Badour       *ppbuf = 0;
229*418b791dSBob Badour       return 0;
230*418b791dSBob Badour    }
231*418b791dSBob Badour    if((_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size) < (uintptr_t)me->stack + me->nSize) {
232*418b791dSBob Badour       *ppbuf = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al);
233*418b791dSBob Badour       me->stackEnd = (uint8_t*)_ALIGN_SIZE((uintptr_t)me->stackEnd, al) + size;
234*418b791dSBob Badour       return 0;
235*418b791dSBob Badour    } else {
236*418b791dSBob Badour       return _heap_alloc(&me->pheap, loc, size, ppbuf);
237*418b791dSBob Badour    }
238*418b791dSBob Badour }
239*418b791dSBob Badour 
240*418b791dSBob Badour _ATTRIBUTE_UNUSED
_allocator_deinit(_allocator * me)241*418b791dSBob Badour static __inline void _allocator_deinit(_allocator* me) {
242*418b791dSBob Badour    _heap* pa = me->pheap;
243*418b791dSBob Badour    while(pa != 0) {
244*418b791dSBob Badour       _heap* pn = pa;
245*418b791dSBob Badour       const char* loc = pn->loc;
246*418b791dSBob Badour       (void)loc;
247*418b791dSBob Badour       pa = pn->pPrev;
248*418b791dSBob Badour       free(pn);
249*418b791dSBob Badour    }
250*418b791dSBob Badour }
251*418b791dSBob Badour 
252*418b791dSBob Badour _ATTRIBUTE_UNUSED
_allocator_init(_allocator * me,uint8_t * stack,int stackSize)253*418b791dSBob Badour static __inline void _allocator_init(_allocator* me, uint8_t* stack, int stackSize) {
254*418b791dSBob Badour    me->stack =  stack;
255*418b791dSBob Badour    me->stackEnd =  stack + stackSize;
256*418b791dSBob Badour    me->nSize = stackSize;
257*418b791dSBob Badour    me->pheap = 0;
258*418b791dSBob Badour }
259*418b791dSBob Badour 
260*418b791dSBob Badour 
261*418b791dSBob Badour #endif // _ALLOCATOR_H
262*418b791dSBob Badour 
263*418b791dSBob Badour #ifndef SLIM_H
264*418b791dSBob Badour #define SLIM_H
265*418b791dSBob Badour 
266*418b791dSBob Badour #include <stdint.h>
267*418b791dSBob Badour 
268*418b791dSBob Badour //a C data structure for the idl types that can be used to implement
269*418b791dSBob Badour //static and dynamic language bindings fairly efficiently.
270*418b791dSBob Badour //
271*418b791dSBob Badour //the goal is to have a minimal ROM and RAM footprint and without
272*418b791dSBob Badour //doing too many allocations.  A good way to package these things seemed
273*418b791dSBob Badour //like the module boundary, so all the idls within  one module can share
274*418b791dSBob Badour //all the type references.
275*418b791dSBob Badour 
276*418b791dSBob Badour 
277*418b791dSBob Badour #define PARAMETER_IN       0x0
278*418b791dSBob Badour #define PARAMETER_OUT      0x1
279*418b791dSBob Badour #define PARAMETER_INOUT    0x2
280*418b791dSBob Badour #define PARAMETER_ROUT     0x3
281*418b791dSBob Badour #define PARAMETER_INROUT   0x4
282*418b791dSBob Badour 
283*418b791dSBob Badour //the types that we get from idl
284*418b791dSBob Badour #define TYPE_OBJECT             0x0
285*418b791dSBob Badour #define TYPE_INTERFACE          0x1
286*418b791dSBob Badour #define TYPE_PRIMITIVE          0x2
287*418b791dSBob Badour #define TYPE_ENUM               0x3
288*418b791dSBob Badour #define TYPE_STRING             0x4
289*418b791dSBob Badour #define TYPE_WSTRING            0x5
290*418b791dSBob Badour #define TYPE_STRUCTURE          0x6
291*418b791dSBob Badour #define TYPE_UNION              0x7
292*418b791dSBob Badour #define TYPE_ARRAY              0x8
293*418b791dSBob Badour #define TYPE_SEQUENCE           0x9
294*418b791dSBob Badour 
295*418b791dSBob Badour //these require the pack/unpack to recurse
296*418b791dSBob Badour //so it's a hint to those languages that can optimize in cases where
297*418b791dSBob Badour //recursion isn't necessary.
298*418b791dSBob Badour #define TYPE_COMPLEX_STRUCTURE  (0x10 | TYPE_STRUCTURE)
299*418b791dSBob Badour #define TYPE_COMPLEX_UNION      (0x10 | TYPE_UNION)
300*418b791dSBob Badour #define TYPE_COMPLEX_ARRAY      (0x10 | TYPE_ARRAY)
301*418b791dSBob Badour #define TYPE_COMPLEX_SEQUENCE   (0x10 | TYPE_SEQUENCE)
302*418b791dSBob Badour 
303*418b791dSBob Badour 
304*418b791dSBob Badour typedef struct Type Type;
305*418b791dSBob Badour 
306*418b791dSBob Badour #define INHERIT_TYPE\
307*418b791dSBob Badour    int32_t nativeSize;                /*in the simple case its the same as wire size and alignment*/\
308*418b791dSBob Badour    union {\
309*418b791dSBob Badour       struct {\
310*418b791dSBob Badour          const uintptr_t         p1;\
311*418b791dSBob Badour          const uintptr_t         p2;\
312*418b791dSBob Badour       } _cast;\
313*418b791dSBob Badour       struct {\
314*418b791dSBob Badour          uint32_t  iid;\
315*418b791dSBob Badour          uint32_t  bNotNil;\
316*418b791dSBob Badour       } object;\
317*418b791dSBob Badour       struct {\
318*418b791dSBob Badour          const Type  *arrayType;\
319*418b791dSBob Badour          int32_t      nItems;\
320*418b791dSBob Badour       } array;\
321*418b791dSBob Badour       struct {\
322*418b791dSBob Badour          const Type *seqType;\
323*418b791dSBob Badour          int32_t      nMaxLen;\
324*418b791dSBob Badour       } seqSimple; \
325*418b791dSBob Badour       struct {\
326*418b791dSBob Badour          uint32_t bFloating;\
327*418b791dSBob Badour          uint32_t bSigned;\
328*418b791dSBob Badour       } prim; \
329*418b791dSBob Badour       const SequenceType* seqComplex;\
330*418b791dSBob Badour       const UnionType  *unionType;\
331*418b791dSBob Badour       const StructType *structType;\
332*418b791dSBob Badour       int32_t         stringMaxLen;\
333*418b791dSBob Badour       uint8_t        bInterfaceNotNil;\
334*418b791dSBob Badour    } param;\
335*418b791dSBob Badour    uint8_t    type;\
336*418b791dSBob Badour    uint8_t    nativeAlignment\
337*418b791dSBob Badour 
338*418b791dSBob Badour typedef struct UnionType UnionType;
339*418b791dSBob Badour typedef struct StructType StructType;
340*418b791dSBob Badour typedef struct SequenceType SequenceType;
341*418b791dSBob Badour struct Type {
342*418b791dSBob Badour    INHERIT_TYPE;
343*418b791dSBob Badour };
344*418b791dSBob Badour 
345*418b791dSBob Badour struct SequenceType {
346*418b791dSBob Badour    const Type          *seqType;
347*418b791dSBob Badour    uint32_t               nMaxLen;
348*418b791dSBob Badour    uint32_t               inSize;
349*418b791dSBob Badour    uint32_t               routSizePrimIn;
350*418b791dSBob Badour    uint32_t               routSizePrimROut;
351*418b791dSBob Badour };
352*418b791dSBob Badour 
353*418b791dSBob Badour //byte offset from the start of the case values for
354*418b791dSBob Badour //this unions case value array.  it MUST be aligned
355*418b791dSBob Badour //at the alignment requrements for the descriptor
356*418b791dSBob Badour //
357*418b791dSBob Badour //if negative it means that the unions cases are
358*418b791dSBob Badour //simple enumerators, so the value read from the descriptor
359*418b791dSBob Badour //can be used directly to find the correct case
360*418b791dSBob Badour typedef union CaseValuePtr CaseValuePtr;
361*418b791dSBob Badour union CaseValuePtr {
362*418b791dSBob Badour    const uint8_t*   value8s;
363*418b791dSBob Badour    const uint16_t*  value16s;
364*418b791dSBob Badour    const uint32_t*  value32s;
365*418b791dSBob Badour    const uint64_t*  value64s;
366*418b791dSBob Badour };
367*418b791dSBob Badour 
368*418b791dSBob Badour //these are only used in complex cases
369*418b791dSBob Badour //so I pulled them out of the type definition as references to make
370*418b791dSBob Badour //the type smaller
371*418b791dSBob Badour struct UnionType {
372*418b791dSBob Badour    const Type           *descriptor;
373*418b791dSBob Badour    uint32_t               nCases;
374*418b791dSBob Badour    const CaseValuePtr   caseValues;
375*418b791dSBob Badour    const Type * const   *cases;
376*418b791dSBob Badour    int32_t               inSize;
377*418b791dSBob Badour    int32_t               routSizePrimIn;
378*418b791dSBob Badour    int32_t               routSizePrimROut;
379*418b791dSBob Badour    uint8_t                inAlignment;
380*418b791dSBob Badour    uint8_t                routAlignmentPrimIn;
381*418b791dSBob Badour    uint8_t                routAlignmentPrimROut;
382*418b791dSBob Badour    uint8_t                inCaseAlignment;
383*418b791dSBob Badour    uint8_t                routCaseAlignmentPrimIn;
384*418b791dSBob Badour    uint8_t                routCaseAlignmentPrimROut;
385*418b791dSBob Badour    uint8_t                nativeCaseAlignment;
386*418b791dSBob Badour    uint8_t              bDefaultCase;
387*418b791dSBob Badour };
388*418b791dSBob Badour 
389*418b791dSBob Badour struct StructType {
390*418b791dSBob Badour    uint32_t               nMembers;
391*418b791dSBob Badour    const Type * const   *members;
392*418b791dSBob Badour    int32_t               inSize;
393*418b791dSBob Badour    int32_t               routSizePrimIn;
394*418b791dSBob Badour    int32_t               routSizePrimROut;
395*418b791dSBob Badour    uint8_t                inAlignment;
396*418b791dSBob Badour    uint8_t                routAlignmentPrimIn;
397*418b791dSBob Badour    uint8_t                routAlignmentPrimROut;
398*418b791dSBob Badour };
399*418b791dSBob Badour 
400*418b791dSBob Badour typedef struct Parameter Parameter;
401*418b791dSBob Badour struct Parameter {
402*418b791dSBob Badour    INHERIT_TYPE;
403*418b791dSBob Badour    uint8_t    mode;
404*418b791dSBob Badour    uint8_t  bNotNil;
405*418b791dSBob Badour };
406*418b791dSBob Badour 
407*418b791dSBob Badour #define SLIM_IFPTR32(is32,is64) (sizeof(uintptr_t) == 4 ? (is32) : (is64))
408*418b791dSBob Badour #define SLIM_SCALARS_IS_DYNAMIC(u) (((u) & 0x00ffffff) == 0x00ffffff)
409*418b791dSBob Badour 
410*418b791dSBob Badour typedef struct Method Method;
411*418b791dSBob Badour struct Method {
412*418b791dSBob Badour    uint32_t                    uScalars;            //no method index
413*418b791dSBob Badour    int32_t                     primInSize;
414*418b791dSBob Badour    int32_t                     primROutSize;
415*418b791dSBob Badour    int                         maxArgs;
416*418b791dSBob Badour    int                         numParams;
417*418b791dSBob Badour    const Parameter * const     *params;
418*418b791dSBob Badour    uint8_t                       primInAlignment;
419*418b791dSBob Badour    uint8_t                       primROutAlignment;
420*418b791dSBob Badour };
421*418b791dSBob Badour 
422*418b791dSBob Badour typedef struct Interface Interface;
423*418b791dSBob Badour 
424*418b791dSBob Badour struct Interface {
425*418b791dSBob Badour    int                            nMethods;
426*418b791dSBob Badour    const Method  * const          *methodArray;
427*418b791dSBob Badour    int                            nIIds;
428*418b791dSBob Badour    const uint32_t                   *iids;
429*418b791dSBob Badour    const uint16_t*                  methodStringArray;
430*418b791dSBob Badour    const uint16_t*                  methodStrings;
431*418b791dSBob Badour    const char*                    strings;
432*418b791dSBob Badour };
433*418b791dSBob Badour 
434*418b791dSBob Badour 
435*418b791dSBob Badour #endif //SLIM_H
436*418b791dSBob Badour 
437*418b791dSBob Badour 
438*418b791dSBob Badour #ifndef _ADSP_CURRENT_PROCESS_SLIM_H
439*418b791dSBob Badour #define _ADSP_CURRENT_PROCESS_SLIM_H
440*418b791dSBob Badour #include "remote.h"
441*418b791dSBob Badour #include <stdint.h>
442*418b791dSBob Badour 
443*418b791dSBob Badour #ifndef __QAIC_SLIM
444*418b791dSBob Badour #define __QAIC_SLIM(ff) ff
445*418b791dSBob Badour #endif
446*418b791dSBob Badour #ifndef __QAIC_SLIM_EXPORT
447*418b791dSBob Badour #define __QAIC_SLIM_EXPORT
448*418b791dSBob Badour #endif
449*418b791dSBob Badour 
450*418b791dSBob Badour static const Type types[1];
451*418b791dSBob Badour static const SequenceType sequenceTypes[1] = {{&(types[0]),0x0,0x4,0x4,0x0}};
452*418b791dSBob Badour static const Type types[1] = {{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)0x0,0}}, 4,SLIM_IFPTR32(0x4,0x8)}};
453*418b791dSBob Badour static const Parameter parameters[3] = {{0x2,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x2,0,0},{SLIM_IFPTR32(0x8,0x10),{{(const uintptr_t)&(sequenceTypes[0]),0}}, 25,SLIM_IFPTR32(0x4,0x8),0,0},{0x4,{{(const uintptr_t)0,(const uintptr_t)0}}, 2,0x4,3,0}};
454*418b791dSBob Badour static const Parameter* const parameterArrays[3] = {(&(parameters[0])),(&(parameters[1])),(&(parameters[2]))};
455*418b791dSBob Badour static const Method methods[3] = {{REMOTE_SCALARS_MAKEX(0,0,0x0,0x0,0x0,0x0),0x0,0x0,0,0,0,0x0,0x0},{REMOTE_SCALARS_MAKEX(0,0,255,255,15,15),0x8,0x0,3,2,(&(parameterArrays[0])),0x4,0x0},{REMOTE_SCALARS_MAKEX(0,0,0x0,0x1,0x0,0x0),0x0,0x4,1,1,(&(parameterArrays[2])),0x1,0x4}};
456*418b791dSBob Badour static const Method* const methodArrays[4] = {&(methods[0]),&(methods[0]),&(methods[1]),&(methods[2])};
457*418b791dSBob Badour static const char strings[60] = "set_logging_params\0thread_exit\0filesToLog\0getASID\0asid\0mask\0";
458*418b791dSBob Badour static const uint16_t methodStrings[7] = {0,55,31,42,50,19,26};
459*418b791dSBob Badour static const uint16_t methodStringsArrays[4] = {6,5,0,3};
460*418b791dSBob Badour __QAIC_SLIM_EXPORT const Interface __QAIC_SLIM(adsp_current_process_slim) = {4,&(methodArrays[0]),0,0,&(methodStringsArrays [0]),methodStrings,strings};
461*418b791dSBob Badour #endif //_ADSP_CURRENT_PROCESS_SLIM_H
462*418b791dSBob Badour #ifdef __cplusplus
463*418b791dSBob Badour extern "C" {
464*418b791dSBob Badour #endif
465*418b791dSBob Badour 
466*418b791dSBob Badour #ifndef _const_adsp_current_process_handle
467*418b791dSBob Badour #define _const_adsp_current_process_handle ((remote_handle)-1)
468*418b791dSBob Badour #endif //_const_adsp_current_process_handle
469*418b791dSBob Badour 
_adsp_current_process_pls_dtor(void * data)470*418b791dSBob Badour static void _adsp_current_process_pls_dtor(void* data) {
471*418b791dSBob Badour    remote_handle* ph = (remote_handle*)data;
472*418b791dSBob Badour    if(_const_adsp_current_process_handle != *ph) {
473*418b791dSBob Badour       (void)__QAIC_REMOTE(remote_handle_close)(*ph);
474*418b791dSBob Badour       *ph = _const_adsp_current_process_handle;
475*418b791dSBob Badour    }
476*418b791dSBob Badour }
477*418b791dSBob Badour 
_adsp_current_process_pls_ctor(void * ctx,void * data)478*418b791dSBob Badour static int _adsp_current_process_pls_ctor(void* ctx, void* data) {
479*418b791dSBob Badour    remote_handle* ph = (remote_handle*)data;
480*418b791dSBob Badour    *ph = _const_adsp_current_process_handle;
481*418b791dSBob Badour    if(*ph == (remote_handle)-1) {
482*418b791dSBob Badour       return __QAIC_REMOTE(remote_handle_open)((const char*)ctx, ph);
483*418b791dSBob Badour    }
484*418b791dSBob Badour    return 0;
485*418b791dSBob Badour }
486*418b791dSBob Badour 
487*418b791dSBob Badour #if (defined __qdsp6__) || (defined __hexagon__)
488*418b791dSBob Badour #pragma weak  adsp_pls_add_lookup
489*418b791dSBob Badour extern int adsp_pls_add_lookup(uint32_t type, uint32_t key, int size, int (*ctor)(void* ctx, void* data), void* ctx, void (*dtor)(void* ctx), void** ppo);
490*418b791dSBob Badour #pragma weak  HAP_pls_add_lookup
491*418b791dSBob Badour extern int HAP_pls_add_lookup(uint32_t type, uint32_t key, int size, int (*ctor)(void* ctx, void* data), void* ctx, void (*dtor)(void* ctx), void** ppo);
492*418b791dSBob Badour 
_adsp_current_process_handle(void)493*418b791dSBob Badour __QAIC_STUB_EXPORT remote_handle _adsp_current_process_handle(void) {
494*418b791dSBob Badour    remote_handle* ph;
495*418b791dSBob Badour    if(adsp_pls_add_lookup) {
496*418b791dSBob Badour       if(0 == adsp_pls_add_lookup((uint32_t)_adsp_current_process_handle, 0, sizeof(*ph),  _adsp_current_process_pls_ctor, "adsp_current_process",  _adsp_current_process_pls_dtor, (void**)&ph))  {
497*418b791dSBob Badour          return *ph;
498*418b791dSBob Badour       }
499*418b791dSBob Badour       return (remote_handle)-1;
500*418b791dSBob Badour    } else if(HAP_pls_add_lookup) {
501*418b791dSBob Badour       if(0 == HAP_pls_add_lookup((uint32_t)_adsp_current_process_handle, 0, sizeof(*ph),  _adsp_current_process_pls_ctor, "adsp_current_process",  _adsp_current_process_pls_dtor, (void**)&ph))  {
502*418b791dSBob Badour          return *ph;
503*418b791dSBob Badour       }
504*418b791dSBob Badour       return (remote_handle)-1;
505*418b791dSBob Badour    }
506*418b791dSBob Badour    return(remote_handle)-1;
507*418b791dSBob Badour }
508*418b791dSBob Badour 
509*418b791dSBob Badour #else //__qdsp6__ || __hexagon__
510*418b791dSBob Badour 
511*418b791dSBob Badour uint32_t _adsp_current_process_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare);
512*418b791dSBob Badour 
513*418b791dSBob Badour #ifdef _WIN32
514*418b791dSBob Badour #include "Windows.h"
_adsp_current_process_atomic_CompareAndExchange(uint32_t * volatile puDest,uint32_t uExchange,uint32_t uCompare)515*418b791dSBob Badour uint32_t _adsp_current_process_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare) {
516*418b791dSBob Badour    return (uint32_t)InterlockedCompareExchange((volatile LONG*)puDest, (LONG)uExchange, (LONG)uCompare);
517*418b791dSBob Badour }
518*418b791dSBob Badour #elif __GNUC__
_adsp_current_process_atomic_CompareAndExchange(uint32_t * volatile puDest,uint32_t uExchange,uint32_t uCompare)519*418b791dSBob Badour uint32_t _adsp_current_process_atomic_CompareAndExchange(uint32_t * volatile puDest, uint32_t uExchange, uint32_t uCompare) {
520*418b791dSBob Badour    return __sync_val_compare_and_swap(puDest, uCompare, uExchange);
521*418b791dSBob Badour }
522*418b791dSBob Badour #endif //_WIN32
523*418b791dSBob Badour 
524*418b791dSBob Badour 
_adsp_current_process_handle(void)525*418b791dSBob Badour __QAIC_STUB_EXPORT remote_handle _adsp_current_process_handle(void) {
526*418b791dSBob Badour    static remote_handle handle = _const_adsp_current_process_handle;
527*418b791dSBob Badour    if((remote_handle)-1 != handle) {
528*418b791dSBob Badour       return handle;
529*418b791dSBob Badour    } else {
530*418b791dSBob Badour       remote_handle tmp;
531*418b791dSBob Badour       int nErr = _adsp_current_process_pls_ctor("adsp_current_process", (void*)&tmp);
532*418b791dSBob Badour       if(nErr) {
533*418b791dSBob Badour          return (remote_handle)-1;
534*418b791dSBob Badour       }
535*418b791dSBob Badour       if(((remote_handle)-1 != handle) || ((remote_handle)-1 != (remote_handle)_adsp_current_process_atomic_CompareAndExchange((uint32_t*)&handle, (uint32_t)tmp, (uint32_t)-1))) {
536*418b791dSBob Badour          _adsp_current_process_pls_dtor(&tmp);
537*418b791dSBob Badour       }
538*418b791dSBob Badour       return handle;
539*418b791dSBob Badour    }
540*418b791dSBob Badour }
541*418b791dSBob Badour 
542*418b791dSBob Badour #endif //__qdsp6__
543*418b791dSBob Badour 
__QAIC_STUB(adsp_current_process_skel_invoke)544*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adsp_current_process_skel_invoke)(uint32_t _sc, remote_arg* _pra) __QAIC_STUB_ATTRIBUTE {
545*418b791dSBob Badour    return __QAIC_REMOTE(remote_handle_invoke)(_adsp_current_process_handle(), _sc, _pra);
546*418b791dSBob Badour }
547*418b791dSBob Badour 
548*418b791dSBob Badour #ifdef __cplusplus
549*418b791dSBob Badour }
550*418b791dSBob Badour #endif
551*418b791dSBob Badour 
552*418b791dSBob Badour 
553*418b791dSBob Badour #ifdef __cplusplus
554*418b791dSBob Badour extern "C" {
555*418b791dSBob Badour #endif
_stub_method(remote_handle _handle,uint32_t _mid)556*418b791dSBob Badour static __inline int _stub_method(remote_handle _handle, uint32_t _mid) {
557*418b791dSBob Badour    remote_arg* _pra = 0;
558*418b791dSBob Badour    int _nErr = 0;
559*418b791dSBob Badour    _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 0, 0, 0, 0), _pra));
560*418b791dSBob Badour    _CATCH(_nErr) {}
561*418b791dSBob Badour    return _nErr;
562*418b791dSBob Badour }
__QAIC_STUB(adsp_current_process_exit)563*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adsp_current_process_exit)(void) __QAIC_STUB_ATTRIBUTE {
564*418b791dSBob Badour    uint32_t _mid = 0;
565*418b791dSBob Badour    return _stub_method(_adsp_current_process_handle(), _mid);
566*418b791dSBob Badour }
__QAIC_STUB(adsp_current_process_thread_exit)567*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adsp_current_process_thread_exit)(void) __QAIC_STUB_ATTRIBUTE {
568*418b791dSBob Badour    uint32_t _mid = 1;
569*418b791dSBob Badour    return _stub_method(_adsp_current_process_handle(), _mid);
570*418b791dSBob Badour }
_stub_unpack(remote_arg * _praROutPost,remote_arg * _ppraROutPost[1],void * _primROut,char * _in0[1],uint32_t _in0Len[1])571*418b791dSBob Badour static __inline int _stub_unpack(remote_arg* _praROutPost, remote_arg* _ppraROutPost[1], void* _primROut, char* _in0[1], uint32_t _in0Len[1]) {
572*418b791dSBob Badour    int _nErr = 0;
573*418b791dSBob Badour    remote_arg* _praROutPostStart = _praROutPost;
574*418b791dSBob Badour    remote_arg** _ppraROutPostStart = _ppraROutPost;
575*418b791dSBob Badour    _ppraROutPost = &_praROutPost;
576*418b791dSBob Badour    _ppraROutPostStart[0] += (_praROutPost - _praROutPostStart) +0;
577*418b791dSBob Badour    return _nErr;
578*418b791dSBob Badour }
_stub_pack(_allocator * _al,remote_arg * _praIn,remote_arg * _ppraIn[1],remote_arg * _praROut,remote_arg * _ppraROut[1],void * _primIn,void * _primROut,char * _in0[1],uint32_t _in0Len[1])579*418b791dSBob Badour static __inline int _stub_pack(_allocator* _al, remote_arg* _praIn, remote_arg* _ppraIn[1], remote_arg* _praROut, remote_arg* _ppraROut[1], void* _primIn, void* _primROut, char* _in0[1], uint32_t _in0Len[1]) {
580*418b791dSBob Badour    int _nErr = 0;
581*418b791dSBob Badour    remote_arg* _praInStart = _praIn;
582*418b791dSBob Badour    remote_arg** _ppraInStart = _ppraIn;
583*418b791dSBob Badour    remote_arg* _praROutStart = _praROut;
584*418b791dSBob Badour    remote_arg** _ppraROutStart = _ppraROut;
585*418b791dSBob Badour    _ppraIn = &_praIn;
586*418b791dSBob Badour    _ppraROut = &_praROut;
587*418b791dSBob Badour    _in0Len[0] = (1 + strlen(_in0[0]));
588*418b791dSBob Badour    _COPY(_primIn, 0, _in0Len, 0, 4);
589*418b791dSBob Badour    _praIn[0].buf.pv = _in0[0];
590*418b791dSBob Badour    _praIn[0].buf.nLen = (1 * _in0Len[0]);
591*418b791dSBob Badour    _ppraInStart[0] += (_praIn - _praInStart) + 1;
592*418b791dSBob Badour    _ppraROutStart[0] += (_praROut - _praROutStart) +0;
593*418b791dSBob Badour    return _nErr;
594*418b791dSBob Badour }
_count(int _numIn[1],int _numROut[1],char * _in0[1],uint32_t _in0Len[1])595*418b791dSBob Badour static __inline void _count(int _numIn[1], int _numROut[1], char* _in0[1], uint32_t _in0Len[1]) {
596*418b791dSBob Badour    _numIn[0] += 1;
597*418b791dSBob Badour    _numROut[0] += 0;
598*418b791dSBob Badour }
_stub_method_1(remote_handle _handle,uint32_t _mid,uint16_t _in0[1],void * _in1[1],uint32_t _in1Len[1])599*418b791dSBob Badour static __inline int _stub_method_1(remote_handle _handle, uint32_t _mid, uint16_t _in0[1], void* _in1[1], uint32_t _in1Len[1]) {
600*418b791dSBob Badour    remote_arg* _pra;
601*418b791dSBob Badour    int _numIn[1];
602*418b791dSBob Badour    int _numROut[1];
603*418b791dSBob Badour    char* _seq_nat1;
604*418b791dSBob Badour    int _ii;
605*418b791dSBob Badour    _allocator _al[1] = {{0}};
606*418b791dSBob Badour    uint32_t _primIn[2];
607*418b791dSBob Badour    remote_arg* _praIn;
608*418b791dSBob Badour    remote_arg** _ppraIn = &_praIn;
609*418b791dSBob Badour    remote_arg* _praROut;
610*418b791dSBob Badour    remote_arg** _ppraROut = &_praROut;
611*418b791dSBob Badour    char* _seq_primIn1;
612*418b791dSBob Badour    int _nErr = 0;
613*418b791dSBob Badour    remote_arg* _praROutPost;
614*418b791dSBob Badour    remote_arg** _ppraROutPost = &_praROutPost;
615*418b791dSBob Badour    _numIn[0] = 1;
616*418b791dSBob Badour    _numROut[0] = 0;
617*418b791dSBob Badour    for(_ii = 0, _seq_nat1 = (char*)_in1[0];_ii < (int)_in1Len[0];++_ii, _seq_nat1 = (_seq_nat1 + SLIM_IFPTR32(8, 16)))
618*418b791dSBob Badour    {
619*418b791dSBob Badour       _count(_numIn, _numROut, SLIM_IFPTR32((char**)&(((uint32_t*)_seq_nat1)[0]), (char**)&(((uint64_t*)_seq_nat1)[0])), SLIM_IFPTR32((uint32_t*)&(((uint32_t*)_seq_nat1)[1]), (uint32_t*)&(((uint32_t*)_seq_nat1)[2])));
620*418b791dSBob Badour    }
621*418b791dSBob Badour    _allocator_init(_al, 0, 0);
622*418b791dSBob Badour    _ALLOCATE(_nErr, _al, ((((_numIn[0] + _numROut[0]) + 1) + 0) * sizeof(_pra[0])), 4, _pra);
623*418b791dSBob Badour    _pra[0].buf.pv = (void*)_primIn;
624*418b791dSBob Badour    _pra[0].buf.nLen = sizeof(_primIn);
625*418b791dSBob Badour    _COPY(_primIn, 0, _in0, 0, 2);
626*418b791dSBob Badour    _COPY(_primIn, 4, _in1Len, 0, 4);
627*418b791dSBob Badour    _praIn = (_pra + 1);
628*418b791dSBob Badour    _praROut = (_praIn + _numIn[0] + 0);
629*418b791dSBob Badour    _ALLOCATE(_nErr, _al, (_in1Len[0] * 4), 4, _praIn[0].buf.pv);
630*418b791dSBob Badour    _praIn[0].buf.nLen = (4 * _in1Len[0]);
631*418b791dSBob Badour    for(_ii = 0, _seq_primIn1 = (char*)_praIn[0].buf.pv, _seq_nat1 = (char*)_in1[0];_ii < (int)_in1Len[0];++_ii, _seq_primIn1 = (_seq_primIn1 + 4), _seq_nat1 = (_seq_nat1 + SLIM_IFPTR32(8, 16)))
632*418b791dSBob Badour    {
633*418b791dSBob Badour       _TRY(_nErr, _stub_pack(_al, (_praIn + 1), _ppraIn, (_praROut + 0), _ppraROut, _seq_primIn1, 0, SLIM_IFPTR32((char**)&(((uint32_t*)_seq_nat1)[0]), (char**)&(((uint64_t*)_seq_nat1)[0])), SLIM_IFPTR32((uint32_t*)&(((uint32_t*)_seq_nat1)[1]), (uint32_t*)&(((uint32_t*)_seq_nat1)[2]))));
634*418b791dSBob Badour    }
635*418b791dSBob Badour    _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, (_numIn[0] + 1), (_numROut[0] + 0), 0, 0), _pra));
636*418b791dSBob Badour    _praROutPost = _praROut;
637*418b791dSBob Badour    for(_ii = 0, _seq_nat1 = (char*)_in1[0];_ii < (int)_in1Len[0];++_ii, _seq_nat1 = (_seq_nat1 + SLIM_IFPTR32(8, 16)))
638*418b791dSBob Badour    {
639*418b791dSBob Badour       _TRY(_nErr, _stub_unpack((_praROutPost + 0), _ppraROutPost, 0, SLIM_IFPTR32((char**)&(((uint32_t*)_seq_nat1)[0]), (char**)&(((uint64_t*)_seq_nat1)[0])), SLIM_IFPTR32((uint32_t*)&(((uint32_t*)_seq_nat1)[1]), (uint32_t*)&(((uint32_t*)_seq_nat1)[2]))));
640*418b791dSBob Badour    }
641*418b791dSBob Badour    _CATCH(_nErr) {}
642*418b791dSBob Badour    _allocator_deinit(_al);
643*418b791dSBob Badour    return _nErr;
644*418b791dSBob Badour }
__QAIC_STUB(adsp_current_process_set_logging_params)645*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adsp_current_process_set_logging_params)(unsigned short mask, const _cstring1_t* filesToLog, int filesToLogLen) __QAIC_STUB_ATTRIBUTE {
646*418b791dSBob Badour    uint32_t _mid = 2;
647*418b791dSBob Badour    return _stub_method_1(_adsp_current_process_handle(), _mid, (uint16_t*)&mask, (void**)&filesToLog, (uint32_t*)&filesToLogLen);
648*418b791dSBob Badour }
_stub_method_2(remote_handle _handle,uint32_t _mid,uint32_t _rout0[1])649*418b791dSBob Badour static __inline int _stub_method_2(remote_handle _handle, uint32_t _mid, uint32_t _rout0[1]) {
650*418b791dSBob Badour    int _numIn[1];
651*418b791dSBob Badour    remote_arg _pra[1];
652*418b791dSBob Badour    uint32_t _primROut[1];
653*418b791dSBob Badour    int _nErr = 0;
654*418b791dSBob Badour    _numIn[0] = 0;
655*418b791dSBob Badour    _pra[(_numIn[0] + 0)].buf.pv = (void*)_primROut;
656*418b791dSBob Badour    _pra[(_numIn[0] + 0)].buf.nLen = sizeof(_primROut);
657*418b791dSBob Badour    _TRY(_nErr, __QAIC_REMOTE(remote_handle_invoke)(_handle, REMOTE_SCALARS_MAKEX(0, _mid, 0, 1, 0, 0), _pra));
658*418b791dSBob Badour    _COPY(_rout0, 0, _primROut, 0, 4);
659*418b791dSBob Badour    _CATCH(_nErr) {}
660*418b791dSBob Badour    return _nErr;
661*418b791dSBob Badour }
__QAIC_STUB(adsp_current_process_getASID)662*418b791dSBob Badour __QAIC_STUB_EXPORT int __QAIC_STUB(adsp_current_process_getASID)(unsigned int* asid) __QAIC_STUB_ATTRIBUTE {
663*418b791dSBob Badour    uint32_t _mid = 3;
664*418b791dSBob Badour    return _stub_method_2(_adsp_current_process_handle(), _mid, (uint32_t*)asid);
665*418b791dSBob Badour }
666*418b791dSBob Badour #ifdef __cplusplus
667*418b791dSBob Badour }
668*418b791dSBob Badour #endif
669*418b791dSBob Badour #endif //_ADSP_CURRENT_PROCESS_STUB_H
670