2
Copyright (C) 2001 Paul Davis
3
Code derived from various headers from the Linux kernel
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#ifndef __jack_cycles_h__
22
#define __jack_cycles_h__
26
#define CPU_FTR_601 0x00000100
28
#define CPU_FTR_CELL_TB_BUG 0x0000800000000000UL
29
#endif /* __powerpc64__ */
31
typedef unsigned long cycles_t;
33
/* For the "cycle" counter we use the timebase lower half. */
35
extern cycles_t cacheflush_time;
37
static inline cycles_t get_cycles(void)
48
".section __ftr_fixup,\"a\"\n" \
56
: "=r" (ret) : "i" (CPU_FTR_CELL_TB_BUG));
57
#else /* !ENABLE_CELLBE */
58
__asm__ __volatile__("mftb %0" : "=r" (ret));
59
#endif /* !ENABLE_CELLBE */
60
#else /* !__powerpc64__ */
64
".section __ftr_fixup,\"a\"\n"
70
: "=r" (ret) : "i" (CPU_FTR_601));
71
#endif /* !__powerpc64__ */
75
#endif /* __jack_cycles_h__ */