X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Farch%2Fhppa.h;h=c8d4d057708e1d5fe603697b12200ca54d0d5682;hp=b9b9494364a622b98c344419f3f4de01f888a63e;hb=1a186a881c195c0f240c0baa813056b0cc1eab91;hpb=13e0bc720bc9baadf0adc007f0035c180888b1f1 diff --git a/urcu/arch/hppa.h b/urcu/arch/hppa.h index b9b9494..c8d4d05 100644 --- a/urcu/arch/hppa.h +++ b/urcu/arch/hppa.h @@ -1,8 +1,29 @@ #ifndef _URCU_ARCH_HPPA_H #define _URCU_ARCH_HPPA_H +/* + * arch/hppa.h: definitions for hppa architecture + * + * Copyright (c) 2014 Helge Deller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include #include +#include #ifdef __cplusplus extern "C" { @@ -11,11 +32,20 @@ extern "C" { #include #include -typedef unsigned long cycles_t; +/* + * On Linux, define the membarrier system call number if not yet available in + * the system headers. + */ +#if (defined(__linux__) && !defined(__NR_membarrier)) +#define __NR_membarrier 343 +#endif + +#define HAS_CAA_GET_CYCLES +typedef unsigned long caa_cycles_t; -static inline cycles_t caa_get_cycles(void) +static inline caa_cycles_t caa_get_cycles(void) { - cycles_t cycles; + caa_cycles_t cycles; asm volatile("mfctl 16, %0" : "=r" (cycles)); return cycles;