ppc update
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 2 Jun 2006 13:54:36 +0000 (13:54 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 2 Jun 2006 13:54:36 +0000 (13:54 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1877 04897980-b3bd-0310-b5e0-8ef037075253

ltt-usertrace/Makefile
ltt-usertrace/README
ltt-usertrace/ltt/ltt-facility-custom-user_generic.h
ltt-usertrace/ltt/ltt-usertrace-fast.h
ltt-usertrace/ltt/ltt-usertrace-ppc.h
ltt-usertrace/ltt/ltt-usertrace.h
ltt-usertrace/ltt/system-ppc.h
ltt-usertrace/ltt/system-ppc64.h
ltt-usertrace/ltt/timex-ppc.h [new file with mode: 0644]

index baf12fcb32fda5bb5725965ab0341f6c9690a0e5..cfd4622f05c9341e6e8d924a79dcb21f36a9f750 100644 (file)
@@ -1,10 +1,10 @@
 
 CC=gcc
 INCLUDE_DIR=/usr/include
-LIB_DIR=/usr/lib
+LIB_DIR?=/usr/lib
 RANLIB=ranlib
 
-CFLAGS=-I. -O2 -L.
+LTT_CFLAGS=-I. -O2 -L.
 
 #For testing lib ltt-usertrace-fast
 #CFLAGS+=-DLTT_SUBBUF_SIZE_CPU=134217728
@@ -18,22 +18,22 @@ samples: sample sample-highspeed sample-printf \
                                sample-instrument-fct sample-thread-slow sample-thread-fast
 
 sample: sample.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^
        
 sample-highspeed: sample-highspeed.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -lltt-usertrace-fast -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -lltt-usertrace-fast -o $@ $^
 
 sample-printf: sample-printf.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^
 
 sample-instrument-fct: sample-instrument-fct.c
-       $(CC) $(CFLAGS) -g -finstrument-functions -lltt-instrument-functions -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -g -finstrument-functions -lltt-instrument-functions -o $@ $^
 
 sample-thread-slow: sample-thread-slow.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -lpthread -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -o $@ $^
 
 sample-thread-fast: sample-thread-fast.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -lpthread -lltt-usertrace-fast -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -lltt-usertrace-fast -o $@ $^
 
 
 #LIBRAIRIES
@@ -48,7 +48,7 @@ libltt-usertrace-fast.a: ltt-usertrace-fast.o
 
 libltt-usertrace-fast.so.0: ltt-usertrace-fast.o
        @rm -f libltt-usertrace-fast.so libltt-usertrace-fast.so.0
-       $(CC) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-usertrace-fast.so -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-usertrace-fast.so -o $@ $^
        ln -s libltt-usertrace-fast.so.0 libltt-usertrace-fast.so
 
 libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o
@@ -58,17 +58,24 @@ libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-us
 
 libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o
        @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0
-       $(CC) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^
        ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so
 
-.PHONY : clean install libs samples
+%.o: %.c
+       $(CC) $(LTT_CFLAGS) $(CFLAGS) -c -o $@ $+
 
-install:
+.PHONY : clean install libs install_libs install_headers samples
+
+install_headers:
        if [ ! -e "$(INCLUDE_DIR)/ltt" ] ; then mkdir $(INCLUDE_DIR)/ltt ; fi
        cp -f ltt/*.h $(INCLUDE_DIR)/ltt
+
+install_libs:
        cp -df libltt-instrument-functions.so* libltt-instrument-functions.a $(LIB_DIR)
        cp -df libltt-usertrace-fast.so* libltt-usertrace-fast.a $(LIB_DIR)
 
+install: install_headers libs install_libs
+
 clean:
        rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a libltt-usertrace-fast.a libltt-usertrace-fast.so* sample-thread-slow sample-thread-fast
 
index 205fcca47af21d0e232cbeeb0b79908e9cffe4ef..7e61df23b0bdb00389855fedb20e303f501be3ff 100644 (file)
@@ -27,10 +27,18 @@ gzip -cd ltt-usertrace-x.x.tar.gz | tar xvof -
 
 * Build the sample programs and install the headers and librairies into your
 system :
+(32 bits)
 su
 cd /usr/src/ltt-usertrace
+make clean
+make install (will build and install headers and libraries)
 make
-make install
+(64 bits)
+su
+cd /usr/src/ltt-usertrace
+make clean
+LIB_DIR=/usr/lib64 make install CFLAGS=-m64
+make CFLAGS=-m64
 
 Feel free to look at the sample programs and the Makefile : they demonstrate
 very well the features of the usertrace package and how to use them.
index 2008bae81a43c95c79809fa075ff41aa025a2c0a..c819e3aa597564077b509a7f5f31a4fd28156fec 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 
-static inline int trace_user_generic_slow_printf(
+static int trace_user_generic_slow_printf(
                const char *fmt, ...)
 #ifndef LTT_TRACE
 {
index b0b0ea5cdceaaa1562ed29df1b9b73efd4036254..bfca0c10d5b994b4df5292bb02c7481e8ea1a865 100644 (file)
@@ -15,7 +15,6 @@
 #include <pthread.h>
 #include <stdint.h>
 #include <syscall.h>
-#include <asm/timex.h>
 #include <semaphore.h>
 #include <signal.h>
 
index 002142e40a47d912363964094234ea89d106fe58..da729cf0816d89adf679a33c0ec5c4c784cf1af2 100644 (file)
@@ -5,70 +5,14 @@
 #define __LTT_USERTRACE_PPC_H
 
 #ifdef __powerpc64__
-#include "ltt/atomic-ppc64.h"
-#include "ltt/system-ppc64.h"
+#include <ltt/atomic-ppc64.h>
+#include <ltt/system-ppc64.h>
 #else
-#include "ltt/ppc_asm-ppc.h"
-#include "ltt/atomic-ppc.h"
-#include "ltt/system-ppc.h"
+#include <ltt/ppc_asm-ppc.h>
+#include <ltt/atomic-ppc.h>
+#include <ltt/system-ppc.h>
+#include <ltt/timex-ppc.h>
 #endif
 
-#define CPU_FTR_601                    0x00000100
-
-#define CLOCK_TICK_RATE        1193180 /* Underlying HZ */
-
-typedef uint64_t cycles_t;
-
-/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */
-static inline unsigned long get_tbl(void)
-{
-       unsigned long tbl;
-
-//#if defined(CONFIG_403GCX)
-//     asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
-//#else
-       asm volatile("mftb %0" : "=r" (tbl));
-//#endif
-       return tbl;
-}
-
-static inline unsigned int get_tbu(void)
-{
-       unsigned int tbu;
-
-//#if defined(CONFIG_403GCX)
-//     asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
-//#else
-       asm volatile("mftbu %0" : "=r" (tbu));
-//#endif
-       return tbu;
-}
-
-
-#ifdef __powerpc64__
-static inline uint64_t get_tb(void)
-{
-       return mftb();
-}
-#else
-static inline uint64_t get_tb(void)
-{
-       unsigned int tbhi, tblo, tbhi2;
-
-       do {
-               tbhi = get_tbu();
-               tblo = get_tbl();
-               tbhi2 = get_tbu();
-       } while (tbhi != tbhi2);
-
-       return ((uint64_t)tbhi << 32) | tblo;
-}
-#endif
-
-static inline cycles_t get_cycles(void)
-{
-       return get_tb();
-}
-
 
 #endif /* __LTT_USERTRACE_PPC_H */
index 90729c679f6e964fc2f1208d18e9046b14b0bfc4..be3a73d643143520cac77eff33edcdaa59cb1373 100644 (file)
 #include <stdint.h>
 #include <sys/types.h>
 #include <linux/unistd.h>
+
+#define inline inline __attribute__((always_inline))
+
 #if defined(__powerpc__) || defined(__powerpc64__)
-#include "ltt/ltt-usertrace-ppc.h"
+#ifdef __powerpc64__
+#include <ltt/atomic-ppc64.h>
+#include <ltt/system-ppc64.h>
+#include <asm/timex.h>
+#else
+#include <ltt/ppc_asm-ppc.h>
+#include <ltt/atomic-ppc.h>
+#include <ltt/system-ppc.h>
+#include <ltt/timex-ppc.h>
+#endif
 #else
+#include <asm/timex.h>
 #include <asm/atomic.h>
 #endif
 
 #define NR_syscalls 313
 #endif
 
-#ifdef powerpc
+#ifdef __powerpc__
+#define __NR_ltt_trace_generic 283
+#define __NR_ltt_register_generic      284
+#undef NR_syscalls
+#define NR_syscalls 285
+#endif
+
+#ifdef __powerpc64__
 #define __NR_ltt_trace_generic 283
 #define __NR_ltt_register_generic      284
 #undef NR_syscalls
 #define NR_syscalls 285
 #endif
 
+
+
 //FIXME : setup for ARM
 //FIXME : setup for MIPS
 
index 0f13837c8f70ffa1df7c5980a118e366d1e4f4e8..a4498e758938aa0bb32b5f5b75fea8edf73b18e2 100644 (file)
@@ -45,7 +45,7 @@
 #define smp_read_barrier_depends()     do { } while(0)
 #endif /* CONFIG_SMP */
 
-static __inline__ unsigned long
+static inline unsigned long
 xchg_u32(volatile void *p, unsigned long val)
 {
        unsigned long prev;
@@ -95,7 +95,7 @@ extern inline void * xchg_ptr(void * m, void * val)
 
 #define __HAVE_ARCH_CMPXCHG    1
 
-static __inline__ unsigned long
+static inline unsigned long
 __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
 {
        unsigned int prev;
@@ -122,7 +122,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
    if something tries to do an invalid cmpxchg().  */
 extern void __cmpxchg_called_with_bad_pointer(void);
 
-static __inline__ unsigned long
+static inline unsigned long
 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
 {
        switch (size) {
index 5fe605372a5000292374f956d6e7918c28b87091..0d28bc9cb7b0194c8f56c588ee16f226341085e9 100644 (file)
@@ -66,7 +66,7 @@
  * Inline asm pulled from arch/ppc/kernel/misc.S so ppc64
  * is more like most of the other architectures.
  */
-static __inline__ unsigned long
+static inline unsigned long
 __xchg_u32(volatile int *m, unsigned long val)
 {
        unsigned long dummy;
@@ -84,7 +84,7 @@ __xchg_u32(volatile int *m, unsigned long val)
        return (dummy);
 }
 
-static __inline__ unsigned long
+static inline unsigned long
 __xchg_u64(volatile long *m, unsigned long val)
 {
        unsigned long dummy;
@@ -108,7 +108,7 @@ __xchg_u64(volatile long *m, unsigned long val)
  */
 extern void __xchg_called_with_bad_pointer(void);
 
-static __inline__ unsigned long
+static inline unsigned long
 __xchg(volatile void *ptr, unsigned long x, int size)
 {
        switch (size) {
@@ -131,7 +131,7 @@ __xchg(volatile void *ptr, unsigned long x, int size)
 
 #define __HAVE_ARCH_CMPXCHG    1
 
-static __inline__ unsigned long
+static inline unsigned long
 __cmpxchg_u32(volatile int *p, int old, int new)
 {
        unsigned int prev;
@@ -153,7 +153,7 @@ __cmpxchg_u32(volatile int *p, int old, int new)
        return prev;
 }
 
-static __inline__ unsigned long
+static inline unsigned long
 __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new)
 {
        unsigned long prev;
@@ -179,7 +179,7 @@ __cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new)
    if something tries to do an invalid cmpxchg().  */
 extern void __cmpxchg_called_with_bad_pointer(void);
 
-static __inline__ unsigned long
+static inline unsigned long
 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
 {
        switch (size) {
diff --git a/ltt-usertrace/ltt/timex-ppc.h b/ltt-usertrace/ltt/timex-ppc.h
new file mode 100644 (file)
index 0000000..2449907
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef __TIMEX_PPC_H
+#define __TIMEX_PPC_H
+
+#define CPU_FTR_601                    0x00000100
+
+#define CLOCK_TICK_RATE        1193180 /* Underlying HZ */
+
+typedef uint64_t cycles_t;
+
+/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */
+static inline unsigned long get_tbl(void)
+{
+       unsigned long tbl;
+
+//#if defined(CONFIG_403GCX)
+//     asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
+//#else
+       asm volatile("mftb %0" : "=r" (tbl));
+//#endif
+       return tbl;
+}
+
+static inline unsigned int get_tbu(void)
+{
+       unsigned int tbu;
+
+//#if defined(CONFIG_403GCX)
+//     asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
+//#else
+       asm volatile("mftbu %0" : "=r" (tbu));
+//#endif
+       return tbu;
+}
+
+static inline uint64_t get_tb(void)
+{
+       unsigned int tbhi, tblo, tbhi2;
+
+       do {
+               tbhi = get_tbu();
+               tblo = get_tbl();
+               tbhi2 = get_tbu();
+       } while (tbhi != tbhi2);
+
+       return ((uint64_t)tbhi << 32) | tblo;
+}
+
+static inline cycles_t get_cycles(void)
+{
+       return get_tb();
+}
+
+#endif //__TIMEX_PPC_H
This page took 0.030886 seconds and 4 git commands to generate.