[Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
[llvm-project.git] / compiler-rt / lib / scudo / standalone / mem_map_fuchsia.h
blob2e66f89cfca55a6db76d80a1b098e446d38c26e3
1 //===-- mem_map_fuchsia.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_FUCHSIA_H_
10 #define SCUDO_MEM_MAP_FUCHSIA_H_
12 #include "mem_map_base.h"
14 #if SCUDO_FUCHSIA
16 #include <stdint.h>
17 #include <zircon/types.h>
19 namespace scudo {
21 class MemMapFuchsia final : public MemMapBase<MemMapFuchsia> {
22 public:
23 constexpr MemMapFuchsia() = default;
25 // Impls for base functions.
26 bool mapImpl(uptr Addr, uptr Size, const char *Name, uptr Flags);
27 void unmapImpl(uptr Addr, uptr Size);
28 bool remapImpl(uptr Addr, uptr Size, const char *Name, uptr Flags);
29 void setMemoryPermissionImpl(uptr Addr, uptr Size, uptr Flags);
30 void releasePagesToOSImpl(uptr From, uptr Size) {
31 return releaseAndZeroPagesToOSImpl(From, Size);
33 void releaseAndZeroPagesToOSImpl(uptr From, uptr Size);
34 uptr getBaseImpl() { return WindowBase; }
35 uptr getCapacityImpl() { return WindowSize; }
37 private:
38 friend class ReservedMemoryFuchsia;
40 // Used by ReservedMemoryFuchsia::dispatch.
41 MemMapFuchsia(uptr Base, uptr Capacity);
43 // Virtual memory address corresponding to VMO offset 0.
44 uptr MapAddr = 0;
46 // Virtual memory base address and size of the VMO subrange that is still in
47 // use. unmapImpl() can shrink this range, either at the beginning or at the
48 // end.
49 uptr WindowBase = 0;
50 uptr WindowSize = 0;
52 zx_handle_t Vmo = ZX_HANDLE_INVALID;
55 class ReservedMemoryFuchsia final
56 : public ReservedMemory<ReservedMemoryFuchsia, MemMapFuchsia> {
57 public:
58 constexpr ReservedMemoryFuchsia() = default;
60 bool createImpl(uptr Addr, uptr Size, const char *Name, uptr Flags);
61 void releaseImpl();
62 MemMapT dispatchImpl(uptr Addr, uptr Size);
63 uptr getBaseImpl() { return Base; }
64 uptr getCapacityImpl() { return Capacity; }
66 private:
67 uptr Base = 0;
68 uptr Capacity = 0;
71 } // namespace scudo
73 #endif // SCUDO_FUCHSIA
75 #endif // SCUDO_MEM_MAP_FUCHSIA_H_