diff options
author | Dave Brolley <brolley@redhat.com> | 2009-12-01 15:14:02 -0500 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-12-01 15:14:02 -0500 |
commit | b25765bd1c90bbbca20c36a25c51fff5e7db0884 (patch) | |
tree | d5a3384b89a055360e8f8ebc479727bef36cf34f /runtime | |
parent | 8c859ce37271f35d0b93cd40f121af7b04621238 (diff) | |
parent | 89a75eb6a5a6dc345a718ffbd119651222686026 (diff) | |
download | systemtap-steved-b25765bd1c90bbbca20c36a25c51fff5e7db0884.tar.gz systemtap-steved-b25765bd1c90bbbca20c36a25c51fff5e7db0884.tar.xz systemtap-steved-b25765bd1c90bbbca20c36a25c51fff5e7db0884.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/arith.c | 42 | ||||
-rw-r--r-- | runtime/copy.c | 2 | ||||
-rw-r--r-- | runtime/regs.h | 2 | ||||
-rw-r--r-- | runtime/stack-ppc.c (renamed from runtime/stack-ppc64.c) | 4 | ||||
-rw-r--r-- | runtime/stack.c | 4 | ||||
-rw-r--r-- | runtime/staprun/staprun.c | 2 | ||||
-rw-r--r-- | runtime/stat-common.c | 8 | ||||
-rw-r--r-- | runtime/string.h | 6 | ||||
-rw-r--r-- | runtime/time.c | 3 | ||||
-rw-r--r-- | runtime/uprobes/uprobes_arch.c | 4 | ||||
-rw-r--r-- | runtime/uprobes/uprobes_arch.h | 4 | ||||
-rw-r--r-- | runtime/uprobes/uprobes_ppc.c (renamed from runtime/uprobes/uprobes_ppc64.c) | 4 | ||||
-rw-r--r-- | runtime/uprobes/uprobes_ppc.h (renamed from runtime/uprobes/uprobes_ppc64.h) | 0 | ||||
-rw-r--r-- | runtime/uprobes2/uprobes_arch.c | 4 | ||||
-rw-r--r-- | runtime/uprobes2/uprobes_arch.h | 4 |
15 files changed, 65 insertions, 28 deletions
diff --git a/runtime/arith.c b/runtime/arith.c index 4c818a76..a032e9c1 100644 --- a/runtime/arith.c +++ b/runtime/arith.c @@ -20,7 +20,8 @@ /* 64-bit division for 64-bit cpus and i386 */ /* Other 32-bit cpus will need to modify this file. */ -#if defined (__i386__) || defined(__arm__) +#if defined (__i386__) || defined(__arm__) || \ + (defined(__powerpc__) && !defined(__powerpc64__)) static long long _div64 (long long u, long long v); static long long _mod64 (long long u, long long v); #endif @@ -114,7 +115,8 @@ static int _stp_random_pm (unsigned n) -#if defined (__i386__) || defined (__arm__) +#if defined (__i386__) || defined (__arm__) || \ + (defined(__powerpc__) && !defined(__powerpc64__)) /* 64-bit division functions extracted from libgcc */ typedef long long DWtype; @@ -181,6 +183,40 @@ typedef union (count) = __cbtmp ^ 31; \ } while (0) +#elif defined (__powerpc__) +/* these are the ppc versions of these macros from gcc/longlong.h */ + +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + do { \ + if (__builtin_constant_p (ah) && (ah) == 0) \ + __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ + __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == 0) \ + __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ + __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ + else \ + __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ + : "=r" (sh), "=&r" (sl) \ + : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ + } while (0) + +#define count_leading_zeros(count, x) \ + __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x)) +#define COUNT_LEADING_ZEROS_0 32 + +#define umul_ppmm(ph, pl, m0, m1) \ + do { \ + USItype __m0 = (m0), __m1 = (m1); \ + __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ + (pl) = __m0 * __m1; \ + } while (0) + #elif defined (__arm__) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ @@ -548,6 +584,6 @@ static long long _mod64 (long long u, long long v) return w; } -#endif /* __i386__ || __arm__ */ +#endif /* __i386__ || __arm__ || (__powerpc__ && !__powerpc64__) */ #endif /* _ARITH_C_ */ diff --git a/runtime/copy.c b/runtime/copy.c index 4fb87253..40f15117 100644 --- a/runtime/copy.c +++ b/runtime/copy.c @@ -105,7 +105,7 @@ do { \ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ : "memory"); \ } while (0) -#elif defined (__powerpc64__) || defined (__ia64__) || defined (__arm__) +#elif defined (__powerpc__) || defined (__ia64__) || defined (__arm__) #define __stp_strncpy_from_user(dst,src,count,res) \ do { res = __strncpy_from_user(dst, src, count); } while(0) diff --git a/runtime/regs.h b/runtime/regs.h index dc6b50af..08449aa6 100644 --- a/runtime/regs.h +++ b/runtime/regs.h @@ -36,7 +36,7 @@ (((regs)->cr_iip = (x) & ~3UL), (ia64_psr(regs)->ri = (x) & 3UL)) -#elif defined (__powerpc64__) +#elif defined (__powerpc__) #define REG_IP(regs) regs->nip #define REG_SP(regs) regs->gpr[1] diff --git a/runtime/stack-ppc64.c b/runtime/stack-ppc.c index 3267194e..df2db15d 100644 --- a/runtime/stack-ppc64.c +++ b/runtime/stack-ppc.c @@ -21,7 +21,7 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels, return; _sp = (unsigned long *) sp; newsp = _sp[0]; - ip = _sp[2]; + ip = _sp[STACK_FRAME_LR_SAVE]; if (!firstframe || ip != lr) { if (verbose) { _stp_printf("[0x%016lx] [0x%016lx] ", sp, ip); @@ -38,7 +38,7 @@ static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels, * See if this is an exception frame. * We look for the "regshere" marker in the current frame. */ - if ( _sp[12] == 0x7265677368657265ul) { + if (_sp[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) { struct pt_regs *regs = (struct pt_regs *) (sp + STACK_FRAME_OVERHEAD); if (verbose) { diff --git a/runtime/stack.c b/runtime/stack.c index 042f44c7..25dbdbbd 100644 --- a/runtime/stack.c +++ b/runtime/stack.c @@ -40,8 +40,8 @@ static void _stp_stack_print_fallback(unsigned long, int, int); #include "stack-ia64.c" #elif defined (__i386__) #include "stack-i386.c" -#elif defined (__powerpc64__) -#include "stack-ppc64.c" +#elif defined (__powerpc__) +#include "stack-ppc.c" #elif defined (__arm__) #include "stack-arm.c" #elif defined (__s390__) || defined (__s390x__) diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index 078be4cf..5bd5163a 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -372,7 +372,7 @@ int send_relocation_kernel () free (line); line=NULL; if (symbol == NULL) continue; /* OOM? */ -#ifdef __powerpc__ +#ifdef __powerpc64__ #define KERNEL_RELOC_SYMBOL ".__start" #else #define KERNEL_RELOC_SYMBOL "_stext" diff --git a/runtime/stat-common.c b/runtime/stat-common.c index 7123dc8e..f9703049 100644 --- a/runtime/stat-common.c +++ b/runtime/stat-common.c @@ -34,7 +34,7 @@ static int _stp_stat_calc_buckets(int stop, int start, int interval) return buckets; } -static int needed_space(int64_t v) +static int needed_space(uint64_t v) { int space = 0; @@ -134,7 +134,7 @@ static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat { int scale, i, j, val_space, cnt_space; int low_bucket = -1, high_bucket = 0, over = 0, under = 0; - int64_t val, v, valmax = 0; + uint64_t val, v, valmax = 0; int eliding = 0; char *cur_buf = buf, *fake = buf; char **bufptr = (buf == NULL ? &fake : &cur_buf); @@ -186,7 +186,7 @@ static void _stp_stat_print_histogram_buf(char *buf, size_t size, Hist st, stat if (valmax <= HIST_WIDTH) scale = 1; else { - int64_t tmp = valmax; + uint64_t tmp = valmax; int rem = do_div(tmp, HIST_WIDTH); scale = tmp; if (rem) scale++; @@ -282,7 +282,7 @@ static void _stp_stat_print_histogram(Hist st, stat *sd) _stp_print_flush(); } -static void __stp_stat_add (Hist st, stat *sd, int64_t val) +static void __stp_stat_add (Hist st, stat *sd, uint64_t val) { int n; if (sd->count == 0) { diff --git a/runtime/string.h b/runtime/string.h index f4d4cc05..b08304e5 100644 --- a/runtime/string.h +++ b/runtime/string.h @@ -19,14 +19,14 @@ static void _stp_text_str(char *out, char *in, int len, int quoted, int user); * is provided without the paranoid check. Use it if available, fall back * to __get_user() if not. Other archs can use __get_user() as is */ -#ifdef __powerpc64__ +#if defined(__powerpc__) #ifdef __get_user_inatomic #define __stp_get_user(x, ptr) __get_user_inatomic(x, ptr) #else /* __get_user_inatomic */ #define __stp_get_user(x, ptr) __get_user(x, ptr) #endif /* __get_user_inatomic */ -#else /* __powerpc64__ */ +#else /* defined(__powerpc__) */ #define __stp_get_user(x, ptr) __get_user(x, ptr) -#endif /* __powerpc64__ */ +#endif /* defined(__powerpc__) */ #endif /* _STRING_H_ */ diff --git a/runtime/time.c b/runtime/time.c index 58c23e57..d588370f 100644 --- a/runtime/time.c +++ b/runtime/time.c @@ -275,7 +275,8 @@ static int64_t _stp_gettimeofday_ns(void) { int64_t base; - cycles_t last, delta; + cycles_t last; + uint64_t delta; unsigned int freq; unsigned int seq; stp_time_t *time; diff --git a/runtime/uprobes/uprobes_arch.c b/runtime/uprobes/uprobes_arch.c index 99ef54c8..6c58d5fb 100644 --- a/runtime/uprobes/uprobes_arch.c +++ b/runtime/uprobes/uprobes_arch.c @@ -2,8 +2,8 @@ #include "uprobes_x86_64.c" #elif defined (__i386__) #include "uprobes_i386.c" -#elif defined (__powerpc64__) -#include "uprobes_ppc64.c" +#elif defined (__powerpc__) +#include "uprobes_ppc.c" #elif defined (__s390__) || defined (__s390x__) #include "uprobes_s390.c" #else diff --git a/runtime/uprobes/uprobes_arch.h b/runtime/uprobes/uprobes_arch.h index 0223e280..f642f528 100644 --- a/runtime/uprobes/uprobes_arch.h +++ b/runtime/uprobes/uprobes_arch.h @@ -2,8 +2,8 @@ #include "uprobes_x86_64.h" #elif defined (__i386__) #include "uprobes_i386.h" -#elif defined (__powerpc64__) -#include "uprobes_ppc64.h" +#elif defined (__powerpc__) +#include "uprobes_ppc.h" #elif defined (__s390__) || defined (__s390x__) #include "uprobes_s390.h" #else diff --git a/runtime/uprobes/uprobes_ppc64.c b/runtime/uprobes/uprobes_ppc.c index 819ac73d..b625b879 100644 --- a/runtime/uprobes/uprobes_ppc64.c +++ b/runtime/uprobes/uprobes_ppc.c @@ -89,9 +89,9 @@ static inline void calc_offset(struct uprobe_probept *ppt, } #ifdef UPROBES_DEBUG printk (KERN_ERR "ppt->vaddr=%p, regs->nip=%p, offset=%ld\n", - ppt->vaddr, regs->nip, offset); + (void*)(long)ppt->vaddr, (void*)(long)regs->nip, (long)offset); if (insn & 1) - printk (KERN_ERR "regs->link=%p \n", regs->link); + printk (KERN_ERR "regs->link=%p \n", (void*)(long)regs->link); #endif return; } diff --git a/runtime/uprobes/uprobes_ppc64.h b/runtime/uprobes/uprobes_ppc.h index 56046351..56046351 100644 --- a/runtime/uprobes/uprobes_ppc64.h +++ b/runtime/uprobes/uprobes_ppc.h diff --git a/runtime/uprobes2/uprobes_arch.c b/runtime/uprobes2/uprobes_arch.c index 3c86804e..a91d5b6a 100644 --- a/runtime/uprobes2/uprobes_arch.c +++ b/runtime/uprobes2/uprobes_arch.c @@ -1,7 +1,7 @@ #if defined (__x86_64__) || defined(__i386) #include "uprobes_x86.c" -#elif defined (__powerpc64__) -#include "../uprobes/uprobes_ppc64.c" +#elif defined (__powerpc__) +#include "../uprobes/uprobes_ppc.c" #elif defined (__s390__) || defined (__s390x__) #include "../uprobes/uprobes_s390.c" #elif defined (__ia64__) diff --git a/runtime/uprobes2/uprobes_arch.h b/runtime/uprobes2/uprobes_arch.h index 87e0cc83..cce57757 100644 --- a/runtime/uprobes2/uprobes_arch.h +++ b/runtime/uprobes2/uprobes_arch.h @@ -1,7 +1,7 @@ #if defined (__x86_64__) || defined(__i386) #include "uprobes_x86.h" -#elif defined (__powerpc64__) -#include "../uprobes/uprobes_ppc64.h" +#elif defined (__powerpc__) +#include "../uprobes/uprobes_ppc.h" #elif defined (__s390__) || defined (__s390x__) #include "../uprobes/uprobes_s390.h" #elif defined (__ia64__) |