1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#ifndef _avcall_h /*-*- C -*-*/
#define _avcall_h
/**
Copyright 1993 Bill Triggs, <Bill.Triggs@inrialpes.fr>
Copyright 1995-2006 Bruno Haible, <bruno@clisp.org>
This is free software distributed under the GNU General Public
Licence described in the file COPYING. Contact the author if
you don't have this or can't live with it. There is ABSOLUTELY
NO WARRANTY, explicit or implied, on this software.
**/
/*----------------------------------------------------------------------
av_call() foreign function interface.
Varargs-style macros to build a C argument list incrementally
and call a function on it.
----------------------------------------------------------------------*/
#if !defined(LIBFFCALL_VERSION)
# define LIBFFCALL_VERSION @LIBFFCALL_VERSION@
#endif
/* These definitions are adjusted by `configure' automatically. */
/* CPU */
#ifndef __i386__
#undef __i386__
#endif
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#ifndef _avcall_h /*-*- C -*-*/
#define _avcall_h
/**
Copyright 1993 Bill Triggs, <Bill.Triggs@inrialpes.fr>
Copyright 1995-2004 Bruno Haible, <bruno@clisp.org>
This is free software distributed under the GNU General Public
Licence described in the file COPYING. Contact the author if
you don't have this or can't live with it. There is ABSOLUTELY
NO WARRANTY, explicit or implied, on this software.
**/
/*----------------------------------------------------------------------
av_call() foreign function interface.
Varargs-style macros to build a C argument list incrementally
and call a function on it.
----------------------------------------------------------------------*/
/* These definitions are adjusted by `configure' automatically. */
/* CPU */
#ifndef __i386__
#undef __i386__
#endif
|
︙ | | | ︙ | |
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#endif
#ifndef __hppa__
#undef __hppa__
#endif
#ifndef __arm__
#undef __arm__
#endif
#ifndef __powerpc__
#undef __powerpc__
#endif
#ifndef __powerpc64__
#undef __powerpc64__
#endif
#ifndef __s390__
#undef __s390__
#endif
#ifndef __m88k__
#undef __m88k__
#endif
|
|
|
<
<
<
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#endif
#ifndef __hppa__
#undef __hppa__
#endif
#ifndef __arm__
#undef __arm__
#endif
#ifndef __rs6000__
#undef __rs6000__
#endif
#ifndef __s390__
#undef __s390__
#endif
#ifndef __m88k__
#undef __m88k__
#endif
|
︙ | | | ︙ | |
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* Define if using pcc non-reentrant struct return convention */
#undef __PCC_STRUCT_RETURN__
/* Define if small structs are returned in registers */
#undef __SMALL_STRUCT_RETURN__
/* Define if floating-point results are returned in the integer registers */
#undef __IREG_FLOAT_RETURN__
/* AC_TYPE_LONG_LONG */
/* Define if your compiler supports the 'long long' type. */
#undef HAVE_LONG_LONG_INT
/* End of definitions adjusted by `configure'. */
/* Max # words in argument-list and temporary structure storage.
*/
#ifndef __AV_ALIST_WORDS
|
|
|
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/* Define if using pcc non-reentrant struct return convention */
#undef __PCC_STRUCT_RETURN__
/* Define if small structs are returned in registers */
#undef __SMALL_STRUCT_RETURN__
/* Define if floating-point results are returned in the integer registers */
#undef __IREG_FLOAT_RETURN__
/* CL_LONGLONG */
/* Define if your compiler supports the `long long' type. */
#undef HAVE_LONGLONG
/* End of definitions adjusted by `configure'. */
/* Max # words in argument-list and temporary structure storage.
*/
#ifndef __AV_ALIST_WORDS
|
︙ | | | ︙ | |
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
*/
#ifndef __AV_STRUCT_RETURN
__AV_STRUCT_RETURN =
#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */
__AV_SUNPROCC_STRUCT_RETURN,
#else
#if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */
__AV_PCC_STRUCT_RETURN,
#else
#if defined(__SMALL_STRUCT_RETURN__) || defined(__mipsn32__) || defined(__mips64__) || defined(__ARMEL__) /* defined through configure, see above */
__AV_SMALL_STRUCT_RETURN |
#endif
#if defined(__GNUC__)
__AV_GCC_STRUCT_RETURN |
#endif
#if defined(__i386__) && defined(NeXT) && defined(__GNUC__) /* NeXT gcc-2.5.8 */
__AV_NEXTGCC_STRUCT_RETURN |
|
|
>
>
>
>
>
|
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
*/
#ifndef __AV_STRUCT_RETURN
__AV_STRUCT_RETURN =
#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */
__AV_SUNPROCC_STRUCT_RETURN,
#else
#if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */
__AV_PCC_STRUCT_RETURN |
#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && !(defined(__STDC__) || defined(__GNUC__)) /* sun cc */
__AV_SUNCC_STRUCT_RETURN,
#else
0,
#endif
#else
#if defined(__SMALL_STRUCT_RETURN__) || defined(__mipsn32__) || defined(__mips64__) /* defined through configure, see above */
__AV_SMALL_STRUCT_RETURN |
#endif
#if defined(__GNUC__)
__AV_GCC_STRUCT_RETURN |
#endif
#if defined(__i386__) && defined(NeXT) && defined(__GNUC__) /* NeXT gcc-2.5.8 */
__AV_NEXTGCC_STRUCT_RETURN |
|
︙ | | | ︙ | |
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
#endif
#endif
/* how to pass structs */
#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)
__AV_SGICC_STRUCT_ARGS = 1<<7,
#endif
#if defined(__powerpc__) && !defined(__powerpc64__)
__AV_AIXCC_STRUCT_ARGS = 1<<7,
#endif
/* the default way to pass floats */
/* This choice here is based on the assumption that the function you are
* going to call has been compiled with the same compiler you are using to
* include this file.
* If you want to call functions with another float passing convention,
* just #define __AV_STRUCT_ARGS ...
* before or after #including <avcall.h>.
*/
#ifndef __AV_STRUCT_ARGS
#if (defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */
__AV_STRUCT_ARGS = __AV_SGICC_STRUCT_ARGS,
#else
#if defined(__powerpc__) && !defined(__powerpc64__) && defined(_AIX) && !defined(__GNUC__) /* AIX cc, xlc */
__AV_STRUCT_ARGS = __AV_AIXCC_STRUCT_ARGS,
#else
__AV_STRUCT_ARGS = 0,
#endif
#endif
#endif
/* how to pass floats */
/* ANSI C compilers and GNU gcc pass floats as floats.
* K&R C compilers pass floats as doubles. We don't support them any more.
*/
/* how to pass and return small integer arguments */
__AV_ANSI_INTEGERS = 0, /* no promotions */
__AV_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */
/* Fortunately these two methods are compatible. Our macros work with both. */
/* stack cleanup policy */
__AV_CDECL_CLEANUP = 0, /* caller pops args after return */
__AV_STDCALL_CLEANUP = 0, /* callee pops args before return */
/* currently only supported on __i386__ */
#ifndef __AV_CLEANUP
__AV_CLEANUP = __AV_CDECL_CLEANUP,
#endif
/* These are for internal use only */
#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__arm__) || (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__)
__AV_REGISTER_STRUCT_RETURN = 1<<9,
#endif
#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)
__AV_FLOAT_1 = 1<<10,
__AV_FLOAT_2 = 1<<11,
__AV_DOUBLE_1 = 1<<12,
__AV_DOUBLE_2 = 1<<13,
#endif
__AV_flag_for_broken_compilers_that_dont_like_trailing_commas
};
typedef struct
{
/* function to be called */
__avword (*func)();
/* some av_... macros need these flags */
int flags;
/* return type, address for the result */
void* raddr;
enum __AVtype rtype;
unsigned long rsize;
/* current pointer into the args[] array */
__avword* aptr;
#if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__powerpc__) && !defined(__powerpc64__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390__)
/* limit pointer into the args[] array */
__avword* eptr;
#endif
#if defined(__i386__) && 0
/* Filler word, needed if the numbers of words up to now in this structure */
/* is odd (because on MSVC, alignof(double) = 8, normally = 4). */
__avword filler1;
#endif
#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__arm__) || (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__convex__) || defined(__s390__)
/* temporary storage, used to split doubles into two words */
union {
double _double;
#if defined(__sparc__) && !defined(__sparc64__) && defined(HAVE_LONG_LONG_INT)
long long _longlong;
#endif
__avword words[2];
} tmp;
#endif
#if defined(__x86_64__)
/* store the integer arguments in an extra array */
__avword* iaptr;
__avword iargs[6];
#endif
#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)
/* store the floating-point arguments in an extra array */
int anum;
float floatarg[2];
double doublearg[2];
#endif
#if defined(__mipsn32__) || defined(__mips64__)
/* store the floating-point arguments in an extra array */
int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */
unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */
float farg[8];
#endif
#if defined(__sparc64__)
/* store the floating-point arguments in an extra array */
int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
unsigned int darg_mask; /* bitmask of those entries in args[] which have a float or double value */
#endif
#if defined(__ia64__) || defined(__x86_64__)
/* store the floating-point arguments in an extra array */
double* faptr;
double fargs[8];
#endif
__avword args[__AV_ALIST_WORDS]; /* sizeof(double)-aligned */
#if defined(__powerpc__) || defined(__powerpc64__)
/* store the floating-point arguments in an extra array */
double* faptr;
double fargs[13];
#endif
#if defined(__s390__)
/* store the floating-point arguments in an extra array */
int fargwords;
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
<
<
|
|
|
|
|
<
>
|
|
|
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
#endif
#endif
/* how to pass structs */
#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)
__AV_SGICC_STRUCT_ARGS = 1<<7,
#endif
#if defined(__rs6000__)
__AV_AIXCC_STRUCT_ARGS = 1<<7,
#endif
/* the default way to pass floats */
/* This choice here is based on the assumption that the function you are
* going to call has been compiled with the same compiler you are using to
* include this file.
* If you want to call functions with another float passing convention,
* just #define __AV_STRUCT_ARGS ...
* before or after #including <avcall.h>.
*/
#ifndef __AV_STRUCT_ARGS
#if (defined(__mips__) || defined(__mipsn32__) || defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */
__AV_STRUCT_ARGS = __AV_SGICC_STRUCT_ARGS,
#else
#if defined(__rs6000__) && defined(_AIX) && !defined(__GNUC__) /* AIX cc, xlc */
__AV_STRUCT_ARGS = __AV_AIXCC_STRUCT_ARGS,
#else
__AV_STRUCT_ARGS = 0,
#endif
#endif
#endif
/* how to pass floats */
/* ANSI C compilers and GNU gcc pass floats as floats.
* K&R C compilers pass floats as doubles.
* (Except some compilers like SGI MIPS "cc" and "cc -cckr" if a prototype is
* known for the called functions. But to compile a program with prototypes,
* "cc -ansi" is better anyway.
*/
__AV_ANSI_FLOAT_ARGS = 0, /* pass floats as floats */
__AV_TRADITIONAL_FLOAT_ARGS = 1<<8, /* pass floats as doubles */
/* the default way to pass floats */
/* This choice here is based on the assumption that the function you are
* going to call has been compiled with the same compiler you are using to
* include this file.
* If you want to call functions with another float passing convention,
* just #define __AV_FLOAT_ARGS ...
* before or after #including <avcall.h>.
*/
#ifndef __AV_FLOAT_ARGS
#if defined(__STDC__) || defined(__GNUC__) /* what about hppa "cc -Aa" ?? */
__AV_FLOAT_ARGS = __AV_ANSI_FLOAT_ARGS,
#else
__AV_FLOAT_ARGS = __AV_TRADITIONAL_FLOAT_ARGS,
#endif
#endif
/* how to pass and return small integer arguments */
__AV_ANSI_INTEGERS = 0, /* no promotions */
__AV_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */
/* Fortunately these two methods are compatible. Our macros work with both. */
/* the default way to pass and return small integer arguments */
/* This choice here is based on the assumption that the function you are
* going to call has been compiled with the same compiler you are using to
* include this file.
* If you want to call functions with another float passing convention,
* just #define __AV_INTEGERS ...
* before or after #including <avcall.h>.
*/
#ifndef __AV_INTEGERS
#if defined(__STDC__) || defined(__GNUC__)
__AV_INTEGERS = __AV_ANSI_INTEGERS,
#else
__AV_INTEGERS = __AV_TRADITIONAL_INTEGERS,
#endif
#endif
/* stack cleanup policy */
__AV_CDECL_CLEANUP = 0, /* caller pops args after return */
__AV_STDCALL_CLEANUP = 0, /* callee pops args before return */
/* currently only supported on __i386__ */
#ifndef __AV_CLEANUP
__AV_CLEANUP = __AV_CDECL_CLEANUP,
#endif
/* These are for internal use only */
#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__)
__AV_REGISTER_STRUCT_RETURN = 1<<9,
#endif
#if defined(__mips__) && !defined(__mipsn32__)
__AV_FLOAT_1 = 1<<10,
__AV_FLOAT_2 = 1<<11,
#endif
__AV_flag_for_broken_compilers_that_dont_like_trailing_commas
};
typedef struct
{
/* function to be called */
__avword (*func)();
/* some av_... macros need these flags */
int flags;
/* return type, address for the result */
void* raddr;
enum __AVtype rtype;
unsigned long rsize;
/* current pointer into the args[] array */
__avword* aptr;
#if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__rs6000__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390__)
/* limit pointer into the args[] array */
__avword* eptr;
#endif
#if defined(__i386__) && 0
/* Filler word, needed if the numbers of words up to now in this structure */
/* is odd (because on MSVC, alignof(double) = 8, normally = 4). */
__avword filler1;
#endif
#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__s390__)
/* temporary storage, used to split doubles into two words */
union {
double _double;
#if defined(__sparc__) && !defined(__sparc64__) && defined(HAVE_LONGLONG)
long long _longlong;
#endif
__avword words[2];
} tmp;
#endif
#if defined(__x86_64__)
/* store the integer arguments in an extra array */
__avword* iaptr;
__avword iargs[6];
#endif
#if defined(__mips__) && !defined(__mipsn32__)
/* store the floating-point arguments in an extra array */
int anum;
double floatarg[2];
#endif
#if defined(__mipsn32__) || defined(__mips64__)
/* store the floating-point arguments in an extra array */
int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */
unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */
float farg[8];
#endif
#if defined(__sparc64__)
/* store the floating-point arguments in an extra array */
int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */
unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */
unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */
#endif
#if defined(__ia64__) || defined(__x86_64__)
/* store the floating-point arguments in an extra array */
double* faptr;
double fargs[8];
#endif
__avword args[__AV_ALIST_WORDS]; /* sizeof(double)-aligned */
#if defined(__rs6000__)
/* store the floating-point arguments in an extra array */
double* faptr;
double fargs[13];
#endif
#if defined(__s390__)
/* store the floating-point arguments in an extra array */
int fargwords;
|
︙ | | | ︙ | |
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
#if defined(AMIGA)
/* store the arguments passed in registers in an extra array */
__avword regargs[8+7];
#endif
} av_alist;
/* The limit for the pointer into the args[] array. */
#if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__powerpc__) && !defined(__powerpc64__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390)
#define __av_eptr(LIST) ((LIST).eptr)
#else
#define __av_eptr(LIST) (&(LIST).args[__AV_ALIST_WORDS])
#endif
/* Delayed overflow detection */
#if defined(__hppa__)
#define av_overflown(LIST) ((LIST).aptr < __av_eptr(LIST))
#else
#define av_overflown(LIST) ((LIST).aptr > __av_eptr(LIST))
#endif
/*
* av_start_<type> macros which specify the return type
*/
#define __AV_START_FLAGS \
__AV_STRUCT_RETURN | __AV_FLOAT_RETURN | __AV_STRUCT_ARGS | __AV_CLEANUP
#define __av_start(LIST,FUNC,RADDR,RETTYPE) \
((LIST).func = (__avword(*)())(FUNC), \
(LIST).raddr = (void*)(RADDR), \
(LIST).rtype = (RETTYPE), \
__av_start1(LIST) \
(LIST).flags = __AV_START_FLAGS)
#if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || defined(__arm__) || defined(__m88k__) || defined(__convex__)
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0],
#endif
#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)
#define __av_start1(LIST) \
(LIST).anum = 0, \
(LIST).aptr = &(LIST).args[0],
#endif
#if defined(__mipsn32__) || defined(__mips64__)
#define __av_start1(LIST) \
(LIST).anum = 0, \
(LIST).farg_mask = 0, \
(LIST).darg_mask = 0, \
(LIST).aptr = &(LIST).args[0],
#endif
#if defined(__sparc__) && !defined(__sparc64__)
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0], \
(LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
#endif
#if defined(__sparc64__)
#define __av_start1(LIST) \
(LIST).anum = 0, \
(LIST).darg_mask = 0, \
(LIST).aptr = &(LIST).args[0], \
(LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
#endif
#if defined(__hppa__)
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[__AV_ALIST_WORDS], \
(LIST).eptr = &(LIST).args[0],
#endif
#if defined(__powerpc__) || defined(__powerpc64__)
#if defined(__powerpc64__) || defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0], \
(LIST).faptr = &(LIST).fargs[0],
#else
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0], \
(LIST).faptr = &(LIST).fargs[0], \
|
|
|
|
>
|
|
|
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
|
#if defined(AMIGA)
/* store the arguments passed in registers in an extra array */
__avword regargs[8+7];
#endif
} av_alist;
/* The limit for the pointer into the args[] array. */
#if defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || (defined(__rs6000__) && !defined(_AIX) && !(defined(__MACH__) && defined(__APPLE__))) || defined(__s390)
#define __av_eptr(LIST) ((LIST).eptr)
#else
#define __av_eptr(LIST) (&(LIST).args[__AV_ALIST_WORDS])
#endif
/* Delayed overflow detection */
#if defined(__hppa__)
#define av_overflown(LIST) ((LIST).aptr < __av_eptr(LIST))
#else
#define av_overflown(LIST) ((LIST).aptr > __av_eptr(LIST))
#endif
/*
* av_start_<type> macros which specify the return type
*/
#define __AV_START_FLAGS \
__AV_STRUCT_RETURN | __AV_FLOAT_RETURN | __AV_STRUCT_ARGS | __AV_FLOAT_ARGS | __AV_INTEGERS | __AV_CLEANUP
#define __av_start(LIST,FUNC,RADDR,RETTYPE) \
((LIST).func = (__avword(*)())(FUNC), \
(LIST).raddr = (void*)(RADDR), \
(LIST).rtype = (RETTYPE), \
__av_start1(LIST) \
(LIST).flags = __AV_START_FLAGS)
#if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || defined(__arm__) || defined(__m88k__) || defined(__convex__)
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0],
#endif
#if defined(__mips__) && !defined(__mipsn32__)
#define __av_start1(LIST) \
(LIST).anum = 0, \
(LIST).aptr = &(LIST).args[0],
#endif
#if defined(__mipsn32__) || defined(__mips64__)
#define __av_start1(LIST) \
(LIST).anum = 0, \
(LIST).farg_mask = 0, \
(LIST).darg_mask = 0, \
(LIST).aptr = &(LIST).args[0],
#endif
#if defined(__sparc__) && !defined(__sparc64__)
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0], \
(LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
#endif
#if defined(__sparc64__)
#define __av_start1(LIST) \
(LIST).anum = 0, \
(LIST).farg_mask = 0, \
(LIST).darg_mask = 0, \
(LIST).aptr = &(LIST).args[0], \
(LIST).eptr = &(LIST).args[__AV_ALIST_WORDS],
#endif
#if defined(__hppa__)
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[__AV_ALIST_WORDS], \
(LIST).eptr = &(LIST).args[0],
#endif
#if defined(__rs6000__)
#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0], \
(LIST).faptr = &(LIST).fargs[0],
#else
#define __av_start1(LIST) \
(LIST).aptr = &(LIST).args[0], \
(LIST).faptr = &(LIST).fargs[0], \
|
︙ | | | ︙ | |
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
|
) ) ) )
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if (defined(__i386__) && !defined(_WIN32)) || defined(__m68k__) || (defined(__arm__) && !defined(__ARMEL__)) || (defined(__powerpc__) && !defined(__powerpc64__)) || defined(__convex__) || defined(__s390__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 \
|| ((TYPE_SIZE) == 8 && (TYPE_SPLITTABLE) \
&& ((LIST).flags & __AV_GCC_STRUCT_RETURN) \
) )
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__ARMEL__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) <= 4)
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__alpha__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \
|| ((TYPE_SIZE) == 16 && (TYPE_SPLITTABLE) \
&& ((LIST).flags & __AV_GCC_STRUCT_RETURN) \
) )
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
|
|
<
<
<
<
<
<
<
<
|
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
|
) ) ) )
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if (defined(__i386__) && !defined(_WIN32)) || defined(__m68k__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__s390__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 \
|| ((TYPE_SIZE) == 8 && (TYPE_SPLITTABLE) \
&& ((LIST).flags & __AV_GCC_STRUCT_RETURN) \
) )
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__alpha__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \
|| ((TYPE_SIZE) == 16 && (TYPE_SPLITTABLE) \
&& ((LIST).flags & __AV_GCC_STRUCT_RETURN) \
) )
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
|
︙ | | | ︙ | |
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
|
? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4) \
: ((TYPE_SIZE) <= 8) \
)
/* Test both __AV_OLDGCC_STRUCT_RETURN and __AV_SMALL_STRUCT_RETURN at run time. */
#define __av_start_struct3(LIST) \
0
#endif
#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4)
/* Test __AV_SMALL_STRUCT_RETURN instead of __AV_REGISTER_STRUCT_RETURN. */
#define __av_start_struct3(LIST) \
0
#endif
#if defined(__mipsn32__) || defined(__mips64__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((LIST).flags & __AV_GCC_STRUCT_RETURN \
? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) \
: ((TYPE_SIZE) <= 16) \
)
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__powerpc64__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
0
#define __av_start_struct3(LIST) \
0
#endif
#if defined(__sparc64__) || defined(__ia64__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) <= 32)
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
|
|
<
<
<
<
<
<
|
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
|
? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4) \
: ((TYPE_SIZE) <= 8) \
)
/* Test both __AV_OLDGCC_STRUCT_RETURN and __AV_SMALL_STRUCT_RETURN at run time. */
#define __av_start_struct3(LIST) \
0
#endif
#if defined(__mips__) && !defined(__mipsn32__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4)
/* Test __AV_SMALL_STRUCT_RETURN instead of __AV_REGISTER_STRUCT_RETURN. */
#define __av_start_struct3(LIST) \
0
#endif
#if defined(__mipsn32__) || defined(__mips64__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((LIST).flags & __AV_GCC_STRUCT_RETURN \
? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) \
: ((TYPE_SIZE) <= 16) \
)
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
#define __av_start_struct3(LIST) \
((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0)
#endif
#if defined(__sparc64__) || defined(__ia64__)
#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \
((TYPE_SIZE) <= 32)
/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set
* and the struct will actually be returned in registers.
*/
|
︙ | | | ︙ | |
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
|
#if defined(__m68k__) || defined(__hppa__) || defined(__ia64__)
/* Return structure pointer is passed in a special register.
*/
#define __av_start_struct4(LIST,TYPE_SIZE) 0
#endif
/* Return structure pointer is passed as first arg.
*/
#if defined(__alpha__) || defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__convex__) || defined(__s390__)
#define __av_start_struct4(LIST,TYPE_SIZE) \
(*(LIST).aptr++ = (__avword)((LIST).raddr), 0)
#endif
#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__)
#define __av_start_struct4(LIST,TYPE_SIZE) \
(*(LIST).aptr++ = (__avword)((LIST).raddr), \
(LIST).anum++, \
|
|
|
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
|
#if defined(__m68k__) || defined(__hppa__) || defined(__ia64__)
/* Return structure pointer is passed in a special register.
*/
#define __av_start_struct4(LIST,TYPE_SIZE) 0
#endif
/* Return structure pointer is passed as first arg.
*/
#if defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__convex__) || defined(__s390__)
#define __av_start_struct4(LIST,TYPE_SIZE) \
(*(LIST).aptr++ = (__avword)((LIST).raddr), 0)
#endif
#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__)
#define __av_start_struct4(LIST,TYPE_SIZE) \
(*(LIST).aptr++ = (__avword)((LIST).raddr), \
(LIST).anum++, \
|
︙ | | | ︙ | |
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
|
* av_<type> macros which specify the argument and its type
*/
/*
* scalar argument types
*/
#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__alpha__) || defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__m88k__) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__)
/* Floats and all integer types are passed as words,
* doubles as two words.
*/
#define __av_word(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : ((LIST).aptr[-1] = (__avword)(VAL), 0))
#endif
|
|
|
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
|
* av_<type> macros which specify the argument and its type
*/
/*
* scalar argument types
*/
#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__alpha__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__)
/* Floats and all integer types are passed as words,
* doubles as two words.
*/
#define __av_word(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : ((LIST).aptr[-1] = (__avword)(VAL), 0))
#endif
|
︙ | | | ︙ | |
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
|
#define av_schar av_long
#define av_short av_long
#define av_int av_long
#define av_uchar av_ulong
#define av_ushort av_ulong
#define av_uint av_ulong
#if defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64__)
/* `long long' and `long' are identical. */
#define av_longlong av_long
#define av_ulonglong av_ulong
#elif defined(__mipsn32__)
/* `long long' fits in __avword. */
#define av_longlong __av_word
#define av_ulonglong(LIST,VAL) __av_word(LIST,(unsigned long long)(VAL))
#elif defined(__i386__) || defined(__m68k__) || (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__arm__) || defined(__powerpc__) || defined(__m88k__) || defined(__convex__) || defined(__s390__)
/* `long long's are passed embedded on the arg stack. */
#define av_longlong(LIST,VAL) __av_longlong(LIST,long long,VAL)
#define av_ulonglong(LIST,VAL) __av_longlong(LIST,unsigned long long,VAL)
#if defined(__i386__) || defined(__m68k__) || defined(__arm__) || (defined(__powerpc__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__convex__)
#if defined(__ARMEL__)
/* `long long's are 8 bytes aligned on ARM. */
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#else
/* `long long's are (at most) word-aligned. */
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr += sizeof(TYPE)/sizeof(__avword)) > __av_eptr(LIST) \
? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#endif
#endif
#if defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || (defined(__powerpc__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__) || defined(__s390__)
/* `long long's have alignment 8. */
#if defined(__mips__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : ((LIST).anum++, ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#endif
#if defined(__sparc__) && !defined(__sparc64__)
|
|
|
|
<
<
<
<
<
<
<
|
|
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
|
#define av_schar av_long
#define av_short av_long
#define av_int av_long
#define av_uchar av_ulong
#define av_ushort av_ulong
#define av_uint av_ulong
#if defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__ia64__) || defined(__x86_64__)
/* `long long' and `long' are identical. */
#define av_longlong av_long
#define av_ulonglong av_ulong
#elif defined(__mipsn32__)
/* `long long' fits in __avword. */
#define av_longlong __av_word
#define av_ulonglong(LIST,VAL) __av_word(LIST,(unsigned long long)(VAL))
#elif defined(__i386__) || defined(__m68k__) || defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) || defined(__s390__)
/* `long long's are passed embedded on the arg stack. */
#define av_longlong(LIST,VAL) __av_longlong(LIST,long long,VAL)
#define av_ulonglong(LIST,VAL) __av_longlong(LIST,unsigned long long,VAL)
#if defined(__i386__) || defined(__m68k__) || defined(__arm__) || (defined(__rs6000__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__convex__)
/* `long long's are (at most) word-aligned. */
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr += sizeof(TYPE)/sizeof(__avword)) > __av_eptr(LIST) \
? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#endif
#if defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || (defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__) || defined(__s390__)
/* `long long's have alignment 8. */
#if defined(__mips__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : ((LIST).anum++, ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#endif
#if defined(__sparc__) && !defined(__sparc64__)
|
︙ | | | ︙ | |
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
|
0))
#endif
#if defined(__hppa__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr & -(long)__AV_alignof(TYPE)) - sizeof(TYPE))) < __av_eptr(LIST) \
? -1 : (*(TYPE*)(LIST).aptr = (TYPE)(VAL), 0))
#endif
#if (defined(__powerpc__) && !defined(__powerpc64__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#endif
#if defined(__s390__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : \
(((LIST).aptr - (LIST).args - (LIST).fargwords == 4 ? ++(LIST).aptr,0 : 0), \
(((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0)))
#endif
#endif
#endif
/* floating-point argument types */
#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__arm__) || defined(__convex__)
#define av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0))
#if defined(__ARMEL__)
/* Almost identical normal case, but we must align location */
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+15)&-8)) \
> __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0))
#else
/* This assumes sizeof(double) == 2*sizeof(__avword). */
#define av_double(LIST,VAL) \
(((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0))
#endif
#endif
#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)
/* Up to 2 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs. For doubles we need to align the aptr
* to an even boundary.
*/
#define av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : ((++(LIST).anum == 1 \
? ((LIST).flags |= __AV_FLOAT_1, \
(LIST).floatarg[0] = ((float*)(LIST).aptr)[-1] = (float)(VAL))\
: (LIST).anum == 2 && (((LIST).flags & __AV_FLOAT_1) || ((LIST).flags & __AV_DOUBLE_1))\
? ((LIST).flags |= __AV_FLOAT_2, \
(LIST).floatarg[1] = ((float*)(LIST).aptr)[-1] = (float)(VAL))\
: (((float*)(LIST).aptr)[-1] = (float)(VAL))), \
0))
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+15)&-8)) \
> __av_eptr(LIST) \
? -1 : ((++(LIST).anum == 1 \
? ((LIST).flags |= __AV_DOUBLE_1, \
(LIST).doublearg[0] = ((double*)(LIST).aptr)[-1] = (double)(VAL))\
: (LIST).anum == 2 && (((LIST).flags & __AV_FLOAT_1) || ((LIST).flags & __AV_DOUBLE_1))\
? ((LIST).flags |= __AV_DOUBLE_2, \
(LIST).doublearg[1] = ((double*)(LIST).aptr)[-1] = (double)(VAL))\
: (((double*)(LIST).aptr)[-1] = (double)(VAL))), \
0))
#endif
#if defined(__mipsn32__) || defined(__mips64__)
/* Up to 8 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define av_float(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (((LIST).anum < 8 \
? ((LIST).farg_mask |= (1 << (LIST).anum), \
(LIST).farg[(LIST).anum] = *(float*)(LIST).aptr = (float)(VAL)) \
: (*(float*)(LIST).aptr = (float)(VAL))), \
(LIST).anum++, \
(LIST).aptr++, \
|
|
>
>
>
>
>
|
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
|
0))
#endif
#if defined(__hppa__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr & -(long)__AV_alignof(TYPE)) - sizeof(TYPE))) < __av_eptr(LIST) \
? -1 : (*(TYPE*)(LIST).aptr = (TYPE)(VAL), 0))
#endif
#if (defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : (((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0))
#endif
#if defined(__s390__)
#define __av_longlong(LIST,TYPE,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(long)__AV_alignof(TYPE))) > __av_eptr(LIST) \
? -1 : \
(((LIST).aptr - (LIST).args - (LIST).fargwords == 4 ? ++(LIST).aptr,0 : 0), \
(((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), 0)))
#endif
#endif
#endif
/* floating-point argument types */
#define av_float(LIST,VAL) \
((LIST).flags & __AV_TRADITIONAL_FLOAT_ARGS \
? av_double(LIST,(float)(VAL)) \
: __av_float(LIST,VAL))
#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__arm__) || defined(__convex__)
#define __av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0))
/* This assumes sizeof(double) == 2*sizeof(__avword). */
#define av_double(LIST,VAL) \
(((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0))
#endif
#if defined(__mips__) && !defined(__mipsn32__)
/* Up to 2 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs. For doubles we need to align the aptr
* to an even boundary.
*/
#define __av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : ((++(LIST).anum == 1 \
? ((LIST).flags |= __AV_FLOAT_1, \
((float*)(LIST).floatarg)[1] = ((float*)(LIST).aptr)[-1] = (float)(VAL))\
: (LIST).anum == 2 && ((LIST).flags & __AV_FLOAT_1) \
? ((LIST).flags |= __AV_FLOAT_2, \
((float*)(LIST).floatarg)[3] = ((float*)(LIST).aptr)[-1] = (float)(VAL))\
: (*(float*)&(LIST).aptr[-1] = (float)(VAL))), \
0))
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+15)&-8)) \
> __av_eptr(LIST) \
? -1 : ((++(LIST).anum == 1 \
? ((LIST).flags |= __AV_FLOAT_1, \
(LIST).floatarg[0] = ((double*)(LIST).aptr)[-1] = (double)(VAL))\
: (LIST).anum == 2 && ((LIST).flags & __AV_FLOAT_1) \
? ((LIST).flags |= __AV_FLOAT_2, \
(LIST).floatarg[1] = ((double*)(LIST).aptr)[-1] = (double)(VAL))\
: (((double*)(LIST).aptr)[-1] = (double)(VAL))), \
0))
#endif
#if defined(__mipsn32__) || defined(__mips64__)
/* Up to 8 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define __av_float(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (((LIST).anum < 8 \
? ((LIST).farg_mask |= (1 << (LIST).anum), \
(LIST).farg[(LIST).anum] = *(float*)(LIST).aptr = (float)(VAL)) \
: (*(float*)(LIST).aptr = (float)(VAL))), \
(LIST).anum++, \
(LIST).aptr++, \
|
︙ | | | ︙ | |
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
|
#if defined(__sparc64__)
/* Up to 16 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define av_float(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), \
(((float*)(LIST).aptr)[1] = (float)(VAL)), \
(LIST).anum++, \
(LIST).aptr++, \
0))
#define av_double(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), \
*(double*)(LIST).aptr = (double)(VAL), \
(LIST).anum++, \
(LIST).aptr++, \
0))
#endif
#if defined(__alpha__)
#define av_double(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), 0))
#define av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 \
: (((LIST).aptr > &(LIST).args[6] \
? /* These args will be fetched from memory using "lds" instructions */ \
/* therefore store them as floats */ \
(*(float*)((LIST).aptr-1) = (float)(VAL)) \
: /* The first 6 args will be put into registers by "ldt" instructions */ \
/* (see avcall-alpha.c!). Therefore store them as doubles. */ \
/* When viewed as floats, the value will be the correct one. */\
(*(double*)((LIST).aptr-1) = (double)(float)(VAL)) \
), 0))
#endif
#if defined(__hppa__)
#define av_float(LIST,VAL) \
(--(LIST).aptr < __av_eptr(LIST) \
? -1 : (*(float*)(LIST).aptr = (float)(VAL), 0))
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((long)(LIST).aptr-sizeof(double)) & -(long)sizeof(double))) \
< __av_eptr(LIST) \
? -1 : (*(double*)(LIST).aptr = (double)(VAL), 0))
#endif
#if defined(__powerpc__) && !defined(__powerpc64__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))
/* Up to 13 float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), \
(LIST).faptr < &(LIST).fargs[13] && \
(*(LIST).faptr++ = (double)(float)(VAL)), \
0))
#define av_double(LIST,VAL) \
(((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
(LIST).faptr < &(LIST).fargs[13] && \
(*(LIST).faptr++ = (LIST).tmp._double), \
0))
#endif
#if defined(__powerpc__) && !defined(__powerpc64__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))
/* Up to 8 float or double non-varargs args can be passed in
* float registers, without occupying space in the general registers.
*/
#define av_float(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[8] \
? ((*(LIST).faptr++ = (double)(float)(VAL)), 0) \
: (++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0)))
#define av_double(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[8] \
? ((*(LIST).faptr++ = (double)(VAL)), 0) \
: (((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0)))
#endif
#if defined(__powerpc64__)
/* Up to 13 float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), \
(LIST).faptr < &(LIST).fargs[13] && \
(*(LIST).faptr++ = (double)(float)(VAL)), \
0))
#define av_double(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), \
(LIST).faptr < &(LIST).fargs[13] && \
(*(LIST).faptr++ = (double)(VAL)), \
0))
#endif
#if defined(__s390__)
/* Up to 2 float or double non-varargs args can be passed in
* float registers, without occupying space in the general registers.
*/
#define av_float(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[2] \
? (LIST).daptr++, *(LIST).fargsusedptr++ = 1, *(LIST).dargsusedptr++ = 0, ((*(LIST).faptr++ = (float)(VAL)), 0) \
: (++(LIST).aptr > __av_eptr(LIST) \
? -1 : ((LIST).fargwords++, ((float*)(LIST).aptr)[-1] = (float)(VAL), 0)))
#define av_double(LIST,VAL) \
((LIST).daptr < &(LIST).dargs[2] \
? (LIST).faptr++, *(LIST).dargsusedptr++ = 1, *(LIST).fargsusedptr++ = 0, ((*(LIST).daptr++ = (double)(VAL)), 0) \
: (((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).fargwords+=2, (LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0)))
#endif
#if defined(__m88k__)
#define av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0))
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((long)(LIST).aptr+sizeof(double)+sizeof(double)-1) & -(long)sizeof(double))) \
> __av_eptr(LIST) \
? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), 0))
#endif
#if defined(__ia64__)
/* Up to 8 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define av_float(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : ((*(float*)(LIST).aptr = (float)(VAL)), \
((LIST).faptr < &(LIST).fargs[8] && (*(LIST).faptr = *(float*)(LIST).aptr, (LIST).faptr++)), \
(LIST).aptr++, \
0))
#define av_double(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (*(double*)(LIST).aptr = (double)(VAL), \
((LIST).faptr < &(LIST).fargs[8] && (*(LIST).faptr = *(double*)(LIST).aptr, (LIST).faptr++)), \
(LIST).aptr++, \
0))
#endif
#if defined(__x86_64__)
/* Up to 8 leading float or double args can be passed in float registers.
*/
#define av_float(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[8] \
? (*(LIST).faptr = 0.0, *(float*)(LIST).faptr = (float)(VAL), \
(LIST).faptr++, \
0) \
: ((LIST).aptr >= __av_eptr(LIST) \
? -1 : ((*(float*)(LIST).aptr = (float)(VAL)), \
(LIST).aptr++, \
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
|
#if defined(__sparc64__)
/* Up to 16 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define __av_float(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (((LIST).anum < 16 && ((LIST).farg_mask |= (1 << (LIST).anum))), \
(*(float*)(LIST).aptr = (float)(VAL)), \
(LIST).anum++, \
(LIST).aptr++, \
0))
#define av_double(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), \
*(double*)(LIST).aptr = (double)(VAL), \
(LIST).anum++, \
(LIST).aptr++, \
0))
#endif
#if defined(__alpha__)
#define av_double(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), 0))
#define __av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 \
: (((LIST).aptr > &(LIST).args[6] \
? /* These args will be fetched from memory using "lds" instructions */ \
/* therefore store them as floats */ \
(*(float*)((LIST).aptr-1) = (float)(VAL)) \
: /* The first 6 args will be put into registers by "ldt" instructions */ \
/* (see avcall-alpha.c!). Therefore store them as doubles. */ \
/* When viewed as floats, the value will be the correct one. */\
(*(double*)((LIST).aptr-1) = (double)(float)(VAL)) \
), 0))
#endif
#if defined(__hppa__)
#define __av_float(LIST,VAL) \
(--(LIST).aptr < __av_eptr(LIST) \
? -1 : (*(float*)(LIST).aptr = (float)(VAL), 0))
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((long)(LIST).aptr-sizeof(double)) & -(long)sizeof(double))) \
< __av_eptr(LIST) \
? -1 : (*(double*)(LIST).aptr = (double)(VAL), 0))
#endif
#if defined(__rs6000__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))
/* Up to 13 float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define __av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), \
(LIST).faptr < &(LIST).fargs[13] && \
(*(LIST).faptr++ = (double)(float)(VAL)), \
0))
#define av_double(LIST,VAL) \
(((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
(LIST).faptr < &(LIST).fargs[13] && \
(*(LIST).faptr++ = (LIST).tmp._double), \
0))
#endif
#if defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))
/* Up to 8 float or double non-varargs args can be passed in
* float registers, without occupying space in the general registers.
*/
#define __av_float(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[8] \
? ((*(LIST).faptr++ = (double)(float)(VAL)), 0) \
: (++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0)))
#define av_double(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[8] \
? ((*(LIST).faptr++ = (double)(VAL)), 0) \
: (((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0)))
#endif
#if defined(__s390__)
/* Up to 2 float or double non-varargs args can be passed in
* float registers, without occupying space in the general registers.
*/
#define __av_float(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[2] \
? (LIST).daptr++, *(LIST).fargsusedptr++ = 1, *(LIST).dargsusedptr++ = 0, ((*(LIST).faptr++ = (float)(VAL)), 0) \
: (++(LIST).aptr > __av_eptr(LIST) \
? -1 : ((LIST).fargwords++, ((float*)(LIST).aptr)[-1] = (float)(VAL), 0)))
#define av_double(LIST,VAL) \
((LIST).daptr < &(LIST).dargs[2] \
? (LIST).faptr++, *(LIST).dargsusedptr++ = 1, *(LIST).fargsusedptr++ = 0, ((*(LIST).daptr++ = (double)(VAL)), 0) \
: (((LIST).aptr += 2) > __av_eptr(LIST) \
? -1 : \
((LIST).fargwords+=2, (LIST).tmp._double = (double)(VAL), \
(LIST).aptr[-2] = (LIST).tmp.words[0], \
(LIST).aptr[-1] = (LIST).tmp.words[1], \
0)))
#endif
#if defined(__m88k__)
#define __av_float(LIST,VAL) \
(++(LIST).aptr > __av_eptr(LIST) \
? -1 : (((float*)(LIST).aptr)[-1] = (float)(VAL), 0))
#define av_double(LIST,VAL) \
(((LIST).aptr = (__avword*)(((long)(LIST).aptr+sizeof(double)+sizeof(double)-1) & -(long)sizeof(double))) \
> __av_eptr(LIST) \
? -1 : (((double*)(LIST).aptr)[-1] = (double)(VAL), 0))
#endif
#if defined(__ia64__)
/* Up to 8 leading float or double non-varargs args can be passed in
* float registers, but we also push them into the corresponding int
* registers in case of varargs.
*/
#define __av_float(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : ((*(float*)(LIST).aptr = (float)(VAL)), \
((LIST).faptr < &(LIST).fargs[8] && (*(LIST).faptr = *(float*)(LIST).aptr, (LIST).faptr++)), \
(LIST).aptr++, \
0))
#define av_double(LIST,VAL) \
((LIST).aptr >= __av_eptr(LIST) \
? -1 : (*(double*)(LIST).aptr = (double)(VAL), \
((LIST).faptr < &(LIST).fargs[8] && (*(LIST).faptr = *(double*)(LIST).aptr, (LIST).faptr++)), \
(LIST).aptr++, \
0))
#endif
#if defined(__x86_64__)
/* Up to 8 leading float or double args can be passed in float registers.
*/
#define __av_float(LIST,VAL) \
((LIST).faptr < &(LIST).fargs[8] \
? (*(LIST).faptr = 0.0, *(float*)(LIST).faptr = (float)(VAL), \
(LIST).faptr++, \
0) \
: ((LIST).aptr >= __av_eptr(LIST) \
? -1 : ((*(float*)(LIST).aptr = (float)(VAL)), \
(LIST).aptr++, \
|
︙ | | | ︙ | |
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
|
*/
#define __av_struct_alignment(TYPE_ALIGN) \
((TYPE_ALIGN) <= 4 ? (TYPE_ALIGN) : 4)
#else
#define __av_struct_alignment(TYPE_ALIGN) \
(TYPE_ALIGN)
#endif
#if defined(__i386__) || defined(__mips__) || defined(__ARMEL__) || defined(__mipsn32__) || defined(__mips64__) || defined(__alpha__) || (defined(__powerpc__) && !defined(__powerpc64__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__powerpc64__) || defined(__m88k__) || defined(__ia64__) || defined(__s390__)
/* Structures are passed as fully aligned structures on the arg stack.
* We align the aptr, store the structure, then fill to word alignment.
* Single-small-integer structures are NOT promoted to integers and have
* different alignment.
*/
/* little endian -> small structures < 1 word are adjusted to the left */
#if defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__ARMEL__) || (defined(__ia64__) && defined(__GNUC__) && (__GNUC__ >= 3))
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
0))
#endif
#if defined(__ia64__) && (!defined(__GNUC__) || (__GNUC__ < 3))
/* Types larger than a word have 2-word alignment. */
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN)), \
((TYPE_SIZE) > sizeof(__avword) && (((LIST).aptr - &(LIST).args[0]) & 1) ? ++(LIST).aptr : 0), \
((LIST).aptr > __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
0)))
#endif
/* small structures < 1 word are adjusted depending on compiler */
#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)
#define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (++(LIST).anum, \
ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
|
|
|
|
|
|
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
|
*/
#define __av_struct_alignment(TYPE_ALIGN) \
((TYPE_ALIGN) <= 4 ? (TYPE_ALIGN) : 4)
#else
#define __av_struct_alignment(TYPE_ALIGN) \
(TYPE_ALIGN)
#endif
#if defined(__i386__) || defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__alpha__) || (defined(__rs6000__) && (defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)))) || defined(__m88k__) || defined(__ia64__) || defined(__s390__)
/* Structures are passed as fully aligned structures on the arg stack.
* We align the aptr, store the structure, then fill to word alignment.
* Single-small-integer structures are NOT promoted to integers and have
* different alignment.
*/
/* little endian -> small structures < 1 word are adjusted to the left */
#if defined(__i386__) || defined(__alpha__) || defined(__x86_64__)
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
0))
#endif
#if defined(__ia64__)
/* Types larger than a word have 2-word alignment. */
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
((LIST).aptr = (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(long)__av_struct_alignment(TYPE_ALIGN)), \
((TYPE_SIZE) > sizeof(__avword) && (((LIST).aptr - &(LIST).args[0]) & 1) ? ++(LIST).aptr : 0), \
((LIST).aptr > __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
0)))
#endif
/* small structures < 1 word are adjusted depending on compiler */
#if defined(__mips__) && !defined(__mipsn32__)
#define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (++(LIST).anum, \
ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
|
︙ | | | ︙ | |
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
|
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
((LIST).flags & __AV_SGICC_STRUCT_ARGS \
? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */\
__av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
: /* SGI MIPS gcc passes small structures right-adjusted. */ \
__av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL))
#endif
#if defined(__powerpc__) || defined(__powerpc64__)
#define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)\
(((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
0))
#define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)\
(((LIST).aptr = \
(__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))\
+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
0))
#if !defined(__powerpc64__)
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
((LIST).flags & __AV_AIXCC_STRUCT_ARGS \
? /* AIX cc and xlc pass small structures left-adjusted, although big-endian! */\
__av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
: /* gcc passes small structures right-adjusted. */ \
__av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL))
#endif
#if defined(__powerpc64__)
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
__av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)
#endif
#endif
#if defined(__s390__)
#define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)\
(((LIST).aptr = \
(__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))\
+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
|
|
<
<
<
<
<
<
|
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
|
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
((LIST).flags & __AV_SGICC_STRUCT_ARGS \
? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */\
__av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
: /* SGI MIPS gcc passes small structures right-adjusted. */ \
__av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL))
#endif
#if defined(__rs6000__)
#define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)\
(((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
0))
#define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)\
(((LIST).aptr = \
(__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))\
+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
0))
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
((LIST).flags & __AV_AIXCC_STRUCT_ARGS \
? /* AIX cc and xlc pass small structures left-adjusted, although big-endian! */\
__av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
: /* gcc passes small structures right-adjusted. */ \
__av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL))
#endif
#if defined(__s390__)
#define __av_struct_rightadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL)\
(((LIST).aptr = \
(__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))\
+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
|
︙ | | | ︙ | |
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
|
(__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))\
+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
0))
#endif
#endif
#if defined(__m68k__) || (defined(__arm__) && !defined(__ARMEL__)) || defined(__convex__)
/* Structures are passed as embedded copies on the arg stack.
*/
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(((LIST).aptr = (__avword*)(((long)(LIST).aptr+(TYPE_SIZE)+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
0))
#endif
#if (defined(__sparc__) && !defined(__sparc64__)) || (defined(__powerpc__) && !defined(__powerpc64__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))))
/* Structures are passed as pointers to caller-made local copies. We
* grab space for the copies from the end of the argument list space
* and always use maximal (double) alignment.
*/
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(++(LIST).aptr \
> ((LIST).eptr = (__avword*)((long)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\
|
|
|
|
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
|
(__avword*)(((((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN))\
+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
0))
#endif
#endif
#if defined(__m68k__) || defined(__arm__) || defined(__convex__)
/* Structures are passed as embedded copies on the arg stack.
*/
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(((LIST).aptr = (__avword*)(((long)(LIST).aptr+(TYPE_SIZE)+sizeof(__avword)-1) & -(long)sizeof(__avword))) \
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
0))
#endif
#if (defined(__sparc__) && !defined(__sparc64__)) || (defined(__rs6000__) && !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))))
/* Structures are passed as pointers to caller-made local copies. We
* grab space for the copies from the end of the argument list space
* and always use maximal (double) alignment.
*/
#define __av_struct(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) \
(++(LIST).aptr \
> ((LIST).eptr = (__avword*)((long)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\
|
︙ | | | ︙ | |
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
|
0)) \
: (((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
((LIST).anum < 16 \
&& ((LIST).darg_mask |= (-1 << (LIST).anum))), \
(LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(long)sizeof(__avword))/sizeof(__avword),\
(LIST).darg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, \
0)))
#endif
#if defined(__hppa__)
/* Structures <= 8 bytes are passed as embedded copies on the arg stack.
* Big structures are passed as pointers to caller-made local copies.
*/
|
>
|
>
|
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
|
0)) \
: (((LIST).aptr = \
(__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)))\
> __av_eptr(LIST) \
? -1 : (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\
(LIST).aptr = (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & -(long)sizeof(__avword)),\
((LIST).anum < 16 \
&& ((LIST).farg_mask |= (-1 << (LIST).anum), \
(LIST).darg_mask |= (-1 << (LIST).anum))), \
(LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(long)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(long)sizeof(__avword))/sizeof(__avword),\
(LIST).farg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, \
(LIST).darg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, \
0)))
#endif
#if defined(__hppa__)
/* Structures <= 8 bytes are passed as embedded copies on the arg stack.
* Big structures are passed as pointers to caller-made local copies.
*/
|
︙ | | | ︙ | |
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
|
#define __av_offset4(slot1,slot2,slot3,slot4) \
((__av_offset3(slot1,slot2,slot3)+sizeof(slot3)+__AV_alignof(slot4)-1) & -(long)__AV_alignof(slot4))
/*
* Miscellaneous declarations.
*/
extern int __builtin_avcall (av_alist* l);
extern void __structcpy (void* dest, const void* src, unsigned long size, unsigned long alignment);
#endif /*_avcall_h */
|
>
>
>
>
|
>
|
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
|
#define __av_offset4(slot1,slot2,slot3,slot4) \
((__av_offset3(slot1,slot2,slot3)+sizeof(slot3)+__AV_alignof(slot4)-1) & -(long)__AV_alignof(slot4))
/*
* Miscellaneous declarations.
*/
#if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus)
extern int __builtin_avcall (av_alist* l);
extern void __structcpy (void* dest, void* src, unsigned long size, unsigned long alignment);
#else
extern int __builtin_avcall ();
extern void __structcpy ();
#endif
#endif /*_avcall_h */
|