libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
PageDirectory.hh
Go to the documentation of this file.
1/*
2 * Copyright 2021 Assured Information Security, Inc.
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16#pragma once
17
18#ifdef __x86_64__
19
20#include <introvirt/core/fwd.hh>
22
23#include <cstdint>
24#include <memory>
25#include <mutex>
26#include <unordered_map>
27
28namespace introvirt {
29namespace x86 {
30
31class PageDirectory final {
32 public:
37 static constexpr uint64_t PAGE_SHIFT = 12;
38
42 static constexpr uint64_t PAGE_SIZE = (1ull << PAGE_SHIFT);
43
47 static constexpr uint64_t PAGE_MASK = (~(PAGE_SIZE - 1));
48
57 uint64_t translate(uint64_t virtual_address, uint64_t page_directory) const HOT;
58
62 void reconfigure(const Vcpu& vcpu);
63
69 PageDirectory(Domain& domain);
70
74 ~PageDirectory();
75
76 private:
77 Domain& domain_;
78
79 int pt_levels_ = 0;
80 int pte_size_ = 0;
81 uint64_t va_mask_ = 0;
82 uint64_t mask_ = 0;
83};
84
85} // namespace x86
86
87using PageDirectory = x86::PageDirectory;
88
89} // namespace introvirt
90
91#endif
#define HOT
Definition compiler.hh:34
Core IntroVirt classes.
Definition Cr0.hh:20
unique_ptr< Domain > domain
Definition vmcall_interface.cc:48