Changeset 46579c66 in mainline


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.

Files:
5 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
  • arch/mips32/include/context.h

    r41fa6f2 r46579c66  
    3333
    3434/*
    35  * Put one item onto the stack to support get_stack_base().
     35 * Put one item onto the stack to support get_stack_base() and align it up to 8 bytes boundary.
    3636 */
    37 #define SP_DELTA        (0+STACK_ITEM_SIZE)
     37#define SP_DELTA        ((0 + STACK_ITEM_SIZE + 7) & (~7))
    3838
    3939
  • arch/mips32/include/context_offset.h

    r41fa6f2 r46579c66  
    4949#define EOFFSET_STATUS 0x7c
    5050#define EOFFSET_EPC    0x80
    51 #define REGISTER_SPACE 132
     51#define REGISTER_SPACE 136
  • arch/mips32/include/exception.h

    r41fa6f2 r46579c66  
    9191        __u32 status; /* cp0_status */
    9292        __u32 epc; /* cp0_epc */
     93        __u32 padding; /* padding to align stack on 8 bytes boundary */
    9394};
    9495
  • test/print/print1/test.c

    r41fa6f2 r46579c66  
    3131void test(void)
    3232{
    33         __u64 u64const = 0x0123456789ABCDEFLL;
    3433        printf(" Printf test \n");
    35         printf(" Q  %Q  %q \n",u64const, u64const);
     34        printf(" Q  %Q  %q \n",0x1111111111111111ull, 0x2222222222222222ull);
     35        printf(" Q,l  %Q  %l \n", 0x3333333333333333ull, 0x01234567);
     36        printf(" l,Q  %l  %Q \n", 0x01234567, 0x4444444444444444ull);
    3637        printf(" L  %L  %l \n",0x01234567 ,0x01234567);   
    3738        printf(" W  %W  %w \n",0x0123 ,0x0123);   
Note: See TracChangeset for help on using the changeset viewer.