[Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
[llvm-project.git] / compiler-rt / lib / scudo / standalone / mem_map_linux.h
blob7a89b3bff5ed19d893d3b7c63c8b2dfd1aa6077f
1 //===-- mem_map_linux.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 //===----------------------------------------------------------------------===//
9 #ifndef SCUDO_MEM_MAP_LINUX_H_
10 #define SCUDO_MEM_MAP_LINUX_H_
12 #include "platform.h"
14 #if SCUDO_LINUX
16 #include "common.h"
17 #include "mem_map_base.h"
19 namespace scudo {
21 class MemMapLinux final : public MemMapBase<MemMapLinux> {
22 public:
23 constexpr MemMapLinux() = default;
24 MemMapLinux(uptr Base, uptr Capacity)
25 : MapBase(Base), MapCapacity(Capacity) {}
27 // Impls for base functions.
28 bool mapImpl(uptr Addr, uptr Size, const char *Name, uptr Flags = 0);
29 void unmapImpl(uptr Addr, uptr Size);
30 bool remapImpl(uptr Addr, uptr Size, const char *Name, uptr Flags = 0);
31 void setMemoryPermissionImpl(uptr Addr, uptr Size, uptr Flags);
32 void releasePagesToOSImpl(uptr From, uptr Size) {
33 return releaseAndZeroPagesToOSImpl(From, Size);
35 void releaseAndZeroPagesToOSImpl(uptr From, uptr Size);
36 uptr getBaseImpl() { return MapBase; }
37 uptr getCapacityImpl() { return MapCapacity; }
39 private:
40 uptr MapBase = 0;
41 uptr MapCapacity = 0;
44 // This will be deprecated when every allocator has been supported by each
45 // platform's `MemMap` implementation.
46 class ReservedMemoryLinux final
47 : public ReservedMemory<ReservedMemoryLinux, MemMapLinux> {
48 public:
49 // The following two are the Impls for function in `MemMapBase`.
50 uptr getBaseImpl() { return MapBase; }
51 uptr getCapacityImpl() { return MapCapacity; }
53 // These threes are specific to `ReservedMemory`.
54 bool createImpl(uptr Addr, uptr Size, const char *Name, uptr Flags);
55 void releaseImpl();
56 MemMapT dispatchImpl(uptr Addr, uptr Size);
58 private:
59 uptr MapBase = 0;
60 uptr MapCapacity = 0;
63 } // namespace scudo
65 #endif // SCUDO_LINUX
67 #endif // SCUDO_MEM_MAP_LINUX_H_