pdpte_x64.h
Go to the documentation of this file.
1 //
2 // Bareflank Hypervisor
3 //
4 // Copyright (C) 2015 Assured Information Security, Inc.
5 // Author: Rian Quinn <quinnr@ainfosec.com>
6 // Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #ifndef PDPTE_X64_H
23 #define PDPTE_X64_H
24 
25 #include <debug.h>
26 #include <bitmanip.h>
27 
28 // *INDENT-OFF*
29 
30 namespace x64
31 {
32 namespace pdpte
33 {
34  constexpr const auto name = "pdpte";
35 
36  namespace present
37  {
38  constexpr const auto mask = 0x0000000000000001UL;
39  constexpr const auto from = 0;
40  constexpr const auto name = "present";
41  }
42 
43  namespace reserved
44  {
45  constexpr const auto from = 0;
46  constexpr const auto name = "reserved";
47 
48  inline auto mask() noexcept
49  {
50  auto phys_len = cpuid::addr_size::phys::get();
51  return ((0xFFFFFFFFFFFFFFFFULL << phys_len) | 0x1E6ULL);
52  }
53  }
54 
55  namespace pwt
56  {
57  constexpr const auto mask = 0x0000000000000008UL;
58  constexpr const auto from = 3;
59  constexpr const auto name = "pwt";
60  }
61 
62  namespace pcd
63  {
64  constexpr const auto mask = 0x0000000000000010UL;
65  constexpr const auto from = 4;
66  constexpr const auto name = "pcd";
67  }
68 
69  namespace page_directory_addr
70  {
71  constexpr const auto from = 12;
72  constexpr const auto name = "page_directory_addr";
73 
74  inline auto mask() noexcept
75  {
76  auto phys_len = cpuid::addr_size::phys::get();
77  return (~(0xFFFFFFFFFFFFFFFFULL << phys_len) & (0xFFFFFFFFFFFFFFFFULL << from));
78  }
79  }
80 }
81 }
82 
83 // *INDENT-ON*
84 
85 #endif
constexpr const auto mask
Definition: pdpte_x64.h:57
auto mask() noexcept
Definition: pdpte_x64.h:48
constexpr const auto from
Definition: pdpte_x64.h:39
constexpr const auto from
Definition: pdpte_x64.h:65
constexpr const auto mask
Definition: pdpte_x64.h:64
void uint64_t uint64_t uint64_t *rdx noexcept
constexpr const auto name
Definition: pdpte_x64.h:34
constexpr const auto reserved
Definition: vcpuid.h:33
auto get() noexcept
Definition: cpuid_x64.h:89
Definition: cache_x64.h:31
constexpr const auto mask
Definition: pdpte_x64.h:38
constexpr const auto from
Definition: pdpte_x64.h:58
constexpr const auto from
Definition: pdpte_x64.h:45
constexpr const auto from
Definition: pdpte_x64.h:71