5export module zxfoundation.sched.core;
6import zxfoundation.sched.policy;
7import zxfoundation.dgp.domain.types;
8import zxfoundation.base.types;
9import zxfoundation.sys.timer.types;
10import zxfoundation.sched.rq.types;
11import arch.s390x.cpu.irq;
15using zxfoundation::dgp::domain::domain;
16using zxfoundation::dgp::domain::strand;
17using zxfoundation::sched::rq::run_queue;
21namespace zxfoundation::sched {
23 [[nodiscard]]
auto cpu_timer(u16 cpu_id)
noexcept -> zxfoundation::sys::timer::kernel_timer&;
24 [[nodiscard]]
auto cpu_rq(u16 cpu_id)
noexcept -> run_queue&;
25 [[nodiscard]]
auto this_rq()
noexcept -> run_queue&;
27 declscope(C)
auto __switch_to_asm(
30 )
noexcept -> domain*;
32 auto enqueue_strand(strand* s)
noexcept ->
void;
33 auto dequeue_strand(strand* s)
noexcept ->
void;
34 auto enqueue_domain(domain* d)
noexcept ->
void;
35 auto dequeue_domain(domain* d)
noexcept ->
void;
41 [[nodiscard]]
auto strand_admit_policy(
43 const zxfoundation::sched::sched_policy& policy
44 )
noexcept -> std::expected<zxfoundation::sched::sched_admission_result, lib::kernel_error>;
53 [[nodiscard]]
auto strand_spawn(
54 const zxfoundation::dgp::domain::strand_create_request& request
55 )
noexcept -> std::expected<zxfoundation::dgp::domain::strand*, lib::kernel_error>;
60 [[nodiscard]]
auto quiesce_domain(domain& d)
noexcept
61 -> std::expected<
void, lib::kernel_error>;
63 auto schedule()
noexcept ->
void;
64 [[noreturn]]
auto strand_trampoline_exit()
noexcept ->
void;
67 auto cpu_timer_tick()
noexcept ->
void;
70 auto irq_handler_cpu_timer(
72 arch::s390x::cpu::irq::irq_frame* frame,
77 auto scheduler_tick()
noexcept ->
void;
79 [[nodiscard]]
auto need_resched()
noexcept ->
bool;
82 auto sched_resched_current()
noexcept ->
void;
84 auto preempt_schedule()
noexcept ->
void;
86 [[nodiscard]]
auto sched_active()
noexcept ->
bool;
88 auto sched_init()
noexcept ->
void;
89 auto sched_init_ap(u16 cpu_id)
noexcept ->
void;
91 [[noreturn]]
auto idle_enter()
noexcept ->
void;
94 [[nodiscard]]
auto cpu_up(u16 cpu_id)
noexcept -> ::std::expected<
void, ::lib::kernel_error>;
99 [[nodiscard]]
auto cpu_down(u16 cpu_id)
noexcept -> ::std::expected<
void, ::lib::kernel_error>;