Back to index

glibc  2.9
Defines | Functions | Variables
pt-machine.h File Reference
#include <sys/types.h>
#include <bits/initspin.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 THREAD_SELF   __get_cr27()
#define SET_THREAD_SELF(descr)   __set_cr27(descr)
#define INIT_THREAD_SELF(descr, nr)   __set_cr27(descr)
#define FLOATING_STACKS   1
#define ARCH_STACK_MAX_SIZE   8*1024*1024
#define __ldcw(a)
#define __lock_reset(lock_addr, tmp)
#define __PA_LDCW_ALIGNMENT   16
#define __ldcw_align(a)

Functions

long int testandset (__atomic_lock_t *spinlock)
int __compare_and_swap (long int *p, long int oldval, long int newval)
int lock_held (__atomic_lock_t *spinlock)
int __load_and_clear (__atomic_lock_t *spinlock)
register char *stack_pointer __asm__ ("%r30")
static struct
_pthread_descr_struct
__get_cr27 (void)
static void __set_cr27 (struct _pthread_descr_struct *cr27)

Variables

struct _pthread_descr_struct__thread_self

Define Documentation

#define __ldcw (   a)
Value:
({                                                             \
  unsigned int __ret;                                                 \
  __asm__ __volatile__("ldcw 0(%1),%0"                                \
                      : "=r" (__ret) : "r" (a) : "memory");           \
  __ret;                                                       \
})

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

#define __ldcw_align (   a)
Value:
({ \
  volatile unsigned int __ret = (unsigned int) a;                     \
  if ((__ret & ~(__PA_LDCW_ALIGNMENT - 1)) < (unsigned int) a)        \
    __ret = (__ret & ~(__PA_LDCW_ALIGNMENT - 1)) + __PA_LDCW_ALIGNMENT; \
  (unsigned int *) __ret;                                      \
})

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

#define __lock_reset (   lock_addr,
  tmp 
)
Value:
({                                                                    \
       __asm__ __volatile__ ("stw,ma %1,0(%0)"                               \
                            : : "r" (lock_addr), "r" (tmp) : "memory");      \
})

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

#define __PA_LDCW_ALIGNMENT   16

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

#define ARCH_STACK_MAX_SIZE   8*1024*1024

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

#define CURRENT_STACK_FRAME   stack_pointer

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

#define FLOATING_STACKS   1

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

#define INIT_THREAD_SELF (   descr,
  nr 
)    __set_cr27(descr)

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

#define PT_EI   extern inline __attribute__ ((always_inline))

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

#define SET_THREAD_SELF (   descr)    __set_cr27(descr)

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

#define THREAD_SELF   __get_cr27()

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


Function Documentation

register char* stack_pointer __asm__ ( "%r30"  )
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;
}

Here is the call graph for this function:

static struct _pthread_descr_struct* __get_cr27 ( void  ) [static, read]

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

{
  long cr27;
  asm ("mfctl %%cr27, %0" : "=r" (cr27) : );
  return (struct _pthread_descr_struct *) cr27;
}
PT_EI int __load_and_clear ( __atomic_lock_t *  spinlock) [inline]

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

{
  volatile unsigned int *a = __ldcw_align (spinlock);

  return __ldcw (a);
}

Here is the caller graph for this function:

static void __set_cr27 ( struct _pthread_descr_struct cr27) [inline, static]

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

{
  asm ( "ble  0xe0(%%sr2, %%r0)\n\t"
       "copy  %0, %%r26"
       : : "r" (cr27) : "r26" );
}
PT_EI int lock_held ( __atomic_lock_t *  spinlock) [inline]

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

{
  volatile unsigned int *a = __ldcw_align (spinlock);

  return *a == 0;
}
PT_EI long int testandset ( __atomic_lock_t *  spinlock) [inline]

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

{
  return (__load_and_clear(spinlock) == 0);
}

Here is the call graph for this function:


Variable Documentation

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