2 * Copyright (C) 2015 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef SIMPLE_PERF_PERF_REGS_H_
18 #define SIMPLE_PERF_PERF_REGS_H_
20 #if defined(USE_BIONIC_UAPI_HEADERS)
21 #include <uapi/asm-x86/asm/perf_regs.h>
22 #include <uapi/asm-arm/asm/perf_regs.h>
23 #define perf_event_arm_regs perf_event_arm64_regs
24 #include <uapi/asm-arm64/asm/perf_regs.h>
26 #include <asm-x86/asm/perf_regs.h>
27 #include <asm-arm/asm/perf_regs.h>
28 #define perf_event_arm_regs perf_event_arm64_regs
29 #include <asm-arm64/asm/perf_regs.h>
44 constexpr ArchType GetBuildArch() {
47 #elif defined(__x86_64__)
49 #elif defined(__aarch64__)
51 #elif defined(__arm__)
54 return ARCH_UNSUPPORTED;
58 ArchType GetCurrentArch();
59 bool SetCurrentArch(const std::string& arch);
61 uint64_t GetSupportedRegMask();
63 std::string GetRegName(size_t regno);
70 RegSet CreateRegSet(uint64_t valid_mask, const std::vector<uint64_t>& valid_regs);
72 bool GetRegValue(const RegSet& regs, size_t regno, uint64_t* value);
73 bool GetSpRegValue(const RegSet& regs, uint64_t* value);
75 #endif // SIMPLE_PERF_PERF_REGS_H_