gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/test/syscalls/linux/rseq/uapi.h (about) 1 // Copyright 2019 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef GVISOR_TEST_SYSCALLS_LINUX_RSEQ_UAPI_H_ 16 #define GVISOR_TEST_SYSCALLS_LINUX_RSEQ_UAPI_H_ 17 18 #include <stdint.h> 19 20 // User-kernel ABI for restartable sequences. 21 22 // Syscall numbers. 23 #if defined(__x86_64__) 24 constexpr int kRseqSyscall = 334; 25 #elif defined(__aarch64__) 26 constexpr int kRseqSyscall = 293; 27 #else 28 #error "Unknown architecture" 29 #endif // __x86_64__ 30 31 struct rseq_cs { 32 uint32_t version; 33 uint32_t flags; 34 uint64_t start_ip; 35 uint64_t post_commit_offset; 36 uint64_t abort_ip; 37 } __attribute__((aligned(4 * sizeof(uint64_t)))); 38 39 // N.B. alignment is enforced by the kernel. 40 struct rseq { 41 uint32_t cpu_id_start; 42 uint32_t cpu_id; 43 struct rseq_cs* rseq_cs; 44 uint32_t flags; 45 } __attribute__((aligned(4 * sizeof(uint64_t)))); 46 47 constexpr int kRseqFlagUnregister = 1 << 0; 48 49 constexpr int kRseqCPUIDUninitialized = -1; 50 51 #endif // GVISOR_TEST_SYSCALLS_LINUX_RSEQ_UAPI_H_