1 /* $NetBSD: varargs.h,v 1.7 2002/06/01 09:22:44 tsubai Exp $ */
4 * Copyright (c) 2000 Tsubai Masanari. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #ifndef _POWERPC_VARARGS_H_
30 #define _POWERPC_VARARGS_H_
32 #include <machine/stdarg.h>
34 #define va_alist __builtin_va_alist
35 #define va_dcl int va_alist; ...
40 #define va_start(ap) ((ap) = *(va_list *)0)
41 #elif __GNUC_PREREQ__(3, 0)
42 #define va_start(ap) __builtin_varargs_start((ap).__va)
43 #elif __GNUC_PREREQ__(2, 95)
44 #define va_start(ap) ((ap) = *(va_list *)__builtin_saveregs())
46 #define va_alist __va_1st_arg
48 #define va_start(ap) \
49 ((ap).__stack = __va_stack_args, \
50 (ap).__base = __va_reg_args, \
51 (ap).__gpr = __va_first_gpr, \
52 (ap).__fpr = __va_first_fpr)
55 #endif /* _POWERPC_VARARGS_H_ */