Changeset 46579c66 in mainline for arch/mips32/include/arg.h


Ignore:
Timestamp:
2006-03-16T17:17:41Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
79aeb43b
Parents:
41fa6f2
Message:

Updated stackarg macros for mips32.
Mips32 stack aligned on 8 bytes boundary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/mips32/include/arg.h

    r41fa6f2 r46579c66  
    3232#include <arch/types.h>
    3333
    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 
    4334/**
    4435 * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not)
    4536 * To satisfy this, paddings must be sometimes inserted.
    4637 */
    47 #define va_arg(ap, type)                \
    48         (*((type *)((ap).last + ((ap).pos  += sizeof(type) + ((sizeof(type)==8)&&(((ap).pos)&(4))?4:0)) - sizeof(type))))
     38
     39typedef __address va_list;
     40
     41#define va_start(ap, lst) \
     42        ((ap) = (va_list)&(lst) + sizeof(lst))
     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])
    4946
    5047#define va_end(ap)
    5148
    52 
    53 
    5449#endif
Note: See TracChangeset for help on using the changeset viewer.