5export module arch.s390x.cpu.irq;
6import zxfoundation.base.types;
12namespace arch::s390x::cpu::irq {
15 constexpr u32 IRQ_FRAME_GPRS = 0x00U;
18 constexpr u32 IRQ_FRAME_PSW_MASK = 0x80U;
21 constexpr u32 IRQ_FRAME_PSW_ADDR = 0x88U;
24 constexpr u32 IRQ_FRAME_ARS = 0x90U;
27 constexpr u32 IRQ_FRAME_FPC = 0xD0U;
30 constexpr u32 IRQ_FRAME_VRS = 0xD8U;
34 constexpr u32 IRQ_FRAME_SIZE = 0x02D8U;
36 constexpr u64 IRQ_RESTORE_MASK_LC = 0x0200UL;
39 struct [[gnu::packed]]
alignas(8) irq_frame {
43 u32 access_regs[16]{};
46 u64 vector_regs_lo[16][2]{};
47 u64 vector_regs_hi[16][2]{};
50 static_assert(
sizeof(irq_frame) == IRQ_FRAME_SIZE,
51 "arch_s390x_irq_frame size must be IRQ_FRAME_SIZE (0x2D8 = 728 bytes)");
52 static_assert(
__builtin_offsetof(irq_frame, psw_mask) == IRQ_FRAME_PSW_MASK,
53 "IRQ_FRAME_PSW_MASK offset mismatch");
54 static_assert(
__builtin_offsetof(irq_frame, psw_addr) == IRQ_FRAME_PSW_ADDR,
55 "IRQ_FRAME_PSW_ADDR offset mismatch");
56 static_assert(
__builtin_offsetof(irq_frame, access_regs) == IRQ_FRAME_ARS,
57 "IRQ_FRAME_ARS offset mismatch");
58 static_assert(
__builtin_offsetof(irq_frame, fpc) == IRQ_FRAME_FPC,
59 "IRQ_FRAME_FPC offset mismatch");
60 static_assert(
__builtin_offsetof(irq_frame, vector_regs_lo) == IRQ_FRAME_VRS,
61 "IRQ_FRAME_VRS offset mismatch for vector_regs_lo");
62 static_assert(
__builtin_offsetof(irq_frame, vector_regs_hi) == IRQ_FRAME_VRS + 256,
63 "IRQ_FRAME_VRS + 256 offset mismatch for vector_regs_hi");
70 ZX_IRQ_CLASS_MCCK = 3,
74 [[gnu::no_stack_protector]]
auto irq_restore_mask_byte(u8 byte0)
noexcept ->
void;
76 [[gnu::no_stack_protector]] [[nodiscard]]
auto irq_save_disable()
noexcept -> irqflags;
79 [[gnu::no_stack_protector]]
auto irq_restore(irqflags flags)
noexcept ->
void;
81 auto irq_disable()
noexcept ->
void;
83 auto irq_enable()
noexcept ->
void;
85 [[nodiscard]]
auto irqs_enabled()
noexcept ->
bool;