XenevaOS
Loading...
Searching...
No Matches
stdarg.h
Go to the documentation of this file.
1
30#ifndef __STDARG_H__
31#define __STDARG_H__
32
33
34#ifdef __cplusplus
35extern "C"
36{
37#endif
38
39
40 /* va list parameter list */
41 typedef unsigned char *va_list;
42
43
44 /* width of stack == width of int */
45#define STACKITEM int64_t
46
47 /* round up width of objects pushed on stack. The expression before the
48 & ensures that we get 0 for objects of size 0. */
49#define VA_SIZE(TYPE) \
50 ((sizeof(TYPE)+sizeof(STACKITEM)-1) \
51 & ~(sizeof(STACKITEM)-1))
52
53#ifdef ARCH_X64
54 /* &(LASTARG) points to the LEFTMOST argument of the function call
55 (before the ...) */
56#define va_start(AP, LASTARG) \
57 (AP = ((va_list)&(LASTARG)+VA_SIZE(LASTARG)))
58
59 /* nothing for va_end */
60#define va_end(AP)
61
62#define va_arg(AP, TYPE) \
63 (AP += VA_SIZE(TYPE), *((TYPE *)(AP - VA_SIZE(TYPE))))
64#elif ARCH_ARM64
65#define va_start(ap,last) \
66 ((ap) = (va_list)(&(last)) + 8)
67
68#define va_arg(ap,T) \
69 (*(T*)((ap) += 8, (ap) - 8))
70
71#define va_end(ap) \
72 ((ap) = (va_list)0)
73#endif
74
75#ifdef __cplusplus
76}
77#endif
78
79
80#endif
unsigned char * va_list
Definition stdarg.h:41