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

DGP memory-contract adapter types, constexpr policy helpers, and validation interface. More...

import std;
import lib.error;
import arch.s390x.mmu.consts;
import arch.s390x.mmu.types;
import zxfoundation.dgp.isolation.types;
import zxfoundation.base.types;
Include dependency graph for core.cxxm:

Data Structures

struct  zxfoundation::dgp::memory_contract::contract_request
 Memory request submitted to the clean-core contract. More...
struct  zxfoundation::dgp::memory_contract::contract_result
 DGP-authorized policy output attached to VM regions and DAT operations. More...

Enumerations

enum class  zxfoundation::dgp::memory_contract::invalidation_scope : u8 {
  none = 0 , local_cpu = 1 , address_space = 2 , single_page = 3 ,
  global = 4 , alb_global = 5
}
 Translation invalidation scope required by an authorized memory operation.
enum class  zxfoundation::dgp::memory_contract::memory_access : u32 {
  none = 0U , read = 1U << 0 , write = 1U << 1 , execute = 1U << 2 ,
  share = 1U << 3
}
 Access intent for a DGP-validated memory operation.
enum class  zxfoundation::dgp::memory_contract::memory_scope : u8 { private_domain = 0 , portal_shared = 1 , nucleus = 2 }
 Address-space scope affected by a memory operation.
enum class  zxfoundation::dgp::memory_contract::numa_policy : u8 { deterministic_fallback = 0 , strict_node = 1 , interleave = 2 }
 NUMA selection behavior for DGP memory policy.

Functions

auto zxfoundation::dgp::memory_contract::authorize_mapping (const contract_request &request) noexcept -> std::expected< contract_result, lib::kernel_error >
 Authorize creation of a VM mapping authority record.
auto zxfoundation::dgp::memory_contract::authorize_protect (const contract_request &request, arch::s390x::mmu::page_prot old_prot) noexcept -> std::expected< contract_result, lib::kernel_error >
 Authorize a VM protection change.
auto zxfoundation::dgp::memory_contract::authorize_unmap (const contract_request &request) noexcept -> std::expected< contract_result, lib::kernel_error >
 Authorize removal of a VM mapping authority record.
auto zxfoundation::dgp::memory_contract::contract_generation () noexcept -> u64
 Return the current DGP memory-policy generation.
auto zxfoundation::dgp::memory_contract::generation_bump () noexcept -> u64
 Advance the global memory-contract generation.
constexpr auto zxfoundation::dgp::memory_contract::is_page_aligned (u64 address) noexcept -> bool
 Test that an address is aligned to the DGP page size.
constexpr auto zxfoundation::dgp::memory_contract::memory_access_has (memory_access available, memory_access requested) noexcept -> bool
 Test whether a memory-access mask carries a requested bit.
constexpr auto zxfoundation::dgp::memory_contract::operator& (memory_access lhs, memory_access rhs) noexcept -> memory_access
 Intersect two memory access masks.
constexpr auto zxfoundation::dgp::memory_contract::operator| (memory_access lhs, memory_access rhs) noexcept -> memory_access
 Combine two memory access masks.
constexpr auto zxfoundation::dgp::memory_contract::required_rights (memory_access access, memory_scope scope) noexcept -> dgp::isolation::isolation_rights
 Translate an access mask into isolation rights required by the DGP policy plane.
auto zxfoundation::dgp::memory_contract::resolve_storage_key (u8 storage_key) noexcept -> std::expected< u8, lib::kernel_error >
 Resolve a storage key value for region metadata.
auto zxfoundation::dgp::memory_contract::validate_range (u64 va_start, u64 va_end) noexcept -> std::expected< void, lib::kernel_error >
 Validate a virtual address range before a VM or portal operation.
auto zxfoundation::dgp::memory_contract::validate_request (const contract_request &request) noexcept -> std::expected< void, lib::kernel_error >
 Validate a complete memory-contract request.
auto zxfoundation::dgp::memory_contract::validate_storage_key (u8 storage_key) noexcept -> std::expected< void, lib::kernel_error >
 Validate a storage key for a DGP memory request.

Detailed Description

DGP memory-contract adapter types, constexpr policy helpers, and validation interface.

SPDX-License-Identifier: Apache-2.0

Function Documentation

◆ authorize_mapping()

auto zxfoundation::dgp::memory_contract::authorize_mapping ( const contract_request & request) ->std::expected< contract_result, lib::kernel_error >
nodiscardexportnoexcept

Authorize creation of a VM mapping authority record.

Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request.
Returns
DGP policy metadata to store in the owning vm_region.
Note
The result records conservative invalidation needs; actual PTLB/IDTE/IPTE dispatch is wired in the DAT invalidation wave.
Warning
This function authorizes policy only; it does not allocate frames or install DAT entries.
Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request.
Returns
DGP policy metadata to store in the owning vm_region.

◆ authorize_protect()

auto zxfoundation::dgp::memory_contract::authorize_protect ( const contract_request & request,
arch::s390x::mmu::page_prot old_prot )->std::expected< contract_result, lib::kernel_error >
nodiscardexportnoexcept

Authorize a VM protection change.

Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request for the new protection.
[in]old_protPrevious hardware protection bits.
Returns
DGP policy metadata to store in affected VM regions.
Note
Any changed DAT protection is conservatively marked address-space scoped until CPU-ASCE attachment tracking is complete.
Warning
The caller must perform DAT invalidation before reusing frames or relaxing storage-key authority.
Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request for the new protection.
[in]old_protPrevious hardware protection bits.
Returns
DGP policy metadata to store in affected VM regions.

◆ authorize_unmap()

auto zxfoundation::dgp::memory_contract::authorize_unmap ( const contract_request & request) ->std::expected< contract_result, lib::kernel_error >
nodiscardexportnoexcept

Authorize removal of a VM mapping authority record.

Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request describing the removed range.
Returns
DGP policy metadata describing the required teardown authority.
Note
Physical frame, portal, storage-key, and DAT reuse must wait for the returned invalidation scope.
Warning
This function does not perform teardown; it only selects policy metadata.
Parameters
[in]requestComplete VM/DAT/storage-key/NUMA request describing the removed range.
Returns
DGP policy metadata describing the required teardown authority.

◆ is_page_aligned()

auto zxfoundation::dgp::memory_contract::is_page_aligned ( u64 address) ->bool
nodiscardconstexprexportnoexcept

Test that an address is aligned to the DGP page size.

Parameters
[in]addressAddress to check.
Returns
true when the low page-offset bits are zero.

◆ memory_access_has()

auto zxfoundation::dgp::memory_contract::memory_access_has ( memory_access available,
memory_access requested )->bool
nodiscardconstexprexportnoexcept

Test whether a memory-access mask carries a requested bit.

Parameters
[in]availableMemory-access mask to test.
[in]requestedRequested access bit or mask.
Returns
true when all requested access bits are present.

◆ operator&()

auto zxfoundation::dgp::memory_contract::operator& ( memory_access lhs,
memory_access rhs )->memory_access
nodiscardconstexprexportnoexcept

Intersect two memory access masks.

Parameters
[in]lhsLeft-hand access mask.
[in]rhsRight-hand access mask.
Returns
Common access mask.

◆ operator|()

auto zxfoundation::dgp::memory_contract::operator| ( memory_access lhs,
memory_access rhs )->memory_access
nodiscardconstexprexportnoexcept

Combine two memory access masks.

Parameters
[in]lhsLeft-hand access mask.
[in]rhsRight-hand access mask.
Returns
Combined access mask.

◆ required_rights()

auto zxfoundation::dgp::memory_contract::required_rights ( memory_access access,
memory_scope scope )->dgp::isolation::isolation_rights
nodiscardconstexprexportnoexcept

Translate an access mask into isolation rights required by the DGP policy plane.

Parameters
[in]accessRequested memory access mask.
[in]scopeAddress-space sharing scope.
Returns
Isolation rights required to authorize the request.

◆ resolve_storage_key()

auto zxfoundation::dgp::memory_contract::resolve_storage_key ( u8 storage_key) ->std::expected< u8, lib::kernel_error >
nodiscardexportnoexcept

Resolve a storage key value for region metadata.

Parameters
[in]storage_keyRequested storage key, or isolation::STORAGE_KEY_AUTO.
Returns
Concrete architected storage-key access-control value.
Parameters
[in]storage_keyRequested storage key, or STORAGE_KEY_AUTO.
Returns
Concrete architected storage-key access-control value.

◆ validate_range()

auto zxfoundation::dgp::memory_contract::validate_range ( u64 va_start,
u64 va_end )->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Validate a virtual address range before a VM or portal operation.

Parameters
[in]va_startFirst virtual address in the range.
[in]va_endExclusive end of the virtual range.
Returns
Success when the range is ordered, non-empty, and page-aligned.
Note
The contract checks generic range safety only; ownership and DAT effects are checked by later adapters.
Warning
Passing this check does not install or invalidate any DAT entry.
Parameters
[in]va_startFirst virtual address in the range.
[in]va_endExclusive end of the virtual range.
Returns
Success when the range is ordered, non-empty, and page-aligned.

◆ validate_request()

auto zxfoundation::dgp::memory_contract::validate_request ( const contract_request & request) ->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Validate a complete memory-contract request.

Parameters
[in]requestDGP memory request to validate.
Returns
Success when the generic range, length, and storage-key constraints are satisfied.
Note
Later migration waves will bind this request to VM regions, DAT permissions, NUMA zones, and TLB scope.
Warning
This adapter performs no allocation and installs no mapping.
Parameters
[in]requestDGP memory request to validate.
Returns
Success when the generic range, length, and storage-key constraints are satisfied.

◆ validate_storage_key()

auto zxfoundation::dgp::memory_contract::validate_storage_key ( u8 storage_key) ->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Validate a storage key for a DGP memory request.

Parameters
[in]storage_keyFour-bit access-control key value.
Returns
Success when the key is architecturally representable.
Note
The IBM PoP defines the storage-key access-control field as four bits.
Warning
This check does not allocate, reserve, or release a key.
Parameters
[in]storage_keyFour-bit access-control key value.
Returns
Success when the key is architecturally representable.