ZXFoundation™ 26h2
Loading...
Searching...
No Matches
core.cxx File Reference

Reverse-map (rmap) implementation — implementation. More...

import std;
import lib.error;
import zxfoundation.memory.rmap.types;
import zxfoundation.memory.pmm.types;
import zxfoundation.sync.qspinlock.core;
import zxfoundation.memory.pmm;
import zxfoundation.memory.vm.types;
import arch.s390x.cpu.skey;
import zxfoundation.memory.kmalloc;
import zxfoundation.base.types;
import zxfoundation.memory.hhdm;
import zxfoundation.memory.page_cache;
import arch.s390x.mmu.core;
import arch.s390x.mmu.tlb;
import zxfoundation.sync.lockable;
Include dependency graph for core.cxx:

Functions

auto zxfoundation::memory::rmap::collect_peers (u64 phys, vm::vm_region &self, u32 self_slot, peer_ref *out, u32 cap) noexcept -> u32
 Collect rmap identities without dereferencing VM page slots.
auto zxfoundation::memory::rmap::count_refs (u64 phys) noexcept -> u32
 Count how many VMA slots currently reference phys.
auto zxfoundation::memory::rmap::for_each_phys (u64 phys, visitor visit) noexcept -> u32
 Walk every VMA slot that references phys.
no_export auto zxfoundation::memory::rmap::detail::head_for_pfn (u64 pfn) noexcept -> entry *&
auto zxfoundation::memory::rmap::init (u64 max_pfn) noexcept -> std::expected< void, lib::kernel_error >
 Allocate the reverse-map heads for max_pfn frames.
auto zxfoundation::memory::rmap::insert (vm::vm_region &rgn, u32 slot_index, u64 phys) noexcept -> std::expected< void, lib::kernel_error >
 Insert a reverse-map link: "slot @p slot_index in @p rgn maps @p phys".
auto zxfoundation::memory::rmap::invalidate_peers (u64 phys, vm::vm_region &self, u32 self_slot) noexcept -> std::expected< peer_invalidation_result, lib::kernel_error >
 Invalidate every peer mapping of phys except self.
no_export auto zxfoundation::memory::rmap::detail::pfn_of (u64 phys) noexcept -> u64
auto zxfoundation::memory::rmap::rebind (vm::vm_region &from, u32 from_slot, vm::vm_region &to, u32 to_slot, u64 phys) noexcept -> bool
 Rebind an existing rmap entry after a VMA split without allocating.
auto zxfoundation::memory::rmap::release_slot_pin (vm::vm_page_slot &slot) noexcept -> std::expected< bool, lib::kernel_error >
auto zxfoundation::memory::rmap::remove (vm::vm_region &rgn, u32 slot_index, u64 phys) noexcept -> void
 Remove the link matching (rgn, slot_index, phys).
no_export auto zxfoundation::memory::rmap::detail::stripe_of (u64 pfn) noexcept -> u32
 Stripe index for a PFN.

Variables

no_export u64 zxfoundation::memory::rmap::detail::g_chunk_count {0}
no_export u64 zxfoundation::memory::rmap::detail::g_max_pfn {0}
no_export std::array< entry **, RMAP_MAX_CHUNKS > zxfoundation::memory::rmap::detail::g_rmap_chunks {}
no_export std::array< sync::qspinlock::qspinlock, RMAP_LOCK_STRIPEzxfoundation::memory::rmap::detail::g_rmap_locks {}
no_export constexpr u32 zxfoundation::memory::rmap::detail::RMAP_CHUNK_ORDER = 3U
no_export constexpr u64 zxfoundation::memory::rmap::detail::RMAP_ENTRIES_PER_CHUNK
no_export constexpr u64 zxfoundation::memory::rmap::detail::RMAP_MAX_CHUNKS

Detailed Description

Reverse-map (rmap) implementation — implementation.

SPDX-License-Identifier: Apache-2.0

Function Documentation

◆ invalidate_peers()

auto zxfoundation::memory::rmap::invalidate_peers ( u64 phys,
vm::vm_region & self,
u32 self_slot )->std::expected< peer_invalidation_result, lib::kernel_error >
exportnoexcept

Invalidate every peer mapping of phys except self.

Precondition
Caller holds self.owning_space->lock when self has an owning space.

◆ rebind()

auto zxfoundation::memory::rmap::rebind ( vm::vm_region & from,
u32 from_slot,
vm::vm_region & to,
u32 to_slot,
u64 phys )->bool
nodiscardexportnoexcept

Rebind an existing rmap entry after a VMA split without allocating.

Returns
false when the old entry was absent or did not match.

Variable Documentation

◆ RMAP_ENTRIES_PER_CHUNK

no_export constexpr u64 zxfoundation::memory::rmap::detail::RMAP_ENTRIES_PER_CHUNK
constexpr
Initial value:
=
(static_cast<u64>(PAGE_SIZE) << RMAP_CHUNK_ORDER) / sizeof(entry*)
One reverse-map entry: identifies a single VMA slot that maps a given physical frame.
Definition types.cxxm:35

◆ RMAP_MAX_CHUNKS

no_export constexpr u64 zxfoundation::memory::rmap::detail::RMAP_MAX_CHUNKS
constexpr
Initial value:
=
(pmm::MAX_FRAMES + RMAP_ENTRIES_PER_CHUNK - 1U) / RMAP_ENTRIES_PER_CHUNK