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/sched/strandctx.zcomponent/core.cxxm
3/// @brief Strand context setup and user-mode first-entry trampolines.
4
5export module zxfoundation.sched.strandctx.core;
6import zxfoundation.dgp.domain.types;
7import zxfoundation.base.types;
8import arch.s390x.sched.types;
9
10using zxfoundation::dgp::domain::domain;
11using zxfoundation::dgp::domain::strand;
12
13export {
14
15namespace zxfoundation::sched::strandctx {
16
17 /// @brief Kernel-thread entry function type
18 using strand_entry_fn = auto (*)(void*) noexcept -> void;
19
20 /// @brief Set up the initial kernel stack frame for a strand so that the
21 /// @param s Target strand with valid @c kstack_top
22 /// @param entry Non-null kernel entry function
23 /// @param arg Opaque argument passed to @c entry in r2
24 auto setup_strand_context_kernel_thread(
25 strand* s,
26 strand_entry_fn entry,
27 void* arg
28 ) noexcept -> void;
29
30 /// @brief Set up the initial kernel stack frame for a strand whose first
31 /// context switch performs an @c LPSWE into user mode.
32 /// @param s Target strand with valid @c kstack_top and @c body->uregs
33 /// already populated
34 /// @param uregs Pointer to the user_regs snapshot
35 /// @param owner The owning domain, used for ASC normalization and DGP
36 /// isolation validation.
37 auto setup_strand_context_user(
38 strand* s,
39 const arch::s390x::sched::user_regs* uregs,
40 const domain* owner
41 ) noexcept -> void;
42
43 /// @brief Convenience wrapper — kernel-thread first-switch for the
44 /// primary strand of a domain.
45 auto setup_primary_strand_context(
46 domain* d,
47 strand_entry_fn entry,
48 void* arg
49 ) noexcept -> void;
50
51 /// @brief Convenience wrapper — user-process first-switch for the
52 /// primary strand of a domain.
53 auto setup_primary_strand_context_user(
54 domain* d
55 ) noexcept -> void;
56
57 /// @brief Enter user mode for a domain at runtime
58 /// @param s Strand with valid @c body->uregs; domain accessed via @c s->owner.
59 [[noreturn]] auto domain_enter_user(strand* s) noexcept -> void;
60
61 /// @brief Overload taking @c domain* for backward compatibility.
62 [[noreturn]] auto domain_enter_user(domain* d) noexcept -> void;
63
64} // namespace zxfoundation::sched::strandctx
65
66} // end export