Changeset 3fc03fd in mainline


Ignore:
Timestamp:
2005-12-14T20:34:15Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dc747e3
Parents:
d91e54b
Message:

Better gcc CALLER implementation

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/include/debug.h

    rd91e54b r3fc03fd  
    3232#include <arch/asm.h>
    3333
    34 /** Return caller of this function
    35  *
    36  * @param first_arg First argument of the function
    37  */
    38 #define CALLER(first_arg)        ((__address *) &first_arg)[-1];
    39 
    4034#define HERE get_ip()
    4135
  • arch/mips32/include/debug.h

    rd91e54b r3fc03fd  
    4343#define ___intmode()    asm volatile ( "\t.word\t0x29\n");
    4444
    45 /** Return current IP address */
    46 static inline __address * _get_ra()
    47 {
    48         __address *ip;
    49 
    50         __asm__ volatile (
    51                 "mov %%31, %0"
    52                 : "=r" (ip)
    53                 );
    54         return ip;
    55 }
    56 #define CALLER(first_arg)    (_get_ra())
    57 
    5845
    5946#endif
  • generic/include/debug.h

    rd91e54b r3fc03fd  
    3434#include <arch.h>
    3535
    36 #ifndef CALLER
    37 /**  Default (returns 0) macro for getting address of calling function
    38  *   @param x First argument of the called function
    39  */
    40 #  define CALLER(x)       ((__address *) 0)
    41 #endif
     36#define CALLER       ((__address *)__builtin_return_address(0))
    4237
    4338#ifndef HERE
  • generic/src/synch/spinlock.c

    rd91e54b r3fc03fd  
    6464{
    6565        count_t i = 0;
    66         __address caller = CALLER(sl);
    6766        char *symbol;
    6867        bool deadlock_reported = false;
     
    7271                if (i++ > 300000) {
    7372                        printf("cpu%d: looping on spinlock %p:%s, caller=%p",
    74                                CPU->id, sl, sl->name, caller);
    75                         symbol = get_symtab_entry(caller);
     73                               CPU->id, sl, sl->name, CALLER);
     74                        symbol = get_symtab_entry(CALLER);
    7675                        if (symbol)
    7776                                printf("(%s)", symbol);
Note: See TracChangeset for help on using the changeset viewer.