| 1 | // SPDX-FileCopyrightText: 2009 Novell, Inc. |
| 2 | // |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | |
| 5 | #ifndef _URCU_ARCH_S390_H |
| 6 | #define _URCU_ARCH_S390_H |
| 7 | |
| 8 | /* |
| 9 | * Trivial definitions for the S390 architecture based on information from the |
| 10 | * Principles of Operation "CPU Serialization" (5-91), "BRANCH ON CONDITION" |
| 11 | * (7-25) and "STORE CLOCK" (7-169). |
| 12 | * |
| 13 | * Author: Jan Blunck <jblunck@suse.de> |
| 14 | */ |
| 15 | |
| 16 | #include <urcu/compiler.h> |
| 17 | #include <urcu/config.h> |
| 18 | #include <urcu/syscall-compat.h> |
| 19 | #include <stdint.h> |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | #define CAA_CACHE_LINE_SIZE 128 |
| 26 | |
| 27 | #define cmm_mb() __asm__ __volatile__("bcr 15,0" : : : "memory") |
| 28 | |
| 29 | #define HAS_CAA_GET_CYCLES |
| 30 | |
| 31 | typedef uint64_t caa_cycles_t; |
| 32 | |
| 33 | static inline caa_cycles_t caa_get_cycles (void) |
| 34 | { |
| 35 | caa_cycles_t cycles; |
| 36 | |
| 37 | __asm__ __volatile__("stck %0" : "=m" (cycles) : : "cc", "memory" ); |
| 38 | |
| 39 | return cycles; |
| 40 | } |
| 41 | |
| 42 | /* |
| 43 | * On Linux, define the membarrier system call number if not yet available in |
| 44 | * the system headers. |
| 45 | */ |
| 46 | #if (defined(__linux__) && !defined(__NR_membarrier)) |
| 47 | #define __NR_membarrier 356 |
| 48 | #endif |
| 49 | |
| 50 | #ifdef __cplusplus |
| 51 | } |
| 52 | #endif |
| 53 | |
| 54 | #include <urcu/arch/generic.h> |
| 55 | |
| 56 | #endif /* _URCU_ARCH_S390_H */ |