X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=api_ppc.h;h=8a03faa1c0adf1adee77e525df9b102e14b010b3;hp=509fafca9ee2b20d726e19a101443538778b1666;hb=0578089f3fa4c50acb86f545513e7ba7cd248ed9;hpb=e7f6425681098aad0255a00a144a8897370ba49d diff --git a/api_ppc.h b/api_ppc.h index 509fafc..8a03faa 100644 --- a/api_ppc.h +++ b/api_ppc.h @@ -71,7 +71,6 @@ * Machine parameters. */ -#define CONFIG_SMP #define CONFIG_PPC64 #define CACHE_LINE_SIZE 128 @@ -618,22 +617,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) #define smp_mb__before_atomic_inc() smp_mb() #define smp_mb__after_atomic_inc() smp_mb() -#define smp_mb() __asm__ __volatile__("sync" : : : "memory") - - -/* - * Generate 64-bit timestamp. - */ - -static unsigned long long get_timestamp(void) -{ - unsigned int __a,__d; - - asm volatile("mftbl %0" : "=r" (__a)); - asm volatile("mftbu %0" : "=r" (__d)); - return ((long long)__a) | (((long long)__d)<<32); -} - /* * api_pthreads.h: API mapping to pthreads environment. * @@ -674,7 +657,6 @@ static unsigned long long get_timestamp(void) #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) -#define barrier() __asm__ __volatile__("": : :"memory") /* * Default machine parameters. @@ -709,18 +691,6 @@ static void spin_lock(spinlock_t *sp) } } -static int spin_trylock(spinlock_t *sp) -{ - int retval; - - if ((retval = pthread_mutex_trylock(sp)) == 0) - return 1; - if (retval == EBUSY) - return 0; - perror("spin_trylock:pthread_mutex_trylock"); - exit(-1); -} - static void spin_unlock(spinlock_t *sp) { if (pthread_mutex_unlock(sp) != 0) { @@ -732,11 +702,6 @@ static void spin_unlock(spinlock_t *sp) #define spin_lock_irqsave(l, f) do { f = 1; spin_lock(l); } while (0) #define spin_unlock_irqrestore(l, f) do { f = 0; spin_unlock(l); } while (0) -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) -#define unlikely(x) x -#define likely(x) x -#define prefetch(x) x - /* * Thread creation/destruction primitives. */ @@ -788,7 +753,8 @@ static int __smp_thread_id(void) return i; } spin_unlock(&__thread_id_map_mutex); - fprintf(stderr, "smp_thread_id: Rogue thread, id: %d(%#x)\n", tid, tid); + fprintf(stderr, "smp_thread_id: Rogue thread, id: %d(%#x)\n", + (int)tid, (int)tid); exit(-1); } @@ -837,7 +803,8 @@ static void *wait_thread(thread_id_t tid) break; } if (i >= NR_THREADS){ - fprintf(stderr, "wait_thread: bad tid = %d(%#x)\n", tid, tid); + fprintf(stderr, "wait_thread: bad tid = %d(%#x)\n", + (int)tid, (int)tid); exit(-1); } if (pthread_join(tid, &vp) != 0) { @@ -930,16 +897,6 @@ long long get_microseconds(void) DEFINE_PER_THREAD(int, smp_processor_id); -static int smp_processor_id(void) -{ - return __get_thread_var(smp_processor_id); -} - -static void set_smp_processor_id(int cpu) -{ - __get_thread_var(smp_processor_id) = cpu; -} - #define per_cpu(name, thread) __per_cpu_##name[thread].v #define __get_cpu_var(name) per_cpu(name, smp_processor_id())