X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fppc-arch.h;h=a5fe1e9ee2769424ca4ab8631d54fa8c194b2b70;hb=35ab27e7aab71c94aa6be12da15603c7fd87fca8;hp=cbaa670af89b6b20d4ae797b803aa1135b1616bb;hpb=2378b4fe567a8fea78b1e4915b9497d8c18ca92f;p=sbcl.git diff --git a/src/runtime/ppc-arch.h b/src/runtime/ppc-arch.h index cbaa670..a5fe1e9 100644 --- a/src/runtime/ppc-arch.h +++ b/src/runtime/ppc-arch.h @@ -1,19 +1,59 @@ #ifndef _PPC_ARCH_H #define _PPC_ARCH_H -static inline void -get_spinlock(lispobj *word,int value) +static inline long +get_spinlock(lispobj *word,long value) { - *word=value; /* FIXME for threads */ +#ifdef LISP_FEATURE_SB_THREAD + long temp; + + asm volatile("1: lwarx %0,0,%1;" + " cmpwi %0,0;" + " bne- 1b;" + " stwcx. %2,0,%1;" + " bne- 1b;" + " isync" + : "=&r" (temp) + : "r" (word), "r" (value) + : "cr0", "memory"); + return temp; +#else + *word=value; + return 0; +#endif } static inline void release_spinlock(lispobj *word) { +#ifdef LISP_FEATURE_SB_THREAD + asm volatile ("sync" : : : "memory"); +#endif *word=0; } +#ifdef LISP_FEATURE_SB_THREAD +static inline lispobj +swap_lispobjs(volatile lispobj *dest, lispobj value) +{ + lispobj old_value; + asm volatile ("1: lwarx %0,0,%1;" + " stwcx. %2,0,%1;" + " bne- 1b;" + " isync" + : "=&r" (old_value) + : "r" (dest), "r" (value) + : "cr0", "memory"); + return old_value; +} +#endif #define ARCH_HAS_LINK_REGISTER +#define ALIEN_STACK_GROWS_DOWNWARD + +extern void ppc_flush_icache(os_vm_address_t address, os_vm_size_t length); + +os_context_register_t *os_context_ctr_addr(os_context_t *context); +os_context_register_t *os_context_cr_addr(os_context_t *context); #endif /* _PPC_ARCH_H */