Iros
 
Loading...
Searching...
No Matches
address_space.h
Go to the documentation of this file.
1#pragma once
2
4#include "di/sync/prelude.h"
6#include "iris/core/error.h"
11#include "iris/mm/region.h"
13
14namespace iris::mm {
15class AddressSpace;
16
49
51 : public di::Synchronized<LockedAddressSpace, InterruptibleSpinlock>
52 , public di::IntrusiveRefCount<AddressSpace> {
53 friend class LockedAddressSpace;
54
55public:
56 AddressSpace() = default;
57
59
60 auto architecture_page_table_base() const -> PhysicalAddress { return m_architecture_page_table_base; }
61 void set_architecture_page_table_base(PhysicalAddress value) { m_architecture_page_table_base = value; }
62
63 void set_kernel() { m_kernel = true; }
64 auto is_kernel() const -> bool { return m_kernel; }
65
66 void load();
67
68 auto resident_pages() const -> u64 { return m_resident_pages.load(di::MemoryOrder::Relaxed); }
69 auto structure_pages() const -> u64 { return m_structure_pages.load(di::MemoryOrder::Relaxed); }
70
71 auto allocate_region(di::Arc<BackingObject> backing_object, usize page_aligned_length, RegionFlags flags)
73 auto allocate_region_at(di::Arc<BackingObject> backing_object, VirtualAddress location, usize page_aligned_length,
75
76private:
77 PhysicalAddress m_architecture_page_table_base { 0 };
78 di::Atomic<u64> m_resident_pages { 0 };
79 di::Atomic<u64> m_structure_pages { 0 };
80 bool m_kernel { false };
81};
82
84 VirtualAddress kernel_virtual_start,
85 PhysicalAddress max_physical_address) -> Expected<void>;
86
88}
Definition tree_set.h:24
Definition atomic.h:15
Definition synchronized.h:17
Definition box.h:28
Definition address_space.h:52
void set_architecture_page_table_base(PhysicalAddress value)
Definition address_space.h:61
auto allocate_region(di::Arc< BackingObject > backing_object, usize page_aligned_length, RegionFlags flags) -> Expected< VirtualAddress >
Definition address_space.cpp:88
auto structure_pages() const -> u64
Definition address_space.h:69
auto architecture_page_table_base() const -> PhysicalAddress
Definition address_space.h:60
auto resident_pages() const -> u64
Definition address_space.h:68
friend class LockedAddressSpace
Definition address_space.h:53
auto allocate_region_at(di::Arc< BackingObject > backing_object, VirtualAddress location, usize page_aligned_length, RegionFlags flags) -> Expected< void >
Definition address_space.cpp:94
auto is_kernel() const -> bool
Definition address_space.h:64
~AddressSpace()
Definition address_space.cpp:39
void set_kernel()
Definition address_space.h:63
void load()
Definition address_space.cpp:143
Definition address_space.h:17
auto base() -> AddressSpace &
Definition address_space.cpp:14
auto allocate_region_at(di::Arc< BackingObject > backing_object, di::Box< Region > region) -> Expected< void >
Definition address_space.cpp:62
void flush_tlb_global(VirtualAddress base)
Definition address_space.h:39
auto setup_physical_memory_map(PhysicalAddress start, PhysicalAddress end, VirtualAddress virtual_start) -> Expected< void >
Definition address_space.cpp:367
friend class AddressSpace
Definition address_space.h:45
auto bootstrap_kernel_page_tracking() -> Expected< void >
Definition address_space.cpp:436
auto remove_low_identity_mapping(VirtualAddress base, usize page_aligned_length) -> Expected< void >
Definition address_space.cpp:295
auto map_physical_page(VirtualAddress location, PhysicalAddress physical_address, RegionFlags flags) -> Expected< void >
Definition address_space.cpp:204
auto map_physical_page_early(VirtualAddress location, PhysicalAddress physical_address, RegionFlags flags) -> Expected< void >
Definition address_space.cpp:147
auto allocate_region(di::Arc< BackingObject > backing_object, di::Box< Region > region) -> Expected< VirtualAddress >
Definition address_space.cpp:19
auto setup_kernel_region(PhysicalAddress kernel_physical_start, VirtualAddress kernel_virtual_start, VirtualAddress kernel_virtual_end, RegionFlags flags) -> Expected< void >
Definition address_space.cpp:426
auto destroy_region(VirtualAddress base, usize length) -> Expected< void >
Definition address_space.cpp:61
auto create_low_identity_mapping(VirtualAddress base, usize page_aligned_length) -> Expected< void >
Definition address_space.cpp:286
size_t usize
Definition integers.h:33
__UINT64_TYPE__ u64
Definition integers.h:12
IntrusivePtr< T, ArcTag > Arc
Definition arc.h:21
constexpr auto end
Definition end.h:47
Definition address_space.cpp:20
auto init_and_load_initial_kernel_address_space(PhysicalAddress kernel_physical_start, VirtualAddress kernel_virtual_start, PhysicalAddress max_physical_address) -> Expected< void >
Definition address_space.cpp:100
auto create_empty_user_address_space() -> Expected< di::Arc< AddressSpace > >
Definition address_space.cpp:617
di::StrongInt< VirtualAddressTag > VirtualAddress
Definition virtual_address.h:25
RegionFlags
Definition region.h:9
di::StrongInt< PhysicalAddressTag > PhysicalAddress
Definition physical_address.h:12
constexpr auto physical_address
Definition physical_page.h:103
di::vocab::Expected< T, di::platform::GenericCode > Expected
Definition error.h:324
Definition arc.h:24