libintrovirt v0.57.4
IntroVirt introspection library
Loading...
Searching...
No Matches
GuestMemoryMapping.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
19
20#include <cstdint>
21
22namespace introvirt {
23
34class GuestMemoryMapping final {
35 public:
41 void* get() { return mapping_; }
42
48 const void* get() const { return mapping_; }
49
55 unsigned int length() const { return length_; }
56
60 GuestMemoryMapping() : mapping_(nullptr), length_(0) {}
61
68 GuestMemoryMapping(void* mapping, unsigned int length) : mapping_(mapping), length_(length) {}
69
74
79
84
89
95
96 private:
97 void* mapping_;
98 std::size_t length_;
99};
100
101} // namespace introvirt
A mapping of guest memory.
Definition GuestMemoryMapping.hh:34
GuestMemoryMapping(GuestMemoryMapping &&) noexcept
Move constructor.
const void * get() const
Get the raw memory mapping.
Definition GuestMemoryMapping.hh:48
void * get()
Get the raw memory mapping.
Definition GuestMemoryMapping.hh:41
GuestMemoryMapping(void *mapping, unsigned int length)
Construct a GuestMemoryMapping.
Definition GuestMemoryMapping.hh:68
GuestMemoryMapping()
Construct a "null" GuestMemoryMapping.
Definition GuestMemoryMapping.hh:60
GuestMemoryMapping & operator=(const GuestMemoryMapping &)=delete
Copy assignment operator.
GuestMemoryMapping(const GuestMemoryMapping &)=delete
Copy constructor.
unsigned int length() const
Returns the number of bytes that are mapped.
Definition GuestMemoryMapping.hh:55
#define HOT
Definition compiler.hh:34
Core IntroVirt classes.
Definition Cr0.hh:20