X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fppc-arch.h;h=a5fe1e9ee2769424ca4ab8631d54fa8c194b2b70;hb=5f0cfcf9095f2d8dbca4ddf703c580a36d5c3709;hp=b43e78e250b9c9e9ecc1a8bfd6d12ae1313f5e4b;hpb=c1b4849c95bad4f3535fba2b9307fd37e15bcf6d;p=sbcl.git diff --git a/src/runtime/ppc-arch.h b/src/runtime/ppc-arch.h index b43e78e..a5fe1e9 100644 --- a/src/runtime/ppc-arch.h +++ b/src/runtime/ppc-arch.h @@ -1,6 +1,59 @@ #ifndef _PPC_ARCH_H #define _PPC_ARCH_H +static inline long +get_spinlock(lispobj *word,long value) +{ +#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 */