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#ifdef __cplusplus
34extern "C" {
35#endif
36
37/* va list parameter list */
38typedef unsigned char* va_list;
39
40/* width of stack == width of int */
41#define STACKITEM int64_t
42
43/* round up width of objects pushed on stack. The expression before the
44 & ensures that we get 0 for objects of size 0. */
45#define VA_SIZE(TYPE) ((sizeof(TYPE) + sizeof(STACKITEM) - 1) & ~(sizeof(STACKITEM) - 1))
46
47#ifdef ARCH_X64
48/* &(LASTARG) points to the LEFTMOST argument of the function call
49 (before the ...) */
50#define va_start(AP, LASTARG) (AP = ((va_list) & (LASTARG) + VA_SIZE(LASTARG)))
51
52/* nothing for va_end */
53#define va_end(AP)
54
55#define va_arg(AP, TYPE) (AP += VA_SIZE(TYPE), *((TYPE*)(AP - VA_SIZE(TYPE))))
56#elif ARCH_ARM64
57#define va_start(ap, last) ((ap) = (va_list)(&(last)) + 8)
58
59#define va_arg(ap, T) (*(T*)((ap) += 8, (ap) - 8))
60
61#define va_end(ap) ((ap) = (va_list)0)
62#endif
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif
unsigned char * va_list
Definition stdarg.h:45