Back to index

glibc  2.9
Defines | Functions
pt-machine.h File Reference
#include <machine/pal.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PT_EI   extern inline __attribute__ ((always_inline))
#define CURRENT_STACK_FRAME   stack_pointer
#define MEMORY_BARRIER()   __asm__ __volatile__("mb" : : : "memory")
#define WRITE_MEMORY_BARRIER()   __asm__ __volatile__("wmb" : : : "memory")
#define THREAD_STACK_START_ADDRESS   0x40000000000
#define THREAD_SELF
#define INIT_THREAD_SELF(descr, nr)
#define HAS_COMPARE_AND_SWAP
#define FLOATING_STACKS   1
#define ARCH_STACK_MAX_SIZE   32*1024*1024

Functions

long int testandset (int *spinlock)
int __compare_and_swap (long int *p, long int oldval, long int newval)
register char *stack_pointer __asm__ ("$30")

Define Documentation

#define ARCH_STACK_MAX_SIZE   32*1024*1024

Definition at line 126 of file pt-machine.h.

#define CURRENT_STACK_FRAME   stack_pointer

Definition at line 41 of file pt-machine.h.

#define FLOATING_STACKS   1

Definition at line 123 of file pt-machine.h.

Definition at line 98 of file pt-machine.h.

#define INIT_THREAD_SELF (   descr,
  nr 
)
Value:
{                                                                    \
  register pthread_descr __self __asm__("$16") = (descr);                   \
  __asm__ __volatile__ ("call_pal %1" : : "r"(__self), "i"(PAL_wruniq));      \
}

Definition at line 89 of file pt-machine.h.

#define MEMORY_BARRIER ( )    __asm__ __volatile__("mb" : : : "memory")

Definition at line 46 of file pt-machine.h.

#define PT_EI   extern inline __attribute__ ((always_inline))

Definition at line 27 of file pt-machine.h.

#define THREAD_SELF
Value:
({                                                                   \
  register pthread_descr __self __asm__("$0");                              \
  __asm__ ("call_pal %1" : "=r"(__self) : "i"(PAL_rduniq));                 \
  __self;                                                            \
})

Definition at line 81 of file pt-machine.h.

#define THREAD_STACK_START_ADDRESS   0x40000000000

Definition at line 77 of file pt-machine.h.

#define WRITE_MEMORY_BARRIER ( )    __asm__ __volatile__("wmb" : : : "memory")

Definition at line 48 of file pt-machine.h.


Function Documentation

register char* stack_pointer __asm__ ( "$30"  )
int __compare_and_swap ( long int p,
long int  oldval,
long int  newval 
) [inline]

Definition at line 100 of file pt-machine.h.

{
  long int ret;

  __asm__ __volatile__ (
       "/* Inline compare & swap */\n"
       "1:\t"
       "ldq_l %0,%4\n\t"
       "cmpeq %0,%2,%0\n\t"
       "beq %0,2f\n\t"
       "mov %3,%0\n\t"
       "stq_c %0,%1\n\t"
       "beq %0,1b\n\t"
       "2:\tmb\n"
       "/* End compare & swap */"
       : "=&r"(ret), "=m"(*p)
       : "r"(oldval), "r"(newval), "m"(*p)
        : "memory");

  return ret;
}
long int testandset ( int spinlock)

Definition at line 53 of file pt-machine.h.

{
  long int ret, temp;

  __asm__ __volatile__(
       "/* Inline spinlock test & set */\n"
       "1:\t"
       "ldl_l %0,%3\n\t"
       "bne %0,2f\n\t"
       "or $31,1,%1\n\t"
       "stl_c %1,%2\n\t"
       "beq %1,1b\n"
       "2:\tmb\n"
       "/* End spinlock test & set */"
       : "=&r"(ret), "=&r"(temp), "=m"(*spinlock)
       : "m"(*spinlock)
        : "memory");

  return ret;
}