summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-12-02 16:41:11 -0500
committerDave Brolley <brolley@redhat.com>2009-12-02 16:41:11 -0500
commit6bb613f9be856632dec47cab4b27a7fe92c2fe64 (patch)
tree76e778645ea20df5fd89981994ee249fc760d4f5 /runtime
parent5d4ea4cc1d1f7531fb0ff4d0498957e0333a61eb (diff)
parent4a0ae64c47b159d4dd0ea471f1f8044503843a7f (diff)
downloadsystemtap-steved-6bb613f9be856632dec47cab4b27a7fe92c2fe64.tar.gz
systemtap-steved-6bb613f9be856632dec47cab4b27a7fe92c2fe64.tar.xz
systemtap-steved-6bb613f9be856632dec47cab4b27a7fe92c2fe64.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'runtime')
-rw-r--r--runtime/alloc.c17
-rw-r--r--runtime/arith.c42
-rw-r--r--runtime/copy.c2
-rw-r--r--runtime/itrace.c13
-rw-r--r--runtime/regs.h2
-rw-r--r--runtime/stack-ppc.c (renamed from runtime/stack-ppc64.c)4
-rw-r--r--runtime/stack.c4
-rw-r--r--runtime/staprun/modverify.c11
-rw-r--r--runtime/staprun/staprun.c2
-rw-r--r--runtime/staprun/staprun_funcs.c7
-rw-r--r--runtime/stat-common.c8
-rw-r--r--runtime/string.h6
-rw-r--r--runtime/time.c3
-rw-r--r--runtime/uprobes/uprobes_arch.c4
-rw-r--r--runtime/uprobes/uprobes_arch.h4
-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.c4
-rw-r--r--runtime/uprobes2/uprobes_arch.h4
19 files changed, 101 insertions, 40 deletions
diff --git a/runtime/alloc.c b/runtime/alloc.c
index 439e8a7e..403d20ee 100644
--- a/runtime/alloc.c
+++ b/runtime/alloc.c
@@ -11,6 +11,8 @@
#ifndef _ALLOC_C_
#define _ALLOC_C_
+#include <linux/percpu.h>
+
static int _stp_allocated_net_memory = 0;
#define STP_ALLOC_FLAGS (GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN)
@@ -233,12 +235,23 @@ static void *_stp_vmalloc(unsigned long size)
}
+#ifdef PCPU_MIN_UNIT_SIZE
+#define _STP_MAX_PERCPU_SIZE PCPU_MIN_UNIT_SIZE
+#else
+#define _STP_MAX_PERCPU_SIZE 131072
+#endif
+
static void *_stp_alloc_percpu(size_t size)
{
+ void *ret;
+
+ if (size > _STP_MAX_PERCPU_SIZE)
+ return NULL;
+
#ifdef STAPCONF_ALLOC_PERCPU_ALIGN
- void *ret = __alloc_percpu(size, 8);
+ ret = __alloc_percpu(size, 8);
#else
- void *ret = __alloc_percpu(size);
+ ret = __alloc_percpu(size);
#endif
#ifdef DEBUG_MEM
if (likely(ret)) {
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/itrace.c b/runtime/itrace.c
index 03e1e403..f2ed86f2 100644
--- a/runtime/itrace.c
+++ b/runtime/itrace.c
@@ -131,9 +131,16 @@ static u32 usr_itrace_report_signal(u32 action,
ui = rcu_dereference(engine->data);
WARN_ON(!ui);
-
- if (info->si_signo != SIGTRAP || !ui)
- return UTRACE_RESUME;
+
+#if defined(UTRACE_ORIG_VERSION)
+ if (info->si_signo != SIGTRAP || !ui)
+ return UTRACE_RESUME;
+#else
+ if (utrace_signal_action(action) == UTRACE_SIGNAL_HANDLER ||
+ utrace_signal_action(action) == UTRACE_SIGNAL_REPORT ||
+ info->si_signo != SIGTRAP || !ui)
+ return UTRACE_RESUME | utrace_signal_action(action);
+#endif
#if defined(UTRACE_ORIG_VERSION) && defined(CONFIG_PPC)
/* Because of a ppc utrace bug, we need to stop the task here.
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/modverify.c b/runtime/staprun/modverify.c
index 514f09f0..4ed5eb74 100644
--- a/runtime/staprun/modverify.c
+++ b/runtime/staprun/modverify.c
@@ -19,6 +19,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+#include "staprun.h"
+
#include <stdio.h>
#include <nspr.h>
@@ -28,13 +31,13 @@
#include <cert.h>
#include <certt.h>
-#include "nsscommon.h"
-#include "staprun.h"
-#include "modverify.h"
-
#include <sys/stat.h>
+#include <sys/types.h>
#include <errno.h>
+#include "nsscommon.h"
+#include "modverify.h"
+
/* Function: int check_cert_db_permissions (const char *cert_db_path);
*
* Check that the given certificate directory and its contents have
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/staprun/staprun_funcs.c b/runtime/staprun/staprun_funcs.c
index 8f3d84ad..db58cd4f 100644
--- a/runtime/staprun/staprun_funcs.c
+++ b/runtime/staprun/staprun_funcs.c
@@ -12,7 +12,6 @@
#include "config.h"
#include "staprun.h"
-#include "modverify.h"
#include <sys/mount.h>
#include <sys/utsname.h>
@@ -20,6 +19,8 @@
#include <pwd.h>
#include <assert.h>
+#include "modverify.h"
+
typedef int (*check_module_path_func)(const char *module_path, int module_fd);
extern long init_module(void *, unsigned long, const char *);
@@ -507,8 +508,8 @@ check_groups (
void assert_stap_module_permissions(
const char *module_path,
int module_fd,
- const void *module_data,
- off_t module_size
+ const void *module_data __attribute__ ((unused)),
+ off_t module_size __attribute__ ((unused))
) {
int check_groups_rc;
int check_signature_rc;
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__)