linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* test & set ppc assembly (libgcj vs. threads)
@ 1999-08-02 15:54 Brad Midgley
  1999-08-02 18:49 ` Daniel Jacobowitz
  1999-08-02 19:02 ` David Edelsohn
  0 siblings, 2 replies; 3+ messages in thread
From: Brad Midgley @ 1999-08-02 15:54 UTC (permalink / raw)
  To: linuxppc-dev


hi...

i would like to see libgcj work on ppc. i guess there isn't anyone working
on it because there is missing stuff even in the cvs version. 

could one of you ppc assembly gurus put forward the code to do a test &
set? the header here hopefully provides all the necessary context with
the x86 and alpha implementations... 

brad

#  ifdef LINUX_THREADS
#    include <pthread.h>
#    ifdef __i386__
       inline static int GC_test_and_set(volatile unsigned int *addr) {
          int oldval;
          /* Note: the "xchg" instruction does not need a "lock" prefix */
          __asm__ __volatile__("xchgl %0, %1"
                : "=r"(oldval), "=m"(*(addr))
                : "0"(1), "m"(*(addr)));
          return oldval;
       }
       inline static void GC_clear(volatile unsigned int *addr) {
          *(addr) = 0;
       }
#    elif defined(__alpha__)
       inline static int GC_test_and_set(volatile unsigned int *addr) {
        long oldval, temp;

        __asm__ __volatile__(
              "1:\tldl_l %0,%3\n"
              "\tbne %0,2f\n"
              "\tor $31,1,%1\n"
              "\tstl_c %1,%2\n"
              "\tbeq %1,1b\n"
              "2:\tmb\n"
              : "=&r"(oldval), "=&r"(temp), "=m"(*(addr))
              : "m"(*(addr))
              : "memory");
        return (int)oldval;
       }
       inline static void GC_clear(volatile unsigned int *addr) {
          __asm__ __volatile__("mb": : :"memory");
          *(addr) = 0;
       }
#    else
       -- > Need implementation of GC_test_and_set()
#    endif

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-08-02 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-08-02 15:54 test & set ppc assembly (libgcj vs. threads) Brad Midgley
1999-08-02 18:49 ` Daniel Jacobowitz
1999-08-02 19:02 ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).