Rev 534 | Rev 1595 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 534 | Rev 1054 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | #ifndef __mips32_ARG_H__ |
29 | #ifndef __mips32_ARG_H__ |
30 | #define __mips32_ARG_H__ |
30 | #define __mips32_ARG_H__ |
31 | 31 | ||
32 | #include <arch/types.h> |
32 | #include <arch/types.h> |
33 | 33 | ||
34 | typedef struct va_list { |
- | |
35 | int pos; |
- | |
36 | __u8 *last; |
- | |
37 | } va_list; |
- | |
38 | - | ||
39 | #define va_start(ap, lst) \ |
- | |
40 | (ap).pos = sizeof(lst); \ |
- | |
41 | (ap).last = (__u8 *) &(lst) |
- | |
42 | - | ||
43 | /** |
34 | /** |
44 | * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not) |
35 | * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not) |
45 | * To satisfy this, paddings must be sometimes inserted. |
36 | * To satisfy this, paddings must be sometimes inserted. |
46 | */ |
37 | */ |
47 | #define va_arg(ap, type) \ |
- | |
48 | (*((type *)((ap).last + ((ap).pos += sizeof(type) + ((sizeof(type)==8)&&(((ap).pos)&(4))?4:0)) - sizeof(type)))) |
- | |
49 | 38 | ||
50 | #define va_end(ap) |
39 | typedef __address va_list; |
51 | 40 | ||
- | 41 | #define va_start(ap, lst) \ |
|
- | 42 | ((ap) = (va_list)&(lst) + sizeof(lst)) |
|
52 | 43 | ||
- | 44 | #define va_arg(ap, type) \ |
|
- | 45 | (((type *)((ap) = (va_list)( (sizeof(type) <= 4) ? ((__address)((ap) + 2*4 - 1) & (~3)) : ((__address)((ap) + 2*8 -1) & (~7)) )))[-1]) |
|
- | 46 | ||
- | 47 | #define va_end(ap) |
|
53 | 48 | ||
54 | #endif |
49 | #endif |