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