ee45be65f84313a6e221c654d421011b10ddb35b
1 #ifndef _UAPI_LINUX_RSEQ_H
2 #define _UAPI_LINUX_RSEQ_H
7 * Restartable sequences system call API
9 * Copyright (c) 2015-2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 # include <linux/types.h>
32 #else /* #ifdef __KERNEL__ */
34 #endif /* #else #ifdef __KERNEL__ */
36 #include <asm/byteorder.h>
39 # define RSEQ_FIELD_u32_u64(field) uint64_t field
40 #elif defined(__BYTE_ORDER) ? \
41 __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
42 # define RSEQ_FIELD_u32_u64(field) uint32_t _padding ## field, field
44 # define RSEQ_FIELD_u32_u64(field) uint32_t field, _padding ## field
48 RSEQ_FORCE_UNREGISTER
= (1 << 0),
52 * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always
53 * contained within a single cache-line. It is usually declared as
54 * link-time constant data.
57 RSEQ_FIELD_u32_u64(start_ip
);
58 RSEQ_FIELD_u32_u64(post_commit_ip
);
59 RSEQ_FIELD_u32_u64(abort_ip
);
60 } __attribute__((aligned(4 * sizeof(uint64_t))));
62 union rseq_cpu_event
{
65 * Restartable sequences cpu_id field.
66 * Updated by the kernel, and read by user-space with
67 * single-copy atomicity semantics. Aligned on 32-bit.
68 * Negative values are reserved for user-space.
72 * Restartable sequences event_counter field.
73 * Updated by the kernel, and read by user-space with
74 * single-copy atomicity semantics. Aligned on 32-bit.
76 uint32_t event_counter
;
79 * On architectures with 64-bit aligned reads, both cpu_id and
80 * event_counter can be read with single-copy atomicity
87 * struct rseq is aligned on 2 * 8 bytes to ensure it is always
88 * contained within a single cache-line.
91 union rseq_cpu_event u
;
93 * Restartable sequences rseq_cs field.
94 * Contains NULL when no critical section is active for the
95 * current thread, or holds a pointer to the currently active
97 * Updated by user-space at the beginning and end of assembly
98 * instruction sequence block, and by the kernel when it
99 * restarts an assembly instruction sequence block. Read by the
100 * kernel with single-copy atomicity semantics. Aligned on
103 RSEQ_FIELD_u32_u64(rseq_cs
);
104 } __attribute__((aligned(2 * sizeof(uint64_t))));
106 #endif /* _UAPI_LINUX_RSEQ_H */
This page took 0.032351 seconds and 5 git commands to generate.