diff options
Diffstat (limited to 'sys/arch/powerpc/include/va-ppc.h')
-rw-r--r-- | sys/arch/powerpc/include/va-ppc.h | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/sys/arch/powerpc/include/va-ppc.h b/sys/arch/powerpc/include/va-ppc.h index a86ba278e20..4bf23184a6c 100644 --- a/sys/arch/powerpc/include/va-ppc.h +++ b/sys/arch/powerpc/include/va-ppc.h @@ -1,5 +1,6 @@ -/* GNU C varargs support for the PowerPC with V.4 calling */ +/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */ +#ifndef _WIN32 /* System V.4 support */ /* Define __gnuc_va_list. */ @@ -15,7 +16,7 @@ /* Note that the names in this structure are in the user's namespace, but that the V.4 abi explicitly states that these names should be used. */ -typedef struct __gnuc_va_list__ { +typedef struct __va_list_tag { char gpr; /* index into the array of 8 GPRs stored in the register save area gpr=0 corresponds to r3, gpr=1 to r4, etc. */ @@ -76,8 +77,8 @@ typedef struct { #define __va_start_common(AP, FAKE) \ __extension__ ({ \ register int __words = __va_words - FAKE; \ - (AP) = (struct __gnuc_va_list__ *)__builtin_alloca(sizeof(struct __gnuc_va_list__)); \ \ + (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(struct __va_list_tag)); \ (AP)->gpr = (__words < 8) ? __words : 8; \ (AP)->fpr = __va_fregno - 33; \ (AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \ @@ -175,3 +176,59 @@ __extension__ (*({ \ #endif /* __VA_PPC_H__ */ #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ + + +#else +/* Windows NT */ +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef char *__gnuc_va_list; +#endif /* not __GNUC_VA_LIST */ + +/* If this is for internal libc use, don't define anything but + __gnuc_va_list. */ +#if defined (_STDARG_H) || defined (_VARARGS_H) + +#define __va_start_common(AP, LASTARG, FAKE) \ + ((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0) + +#ifdef _STDARG_H /* stdarg.h support */ + +/* Calling __builtin_next_arg gives the proper error message if LASTARG is + not indeed the last argument. */ +#define va_start(AP,LASTARG) \ + (__builtin_saveregs (), \ + (AP) = __builtin_next_arg (LASTARG), \ + 0) + +#else /* varargs.h support */ + +#define va_start(AP) \ + (__builtin_saveregs (), \ + (AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \ + 0) + +#define va_alist __va_1st_arg +#define va_dcl register int __va_1st_arg; ... + +#endif /* _STDARG_H */ + +#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3) +#define __va_align(AP, TYPE) \ + ((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \ + & ~((sizeof (TYPE) >= 8) ? 7 : 3)) + +#define va_arg(AP,TYPE) \ +( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \ + + __va_rounded_size(TYPE))) \ + - __va_rounded_size(TYPE))) + +#define va_end(AP) ((void)0) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ +#endif /* Windows NT */ |