X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fppc-arch.h;h=515335f7b52e1cb38ac157643e0c78a233c49b7a;hb=ed1910efb36f71b5ebe33b5ffffd7195e15644de;hp=0c5f964523d6ec46b76b9261bef642207c0c807b;hpb=79cc569a97e444389350ea3f5b1017374fe16bec;p=sbcl.git diff --git a/src/runtime/ppc-arch.h b/src/runtime/ppc-arch.h index 0c5f964..515335f 100644 --- a/src/runtime/ppc-arch.h +++ b/src/runtime/ppc-arch.h @@ -1,19 +1,58 @@ #ifndef _PPC_ARCH_H #define _PPC_ARCH_H -static inline void +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 +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 */