1 | //===-- MemoryTagManagerAArch64MTE.h ----------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_MEMORYTAGMANAGERAARCH64MTE_H |
10 | #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_MEMORYTAGMANAGERAARCH64MTE_H |
11 | |
12 | #include "lldb/Target/MemoryTagManager.h" |
13 | |
14 | namespace lldb_private { |
15 | |
16 | class MemoryTagManagerAArch64MTE : public MemoryTagManager { |
17 | public: |
18 | // This enum is supposed to be shared for all of AArch64 but until |
19 | // there are more tag types than MTE, it will live here. |
20 | enum MTETagTypes { |
21 | eMTE_logical = 0, |
22 | eMTE_allocation = 1, |
23 | }; |
24 | |
25 | lldb::addr_t GetGranuleSize() const override; |
26 | int32_t GetAllocationTagType() const override; |
27 | size_t GetTagSizeInBytes() const override; |
28 | |
29 | lldb::addr_t GetLogicalTag(lldb::addr_t addr) const override; |
30 | lldb::addr_t RemoveTagBits(lldb::addr_t addr) const override; |
31 | ptrdiff_t AddressDiff(lldb::addr_t addr1, lldb::addr_t addr2) const override; |
32 | |
33 | TagRange ExpandToGranule(TagRange range) const override; |
34 | |
35 | llvm::Expected<TagRange> MakeTaggedRange( |
36 | lldb::addr_t addr, lldb::addr_t end_addr, |
37 | const lldb_private::MemoryRegionInfos &memory_regions) const override; |
38 | |
39 | llvm::Expected<std::vector<TagRange>> MakeTaggedRanges( |
40 | lldb::addr_t addr, lldb::addr_t end_addr, |
41 | const lldb_private::MemoryRegionInfos &memory_regions) const override; |
42 | |
43 | llvm::Expected<std::vector<lldb::addr_t>> |
44 | UnpackTagsData(const std::vector<uint8_t> &tags, |
45 | size_t granules = 0) const override; |
46 | |
47 | std::vector<lldb::addr_t> |
48 | UnpackTagsFromCoreFileSegment(CoreReaderFn reader, |
49 | lldb::addr_t tag_segment_virtual_address, |
50 | lldb::addr_t tag_segment_data_address, |
51 | lldb::addr_t addr, size_t len) const override; |
52 | |
53 | llvm::Expected<std::vector<uint8_t>> |
54 | PackTags(const std::vector<lldb::addr_t> &tags) const override; |
55 | |
56 | llvm::Expected<std::vector<lldb::addr_t>> |
57 | RepeatTagsForRange(const std::vector<lldb::addr_t> &tags, |
58 | TagRange range) const override; |
59 | }; |
60 | |
61 | } // namespace lldb_private |
62 | |
63 | #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_MEMORYTAGMANAGERAARCH64MTE_H |
64 | |