From fa94e3a95d755ca73fca584afaff820566f6a980 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 4 Aug 1999 03:26:15 +0000 Subject: [PATCH] gc_priv.h (GC_test_and_set): Implementation for Linux PPC from Franz Sirl . * gc_priv.h (GC_test_and_set): Implementation for Linux PPC from Franz Sirl . From-SVN: r28480 --- boehm-gc/ChangeLog | 5 +++++ boehm-gc/gc_priv.h | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index ba41a45..1ddff1c 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,8 @@ +1999-08-03 Tom Tromey + + * gc_priv.h (GC_test_and_set): Implementation for Linux PPC from + Franz Sirl . + 1999-08-02 Tom Tromey * aclocal.m4, configure: Rebuilt for new libtool. diff --git a/boehm-gc/gc_priv.h b/boehm-gc/gc_priv.h index cc8b147..2903533 100644 --- a/boehm-gc/gc_priv.h +++ b/boehm-gc/gc_priv.h @@ -465,6 +465,29 @@ void GC_print_callers (/* struct callinfo info[NFRAMES] */); __asm__ __volatile__("mb": : :"memory"); *(addr) = 0; } +# elif defined(__powerpc__) + inline static int GC_test_and_set(volatile unsigned int *addr) { + int ret, oldval=0, newval=1; + + __asm__ __volatile__("sync" : : : "memory"); + __asm__ __volatile__( + "0: lwarx %0,0,%1 ;" + " xor. %0,%3,%0;" + " bne 1f;" + " stwcx. %2,0,%1;" + " bne- 0b;" + "1: " + : "=&r"(ret) + : "r"(addr), "r"(newval), "r"(oldval) + : "cr0", "memory"); + __asm__ __volatile__("sync" : : : "memory"); + return ret == 0; + } + inline static void GC_clear(volatile unsigned int *addr) { + __asm__ __volatile__("sync": : :"memory"); + *(addr) = 0; + } + # else -- > Need implementation of GC_test_and_set() # endif -- 2.7.4