00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _QORE_CONFIG_MACHINE_MACROS_H
00022
00023 #define _QORE_CONFIG_MACHINE_MACROS_H
00024
00025
00026 #ifndef __ppc64
00027
00028 #define HAVE_ATOMIC_MACROS
00029
00030 static inline int atomic_inc(int *v)
00031 {
00032 int t;
00033
00034 asm volatile(
00035 "1: lwarx %0,0,%1\n"
00036 " addic %0,%0,1\n"
00037 " stwcx. %0,0,%1\n"
00038 " bne- 1b"
00039 : "=&r" (t)
00040 : "r" (v)
00041 : "cc", "memory");
00042 return t;
00043 }
00044
00045 static inline int atomic_dec(int *v)
00046 {
00047 int t;
00048
00049 asm volatile(
00050 "1: lwarx %0,0,%1\n"
00051 " addic %0,%0,-1\n"
00052 " stwcx. %0,0,%1\n"
00053 " bne- 1b"
00054 : "=&r" (t)
00055 : "r" (v)
00056 : "cc", "memory");
00057 return !t;
00058 }
00059
00060 #define HAVE_CHECK_STACK_POS
00061 #define STACK_DIRECTION_DOWN 1
00062
00063 static inline size_t get_stack_pos() {
00064 size_t addr;
00065 __asm("mr %0, r1" : "=r" (addr) );
00066 return addr;
00067 }
00068
00069 #endif
00070
00071 #endif