ZXFoundation™ 26h2
Loading...
Searching...
No Matches
core.cxxm
Go to the documentation of this file.
1/// SPDX-License-Identifier: Apache-2.0
2/// @file zxfoundation/dgp/gate.zcomponent/core.cxxm
3/// @brief Gate subsystem core — gate lifecycle declarations.
4
5export module zxfoundation.dgp.gate.core;
6import zxfoundation.dgp.gate.types;
7import zxfoundation.base.types;
8import lib.error;
9import std;
10
11export {
12
13namespace zxfoundation::dgp::gate {
14
15 /// @brief Create a new gate descriptor.
16 /// @param type Gate type (nucleus or domain).
17 /// @param auth Authorization policy.
18 /// @param target_domain_id Target domain ID.
19 /// @param entry_va Entry-point virtual address in the target domain.
20 /// @param target_key Storage key of the target domain.
21 /// @return The allocated slot ID, or an error if the table is full.
22 auto gate_create(
23 gate_type type,
24 gate_auth auth,
25 u32 target_domain_id,
26 u64 entry_va,
27 u8 target_key
28 ) noexcept -> std::expected<u32, lib::kernel_error>;
29
30 /// @brief Destroy a gate, freeing its slot.
31 /// @param id The gate slot ID to destroy.
32 /// @return Success, or an error if the id is invalid or already free.
33 auto gate_destroy(u32 id) noexcept
34 -> std::expected<void, lib::kernel_error>;
35
36 /// @brief Destroy all gates owned by a specific domain.
37 /// @param domain_id The domain whose gates should be destroyed.
38 auto destroy_for_domain(u32 domain_id) noexcept -> void;
39
40 /// @brief Look up a gate descriptor by id.
41 /// @param id The gate slot ID to look up.
42 /// @return Pointer to the gate_desc, or nullptr if the id is invalid
43 /// or the slot is unused.
44 auto gate_find(u32 id) noexcept -> gate_desc*;
45
46 auto register_gate_cap_lookup() noexcept -> void;
47
48 /// @brief Initialize the gate subsystem.
49 auto gate_init() noexcept -> void;
50
51 /// @brief Return the current number of active gates.
52 auto gate_count() noexcept -> u32;
53
54} // namespace zxfoundation::dgp::gate
55
56} // end export