[uClibc-cvs] uClibc/libpthread/linuxthreads/sysdeps/v850 sigcontextinfo.h,NONE,1.1 pt-machine.h,NONE,1.1

Miles Bader miles at uclibc.org
Thu Jan 30 08:44:43 UTC 2003


Update of /var/cvs/uClibc/libpthread/linuxthreads/sysdeps/v850
In directory winder:/tmp/cvs-serv11743/libpthread/linuxthreads/sysdeps/v850

Added Files:
	sigcontextinfo.h pt-machine.h 
Log Message:
Initial checkin.


--- NEW FILE: sigcontextinfo.h ---
/*
 * sysdeps/v850/sigcontextinfo.h -- v850-specific pthread signal definitions
 *
 *  Copyright (C) 2002  NEC Electronics Corporation
 *  Copyright (C) 2002  Miles Bader <miles at gnu.org>
 *
 * This file is subject to the terms and conditions of the GNU General
 * Public License.  See the file COPYING in the main directory of this
 * archive for more details.
 *
 * Written by Miles Bader <miles at gnu.org>
 */

#include <signal.h>

#define SIGCONTEXT struct sigcontext *
#define SIGCONTEXT_EXTRA_ARGS

--- NEW FILE: pt-machine.h ---
/*
 * sysdeps/v850/pt-machine.h -- v850-specific pthread definitions
 *
 *  Copyright (C) 2002  NEC Electronics Corporation
 *  Copyright (C) 2002  Miles Bader <miles at gnu.org>
 *
 * This file is subject to the terms and conditions of the GNU General
 * Public License.  See the file COPYING in the main directory of this
 * archive for more details.
 *
 * Written by Miles Bader <miles at gnu.org>
 */

#ifndef PT_EI
# define PT_EI extern inline
#endif

/* Get some notion of the current stack.  Need not be exactly the top
   of the stack, just something somewhere in the current frame.  */
#define CURRENT_STACK_FRAME  __stack_pointer
register char *__stack_pointer __asm__ ("sp");

#define HAS_COMPARE_AND_SWAP

/* Atomically:  If *PTR == OLD, set *PTR to NEW and return true,
   otherwise do nothing and return false.  */
PT_EI int
__compare_and_swap (long *ptr, long old, long new)
{
  unsigned long psw;

  /* disable interrupts  */
  __asm__ __volatile__ ("stsr psw, %0; di" : "=&r" (psw));

  if (likely (*ptr == old))
    {
      *ptr = new;
      __asm__ __volatile__ ("ldsr %0, psw" :: "r" (psw)); /* re-enable */
      return 1;
    }
  else
    {
      __asm__ __volatile__ ("ldsr %0, psw" :: "r" (psw)); /* re-enable */
      return 0;
    }
}




More information about the uClibc-cvs mailing list