blob: aa161ee21db5fc02a5ee9b13e295a4f39fad6292 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef TEACHOS_KAPI_MEMORY_PAGE_HPP
#define TEACHOS_KAPI_MEMORY_PAGE_HPP
// IWYU pragma: private, include "kapi/memory.hpp"
#include "kapi/memory/address.hpp"
#include "kapi/memory/chunk.hpp"
#include "kapi/memory/layout.hpp"
#include <cstddef>
namespace kapi::memory
{
//! @qualifier kernel-defined
//! A handle to a page of virtual memory.
//!
//! @note Contrary to the address types, this type is modeled using inheritance to support future extensions.
struct page : chunk<page, linear_address, page_size>
{
page() = default;
page(std::size_t number)
: chunk{number}
{}
//! Convert a base chunk into a page.
//!
//! This constructor allows for conversion from chunk<linear_address, PLATFORM_PAGE_SIZE> to a page for convenience.
//! It is deliberately not explicit.
constexpr page(chunk other)
: chunk{other}
{}
};
} // namespace kapi::memory
#endif
|