Browse Source

Merge pull request #58 from jcowgill/config-cpu-cleanup

config/cpu cleanup
tags/0.126.0
Adrian Knoth GitHub 7 years ago
parent
commit
d355c7d28c
29 changed files with 4 additions and 902 deletions
  1. +1
    -1
      config/cpu/Makefile.am
  2. +0
    -3
      config/cpu/alpha/Makefile.am
  3. +0
    -76
      config/cpu/alpha/atomicity.h
  4. +0
    -35
      config/cpu/alpha/cycles.h
  5. +0
    -3
      config/cpu/cris/Makefile.am
  6. +0
    -78
      config/cpu/cris/atomicity.h
  7. +1
    -1
      config/cpu/generic/Makefile.am
  8. +0
    -38
      config/cpu/generic/cycles.h
  9. +1
    -1
      config/cpu/i386/Makefile.am
  10. +0
    -34
      config/cpu/i386/cycles.h
  11. +0
    -3
      config/cpu/i486/Makefile.am
  12. +0
    -3
      config/cpu/i486/cycles.h
  13. +0
    -3
      config/cpu/ia64/Makefile.am
  14. +0
    -51
      config/cpu/ia64/atomicity.h
  15. +0
    -36
      config/cpu/ia64/cycles.h
  16. +0
    -130
      config/cpu/ia64/ia64intrin.h
  17. +0
    -3
      config/cpu/m68k/Makefile.am
  18. +0
    -140
      config/cpu/m68k/atomicity.h
  19. +0
    -3
      config/cpu/mips/Makefile.am
  20. +0
    -83
      config/cpu/mips/atomicity.h
  21. +1
    -1
      config/cpu/powerpc/Makefile.am
  22. +0
    -75
      config/cpu/powerpc/cycles.h
  23. +0
    -3
      config/cpu/s390/Makefile.am
  24. +0
    -60
      config/cpu/s390/atomicity.h
  25. +0
    -1
      config/sysdeps/Makefile.am
  26. +0
    -28
      config/sysdeps/cycles.h
  27. +0
    -7
      configure.ac
  28. +0
    -1
      libjack/client.c
  29. +0
    -1
      libjack/time.c

+ 1
- 1
config/cpu/Makefile.am View File

@@ -1,2 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
DIST_SUBDIRS = alpha cris generic i386 i486 ia64 m68k mips powerpc s390
DIST_SUBDIRS = generic i386 powerpc

+ 0
- 3
config/cpu/alpha/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h cycles.h


+ 0
- 76
config/cpu/alpha/atomicity.h View File

@@ -1,76 +0,0 @@
// Low-level functions for atomic operations: Alpha version -*- C++ -*-

// Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1

/* @@@ With gas we can play nice .subsection games to get the
non-predicted branch pointing forward. But Digital assemblers
don't understand those directives. This isn't a terribly
important issue, so just ignore it. */

typedef int _Atomic_word;

static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
register int __result, __tmp;

__asm__ __volatile__ (
"\n$Lxadd_%=:\n\t"
"ldl_l %0,%3\n\t"
"addl %0,%4,%1\n\t"
"stl_c %1,%2\n\t"
"beq %1,$Lxadd_%=\n\t"
"mb"
: "=&r" (__result), "=&r" (__tmp), "=m" (*__mem)
: "m" (*__mem), "r" (__val));

return __result;
}

static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
register _Atomic_word __result;

__asm__ __volatile__ (
"\n$Ladd_%=:\n\t"
"ldl_l %0,%2\n\t"
"addl %0,%3,%0\n\t"
"stl_c %0,%1\n\t"
"beq %0,$Ladd_%=\n\t"
"mb"
: "=&r" (__result), "=m" (*__mem)
: "m" (*__mem), "r" (__val));
}

#endif /* atomicity.h */

+ 0
- 35
config/cpu/alpha/cycles.h View File

@@ -1,35 +0,0 @@
/*
Copyright (C) 2001 Paul Davis
Code derived from various headers from the Linux kernel

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __jack_cycles_h__
#define __jack_cycles_h__

/* alpha */

typedef unsigned int cycles_t;
static inline cycles_t get_cycles (void)
{
cycles_t ret;

__asm__ __volatile__ ("rpcc %0" : "=r" (ret));
return ret;
}

#endif /* __jack_cycles_h__ */

+ 0
- 3
config/cpu/cris/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h


+ 0
- 78
config/cpu/cris/atomicity.h View File

@@ -1,78 +0,0 @@
// Low-level functions for atomic operations: CRIS version -*- C++ -*-

// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1

// This entity must not cross a page boundary.
typedef int _Atomic_word __attribute__ ((__aligned__ (4)));

static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (_Atomic_word* __mem, int __val)
{
int __tmp;
_Atomic_word __result;

#if (__CRIS_arch_version >= 10)
__asm__ __volatile__ (" clearf \n"
"0: \n"
" move.d %4,%2 \n"
" move.d [%3],%0 \n"
" add.d %0,%2 \n"
" ax \n"
" move.d %2,[%3] \n"
" bwf 0b \n"
" clearf \n"
: "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
: "r" (__mem), "g" (__val), "m" (*__mem));
#else
__asm__ __volatile__ (" move $ccr,$r9 \n"
" di \n"
" move.d %4,%2 \n"
" move.d [%3],%0 \n"
" add.d %0,%2 \n"
" move.d %2,[%3] \n"
" move $r9,$ccr \n"
: "=&r" (__result), "=m" (*__mem), "=&r" (__tmp)
: "r" (__mem), "g" (__val), "m" (*__mem)
: "r9");
#endif

return __result;
}

static inline void
__attribute__ ((__unused__))
__atomic_add (_Atomic_word* __mem, int __val)
{
__exchange_and_add (__mem, __val);
}

#endif /* atomicity.h */

+ 1
- 1
config/cpu/generic/Makefile.am View File

@@ -1,3 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h cycles.h
noinst_HEADERS = atomicity.h


+ 0
- 38
config/cpu/generic/cycles.h View File

@@ -1,38 +0,0 @@
/*
Copyright (C) 2001 Paul Davis

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __jack_cycles_h__
#define __jack_cycles_h__

/* generic solution that is not really a solution at all */

#include <sys/time.h>

typedef long cycles_t;

static inline cycles_t get_cycles (void)
{
struct timespec time;

clock_gettime (CLOCK_REALTIME, &time);

return ((cycles_t)time.tv_sec * 1000000) + time.tv_nsec * 1000;
}

#endif /* __jack_cycles_h__ */

+ 1
- 1
config/cpu/i386/Makefile.am View File

@@ -1,3 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h cycles.h
noinst_HEADERS = atomicity.h


+ 0
- 34
config/cpu/i386/cycles.h View File

@@ -1,34 +0,0 @@
/*
Copyright (C) 2001 Paul Davis
Code derived from various headers from the Linux kernel

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __jack_cycles_h__
#define __jack_cycles_h__

typedef unsigned long long cycles_t;

static inline cycles_t get_cycles (void)
{
unsigned long long ret;

__asm__ __volatile__ ("rdtsc" : "=A" (ret));
return ret;
}

#endif /* __jack_cycles_h__ */

+ 0
- 3
config/cpu/i486/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = cycles.h


+ 0
- 3
config/cpu/i486/cycles.h View File

@@ -1,3 +0,0 @@
/* the i386 version of this header is compatible */

#include <config/cpu/i386/cycles.h>

+ 0
- 3
config/cpu/ia64/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h cycles.h ia64intrin.h


+ 0
- 51
config/cpu/ia64/atomicity.h View File

@@ -1,51 +0,0 @@
// Low-level functions for atomic operations: IA64 version -*- C++ -*-

// Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1

#include <sysdeps/ia64intrin.h>

typedef int _Atomic_word;

static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
return __sync_fetch_and_add (__mem, __val);
}

static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
__sync_fetch_and_add (__mem, __val);
}

#endif /* atomicity.h */

+ 0
- 36
config/cpu/ia64/cycles.h View File

@@ -1,36 +0,0 @@
/*
Copyright (C) 2001 Paul Davis
Code derived from various headers from the Linux kernel

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __jack_cycles_h__
#define __jack_cycles_h__

/* ia64 */

typedef unsigned long cycles_t;
static inline cycles_t
get_cycles (void)
{
cycles_t ret;

__asm__ __volatile__ ("mov %0=ar.itc" : "=r" (ret));
return ret;
}

#endif /* __jack_cycles_h__ */

+ 0
- 130
config/cpu/ia64/ia64intrin.h View File

@@ -1,130 +0,0 @@
#ifndef _IA64INTRIN_H_INCLUDED
#define _IA64INTRIN_H_INCLUDED

/* Actually, everything is a compiler builtin, but just so
there's no confusion... */
#ifdef __cplusplus
extern "C" {
#endif

extern void __sync_synchronize(void);

extern int __sync_val_compare_and_swap_si(int *, int, int);
extern long __sync_val_compare_and_swap_di(long *, long, long);
#define __sync_val_compare_and_swap(PTR, OLD, NEW) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR))) \
__sync_val_compare_and_swap_si ((int*)(PTR), (int)(OLD), (int)(NEW)) \
: (__typeof__(*(PTR))) \
__sync_val_compare_and_swap_di ((long*)(PTR), (long)(OLD), (long)(NEW)))

extern int __sync_bool_compare_and_swap_si(int *, int, int);
extern int __sync_bool_compare_and_swap_di(long *, long, long);
#define __sync_bool_compare_and_swap(PTR, OLD, NEW) \
((sizeof(*(PTR)) == sizeof(int)) \
? __sync_bool_compare_and_swap_si ((int*)(PTR), (int)(OLD), (int)(NEW)) \
: __sync_bool_compare_and_swap_di ((long*)(PTR), (long)(OLD), (long)(NEW)))

extern void __sync_lock_release_si(int *);
extern void __sync_lock_release_di(long *);
#define __sync_lock_release(PTR) \
((sizeof(*(PTR)) == sizeof(int)) \
? __sync_lock_release_si ((int*)(PTR)) \
: __sync_lock_release_di ((long*)(PTR)))

extern int __sync_lock_test_and_set_si(int *, int);
extern long __sync_lock_test_and_set_di(long *, long);
#define __sync_lock_test_and_set(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_lock_test_and_set_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_lock_test_and_set_di ((long*)(PTR), (long)(VAL)))

extern int __sync_fetch_and_add_si(int *, int);
extern long __sync_fetch_and_add_di(long *, long);
#define __sync_fetch_and_add(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_fetch_and_add_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_fetch_and_add_di ((long*)(PTR), (long)(VAL)))

extern int __sync_fetch_and_sub_si(int *, int);
extern long __sync_fetch_and_sub_di(long *, long);
#define __sync_fetch_and_sub(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_fetch_and_sub_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_fetch_and_sub_di ((long*)(PTR), (long)(VAL)))

extern int __sync_fetch_and_and_si(int *, int);
extern long __sync_fetch_and_and_di(long *, long);
#define __sync_fetch_and_and(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_fetch_and_and_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_fetch_and_and_di ((long*)(PTR), (long)(VAL)))

extern int __sync_fetch_and_or_si(int *, int);
extern long __sync_fetch_and_or_di(long *, long);
#define __sync_fetch_and_or(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_fetch_and_or_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_fetch_and_or_di ((long*)(PTR), (long)(VAL)))

extern int __sync_fetch_and_xor_si(int *, int);
extern long __sync_fetch_and_xor_di(long *, long);
#define __sync_fetch_and_xor(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_fetch_and_xor_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_fetch_and_xor_di ((long*)(PTR), (long)(VAL)))

extern int __sync_fetch_and_nand_si(int *, int);
extern long __sync_fetch_and_nand_di(long *, long);
#define __sync_fetch_and_nand(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_fetch_and_nand_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_fetch_and_nand_di ((long*)(PTR), (long)(VAL)))

extern int __sync_add_and_fetch_si(int *, int);
extern long __sync_add_and_fetch_di(long *, long);
#define __sync_add_and_fetch(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_add_and_fetch_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_add_and_fetch_di ((long*)(PTR), (long)(VAL)))

extern int __sync_sub_and_fetch_si(int *, int);
extern long __sync_sub_and_fetch_di(long *, long);
#define __sync_sub_and_fetch(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_sub_and_fetch_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_sub_and_fetch_di ((long*)(PTR), (long)(VAL)))

extern int __sync_and_and_fetch_si(int *, int);
extern long __sync_and_and_fetch_di(long *, long);
#define __sync_and_and_fetch(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_and_and_fetch_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_and_and_fetch_di ((long*)(PTR), (long)(VAL)))

extern int __sync_or_and_fetch_si(int *, int);
extern long __sync_or_and_fetch_di(long *, long);
#define __sync_or_and_fetch(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_or_and_fetch_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_or_and_fetch_di ((long*)(PTR), (long)(VAL)))

extern int __sync_xor_and_fetch_si(int *, int);
extern long __sync_xor_and_fetch_di(long *, long);
#define __sync_xor_and_fetch(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_xor_and_fetch_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_xor_and_fetch_di ((long*)(PTR), (long)(VAL)))

extern int __sync_nand_and_fetch_si(int *, int);
extern long __sync_nand_and_fetch_di(long *, long);
#define __sync_nand_and_fetch(PTR, VAL) \
((sizeof(*(PTR)) == sizeof(int)) \
? (__typeof__(*(PTR)))__sync_nand_and_fetch_si ((int*)(PTR), (int)(VAL)) \
: (__typeof__(*(PTR)))__sync_nand_and_fetch_di ((long*)(PTR), (long)(VAL)))

#ifdef __cplusplus
}
#endif

#endif

+ 0
- 3
config/cpu/m68k/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h


+ 0
- 140
config/cpu/m68k/atomicity.h View File

@@ -1,140 +0,0 @@
// Low-level functions for atomic operations: m68k version -*- C++ -*-

// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1

typedef int _Atomic_word;

#if ( defined(__mc68020__) || defined(__mc68030__) \
|| defined(__mc68040__) || defined(__mc68060__) ) \
&& !defined(__mcpu32__)
// These variants support compare-and-swap.

static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
register _Atomic_word __result = *__mem;
register _Atomic_word __temp;

__asm__ __volatile__ ("1: move%.l %0,%1\n\t"
"add%.l %3,%1\n\t"
"cas%.l %0,%1,%2\n\t"
"jne 1b"
: "=d" (__result), "=&d" (__temp), "=m" (*__mem)
: "d" (__val), "0" (__result), "m" (*__mem));
return __result;
}

#elif defined(__rtems__)
/*
* TAS/JBNE is unsafe on systems with strict priority-based scheduling.
* Disable interrupts, which we can do only from supervisor mode.
*/
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __result;
short __level, __tmpsr;

__asm__ __volatile__ ("move%.w %%sr,%0\n\tor%.l %0,%1\n\tmove%.w %1,%%sr"
: "=d" (__level), "=d" (__tmpsr) : "1" (0x700));

__result = *__mem;
*__mem = __result + __val;

__asm__ __volatile__ ("move%.w %0,%%sr" : : "d" (__level));

return __result;
}

#else

template<int __inst>
struct __Atomicity_lock {
static volatile unsigned char _S_atomicity_lock;
};

template<int __inst>
volatile unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;

template volatile unsigned char __Atomicity_lock<0>::_S_atomicity_lock;

static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __result;

// bset with no immediate addressing (not SMP-safe)
#if defined(__mcf5200__) || defined(__mcf5300__)
__asm__ __volatile__ ("1: bset.b #7,%0@\n\tjbne 1b"
: /* no outputs */
: "a" (&__Atomicity_lock<0>::_S_atomicity_lock)
: "cc", "memory");

// CPU32 and MCF5400 support test-and-set (SMP-safe).
#elif defined(__mcpu32__) || defined(__mcf5400__)
__asm__ __volatile__ ("1: tas %0\n\tjbne 1b"
: "+m" (__Atomicity_lock<0>::_S_atomicity_lock)
: /* none */
: "cc");

// Use bset with immediate addressing for 68000/68010 (not SMP-safe)
// NOTE: TAS is available on the 68000, but unsupported by some Amiga
// memory controllers.
#else
__asm__ __volatile__ ("1: bset.b #7,%0\n\tjbne 1b"
: "+m" (__Atomicity_lock<0>::_S_atomicity_lock)
: /* none */
: "cc");
#endif

__result = *__mem;
*__mem = __result + __val;

__Atomicity_lock<0>::_S_atomicity_lock = 0;

return __result;
}

#endif /* TAS / BSET */

static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
// Careful: using add.l with a memory destination is not
// architecturally guaranteed to be atomic.
(void)__exchange_and_add (__mem, __val);
}

#endif /* !_GLIBCXX_ATOMICITY_H */

+ 0
- 3
config/cpu/mips/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h


+ 0
- 83
config/cpu/mips/atomicity.h View File

@@ -1,83 +0,0 @@
// Low-level functions for atomic operations.

// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1

typedef int _Atomic_word;

static inline int
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
int __result, __tmp;

__asm__ __volatile__
("/* Inline exchange & add */\n\t"
"1:\n\t"
".set push\n\t"
#if _MIPS_SIM == _ABIO32
".set mips2\n\t"
#endif
"ll %0,%3\n\t"
"addu %1,%4,%0\n\t"
"sc %1,%2\n\t"
".set pop\n\t"
"beqz %1,1b\n\t"
"/* End exchange & add */"
: "=&r" (__result), "=&r" (__tmp), "=m" (*__mem)
: "m" (*__mem), "r" (__val));

return __result;
}

static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
int __result;

__asm__ __volatile__
("/* Inline atomic add */\n\t"
"1:\n\t"
".set push\n\t"
#if _MIPS_SIM == _ABIO32
".set mips2\n\t"
#endif
"ll %0,%2\n\t"
"addu %0,%3,%0\n\t"
"sc %0,%1\n\t"
".set pop\n\t"
"beqz %0,1b\n\t"
"/* End atomic add */"
: "=&r" (__result), "=m" (*__mem)
: "m" (*__mem), "r" (__val));
}

#endif /* atomicity.h */

+ 1
- 1
config/cpu/powerpc/Makefile.am View File

@@ -1,3 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h cycles.h
noinst_HEADERS = atomicity.h


+ 0
- 75
config/cpu/powerpc/cycles.h View File

@@ -1,75 +0,0 @@
/*
Copyright (C) 2001 Paul Davis
Code derived from various headers from the Linux kernel

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef __jack_cycles_h__
#define __jack_cycles_h__

/* PowerPC */

#define CPU_FTR_601 0x00000100
#ifdef __powerpc64__
#define CPU_FTR_CELL_TB_BUG 0x0000800000000000UL
#endif /* __powerpc64__ */

typedef unsigned long cycles_t;

/* For the "cycle" counter we use the timebase lower half. */

extern cycles_t cacheflush_time;

static inline cycles_t get_cycles (void)
{
cycles_t ret = 0;

#ifdef __powerpc64__
#ifdef ENABLE_CELLBE
asm volatile ( \
"90: mftb %0;\n" \
"97: cmpwi %0,0;\n" \
" beq- 90b;\n" \
"99:\n" \
".section __ftr_fixup,\"a\"\n" \
".align 3\n" \
"98:\n" \
" .llong %1\n" \
" .llong %1\n" \
" .llong 97b-98b\n" \
" .llong 99b-98b\n" \
".previous" \
: "=r" (ret) : "i" (CPU_FTR_CELL_TB_BUG));
#else /* !ENABLE_CELLBE */
__asm__ __volatile__ ("mftb %0" : "=r" (ret));
#endif /* !ENABLE_CELLBE */
#else /* !__powerpc64__ */
__asm__ __volatile__ (
"98: mftb %0\n"
"99:\n"
".section __ftr_fixup,\"a\"\n"
" .long %1\n"
" .long 0\n"
" .long 98b\n"
" .long 99b\n"
".previous"
: "=r" (ret) : "i" (CPU_FTR_601));
#endif /* !__powerpc64__ */
return ret;
}

#endif /* __jack_cycles_h__ */

+ 0
- 3
config/cpu/s390/Makefile.am View File

@@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = atomicity.h


+ 0
- 60
config/cpu/s390/atomicity.h View File

@@ -1,60 +0,0 @@
// Low-level functions for atomic operations: S/390 version -*- C++ -*-

// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCXX_ATOMICITY_H
#define _GLIBCXX_ATOMICITY_H 1

typedef int _Atomic_word;

static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
register _Atomic_word __old_val, __new_val;

__asm__ __volatile__ (" l %0,0(%3)\n"
"0: lr %1,%0\n"
" ar %1,%4\n"
" cs %0,%1,0(%3)\n"
" jl 0b"
: "=&d" (__old_val), "=&d" (__new_val), "=m" (*__mem)
: "a" (__mem), "d" (__val), "m" (*__mem) : "cc");
return __old_val;
}

static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word* __mem, int __val)
{
__exchange_and_add (__mem, __val);
}

#endif /* atomicity.h */



+ 0
- 1
config/sysdeps/Makefile.am View File

@@ -8,7 +8,6 @@ noinst_HEADERS = \
systemtest.c \
sanitycheck.c \
atomicity.h \
cycles.h \
getopt.h \
ipc.h \
mach_port.h \


+ 0
- 28
config/sysdeps/cycles.h View File

@@ -1,28 +0,0 @@
#ifndef _jack_sysdep_cycles_h_
#define _jack_sysdep_cycles_h_

#if defined(__i386__)

/* technically, i386 doesn't have a cycle counter, but
running JACK on a real i386 seems like a ridiculuous
target and gcc defines this for the entire x86 family
including the [456]86 that do have the counter.
*/

#include <config/cpu/i386/cycles.h>

#elif defined(__x86_64)

#include <config/cpu/i486/cycles.h>

#elif defined(__powerpc__) || defined(__ppc__) /* linux and OSX gcc use different tokens */

#include <config/cpu/powerpc/cycles.h>

#else

#include <config/cpu/generic/cycles.h>

#endif /* processor selection */

#endif /* _jack_sysdep_cycles_h_ */

+ 0
- 7
configure.ac View File

@@ -965,16 +965,9 @@ AC_OUTPUT(
Makefile
config/Makefile
config/cpu/Makefile
config/cpu/alpha/Makefile
config/cpu/cris/Makefile
config/cpu/generic/Makefile
config/cpu/i386/Makefile
config/cpu/i486/Makefile
config/cpu/ia64/Makefile
config/cpu/m68k/Makefile
config/cpu/mips/Makefile
config/cpu/powerpc/Makefile
config/cpu/s390/Makefile
config/os/Makefile
config/os/generic/Makefile
config/os/gnu-linux/Makefile


+ 0
- 1
libjack/client.c View File

@@ -60,7 +60,6 @@

#include <sysdeps/poll.h>
#include <sysdeps/ipc.h>
#include <sysdeps/cycles.h>

#ifdef JACK_USE_MACH_THREADS
#include <sysdeps/pThreadUtilities.h>


+ 0
- 1
libjack/time.c View File

@@ -37,7 +37,6 @@
#include <jack/jack.h>

#include <sysdeps/time.h>
#include <sysdeps/cycles.h>

#include "local.h"



Loading…
Cancel
Save