Commit | Line | Data |
---|---|---|
2041a99a MD |
1 | #ifndef _URCU_ARCH_S390_H |
2 | #define _URCU_ARCH_S390_H | |
ac26f1a8 JB |
3 | |
4 | /* | |
7039fa6f JB |
5 | * Trivial definitions for the S390 architecture based on information from the |
6 | * Principles of Operation "CPU Serialization" (5-91), "BRANCH ON CONDITION" | |
7 | * (7-25) and "STORE CLOCK" (7-169). | |
ac26f1a8 | 8 | * |
7039fa6f | 9 | * Copyright (c) 2009 Novell, Inc. |
ac26f1a8 JB |
10 | * Author: Jan Blunck <jblunck@suse.de> |
11 | * | |
7039fa6f JB |
12 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
13 | * of this software and associated documentation files (the "Software"), to | |
14 | * deal in the Software without restriction, including without limitation the | |
15 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
16 | * sell copies of the Software, and to permit persons to whom the Software is | |
17 | * furnished to do so, subject to the following conditions: | |
ac26f1a8 | 18 | * |
7039fa6f JB |
19 | * The above copyright notice and this permission notice shall be included in |
20 | * all copies or substantial portions of the Software. | |
ac26f1a8 | 21 | * |
7039fa6f JB |
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
28 | * IN THE SOFTWARE. | |
ac26f1a8 JB |
29 | */ |
30 | ||
14714b51 | 31 | #include <urcu/compiler.h> |
1655f018 | 32 | #include <urcu/config.h> |
999991c6 | 33 | #include <urcu/syscall-compat.h> |
3fa18286 | 34 | #include <stdint.h> |
ac26f1a8 | 35 | |
36bc70a8 MD |
36 | #ifdef __cplusplus |
37 | extern "C" { | |
67ecffc0 | 38 | #endif |
36bc70a8 | 39 | |
06f22bdb | 40 | #define CAA_CACHE_LINE_SIZE 128 |
5b3c6672 | 41 | |
5481ddb3 | 42 | #define cmm_mb() __asm__ __volatile__("bcr 15,0" : : : "memory") |
ac26f1a8 | 43 | |
f8c43f45 MD |
44 | #define HAS_CAA_GET_CYCLES |
45 | ||
3fa18286 | 46 | typedef uint64_t caa_cycles_t; |
ac26f1a8 | 47 | |
3fa18286 | 48 | static inline caa_cycles_t caa_get_cycles (void) |
ac26f1a8 | 49 | { |
3fa18286 | 50 | caa_cycles_t cycles; |
ac26f1a8 JB |
51 | |
52 | __asm__ __volatile__("stck %0" : "=m" (cycles) : : "cc", "memory" ); | |
53 | ||
54 | return cycles; | |
55 | } | |
56 | ||
33f0d0b1 | 57 | /* |
84f4ccb4 MD |
58 | * On Linux, define the membarrier system call number if not yet available in |
59 | * the system headers. | |
33f0d0b1 | 60 | */ |
84f4ccb4 | 61 | #if (defined(__linux__) && !defined(__NR_membarrier)) |
33f0d0b1 MD |
62 | #define __NR_membarrier 356 |
63 | #endif | |
64 | ||
67ecffc0 | 65 | #ifdef __cplusplus |
36bc70a8 MD |
66 | } |
67 | #endif | |
68 | ||
1b9119f8 | 69 | #include <urcu/arch/generic.h> |
e4d1eb09 | 70 | |
2041a99a | 71 | #endif /* _URCU_ARCH_S390_H */ |