6export module zxfoundation.dgp.domain.core;
7import zxfoundation.dgp.domain.types;
8import zxfoundation.scoms.table;
9import zxfoundation.base.types;
14from_global(nomangle)
namespace zxfoundation::dgp::domain {
15 scoms::scoms_table<domain, MAX_DOMAINS> g_domain_table;
20namespace zxfoundation::dgp::domain {
23 auto strand_init()
noexcept ->
void;
29 [[nodiscard]]
auto idle_strand_create(u16 cpu)
noexcept
30 -> std::expected<strand*, lib::kernel_error>;
35 [[nodiscard]]
auto idle_strand_destroy(strand& s)
noexcept
36 -> std::expected<
void, lib::kernel_error>;
42 [[nodiscard]]
auto strand_create(
43 domain* owner, u16 cpu = 0
44 )
noexcept -> std::expected<strand*, lib::kernel_error>;
49 [[nodiscard]]
auto strand_destroy(strand& s)
noexcept -> std::expected<
void, lib::kernel_error>;
55 [[nodiscard]]
auto domain_create(
const char* name)
noexcept
56 -> std::expected<domain*, lib::kernel_error>;
61 [[nodiscard]]
auto domain_destroy(domain_id id)
noexcept
62 -> std::expected<
void, lib::kernel_error>;
68 [[nodiscard]]
auto domain_find(domain_id id)
noexcept -> domain*;
73 [[nodiscard]]
auto domain_activate(domain_id id)
noexcept
74 -> std::expected<
void, lib::kernel_error>;
77 [[nodiscard]]
auto domain_count()
noexcept -> u32;
83 template <
typename Fn>
84 auto domain_for_each(Fn&& fn)
noexcept -> u32 {
85 return g_domain_table.for_each(
static_cast<Fn&&>(fn));
88 auto register_domain_cap_lookup()
noexcept ->
void;
91 auto domain_init()
noexcept ->
void;
96 [[nodiscard]]
auto domain_nucleus()
noexcept -> domain*;
99 [[nodiscard]]
auto current_domain_or_nucleus()
noexcept -> domain*;
102 [[nodiscard]]
auto domain_init_nucleus()
noexcept
103 -> std::expected<
void, lib::kernel_error>;