5export module arch.s390x.trap.pgm.core;
6import arch.s390x.cpu.irq;
7import zxfoundation.base.types;
13namespace arch::s390x::trap::pgm {
15 constexpr u16 PGM_OPERATION = 0x0001;
16 constexpr u16 PGM_PRIVILEGED_OP = 0x0002;
17 constexpr u16 PGM_EXECUTE = 0x0003;
18 constexpr u16 PGM_PROTECTION = 0x0004;
19 constexpr u16 PGM_ADDRESSING = 0x0005;
20 constexpr u16 PGM_SPECIFICATION = 0x0006;
21 constexpr u16 PGM_DATA = 0x0007;
22 constexpr u16 PGM_FIXED_PT_DIVIDE = 0x0009;
23 constexpr u16 PGM_DECIMAL_DIVIDE = 0x000A;
24 constexpr u16 PGM_HFP_EXP_UNDERFLOW = 0x000B;
25 constexpr u16 PGM_HFP_EXP_OVERFLOW = 0x000C;
26 constexpr u16 PGM_HFP_SIGNIFICANCE = 0x000D;
27 constexpr u16 PGM_HFP_DIVIDE = 0x000E;
28 constexpr u16 PGM_SEGMENT_TRANS = 0x0010;
29 constexpr u16 PGM_PAGE_TRANS = 0x0011;
30 constexpr u16 PGM_SPECIAL_OPERATION = 0x0013;
31 constexpr u16 PGM_EX_TRANSLATION = 0x0023;
32 constexpr u16 PGM_LX_TRANSLATION = 0x0022;
33 constexpr u16 PGM_LFX_TRANSLATION = 0x0028;
34 constexpr u16 PGM_LSX_TRANSLATION = 0x0029;
35 constexpr u16 PGM_LFX_UNMAPPED = 0x002C;
36 constexpr u16 PGM_LSX_UNMAPPED = 0x002E;
37 constexpr u16 PGM_TRANSACTION_CONSTRAINT = 0x0218;
38 constexpr u16 PGM_TRANSACTION_ABORT = 0x0200;
39 constexpr u16 PGM_REGION_FIRST_TRANS = 0x0039;
40 constexpr u16 PGM_REGION_SECOND_TRANS= 0x003A;
41 constexpr u16 PGM_REGION_THIRD_TRANS = 0x003B;
42 constexpr u16 PGM_ASCE_TYPE = 0x0038;
43 constexpr u16 PGM_MONITOR = 0x0040;
44 constexpr u16 PGM_TRANSLATION_SPEC = 0x0012;
45 constexpr u16 PGM_FIXED_PT_OVERFLOW = 0x0008;
46 constexpr u16 PGM_HFP_SIGN_BIT = 0x000F;
47 constexpr u16 PGM_ALT_TRANSLATION = 0x0026;
48 constexpr u16 PGM_ALFX_TRANSLATION = 0x0027;
49 constexpr u16 PGM_ALFX_SUPER = 0x002A;
50 constexpr u16 PGM_STACK_OVERFLOW = 0x0035;
51 constexpr u16 PGM_AFX_TRANSLATION = 0x0020;
52 constexpr u16 PGM_ASX_TRANSLATION = 0x0021;
53 constexpr u16 PGM_EX_TRANSLATION_V = 0x0023;
54 constexpr u16 PGM_VECTOR_OP = 0x001C;
55 constexpr u16 PGM_VECTOR_EMAX = 0x001D;
56 constexpr u16 PGM_VECTOR_ENR = 0x001E;
57 constexpr u16 PGM_VECTOR_ERTE = 0x001F;
59 enum class vector_interruption_code : u8 {
60 ieee_invalid_operation = 0b0001,
61 ieee_division_by_zero = 0b0010,
62 ieee_overflow = 0b0011,
63 ieee_underflow = 0b0100,
64 ieee_inexact = 0b0101,
65 integer_divide = 0b1000,
68 using vector_exception_code = lib::record<u8, lib::msb0_t,
69 lib::rw<
"vix", lib::bits<0, 3>>,
70 lib::rw<
"vic", lib::bits<4, 7>, vector_interruption_code>
73 using vector_exception_code_view = lib::record_ref<u8, lib::msb0_t,
74 lib::rw<
"vix", lib::bits<0, 3>>,
75 lib::rw<
"vic", lib::bits<4, 7>, vector_interruption_code>
78 enum class data_exception_code : u8 {
79 general_operand = 0x00,
81 bfp_instruction = 0x02,
82 dfp_instruction = 0x03,
83 quantum_exception = 0x04,
84 simulated_quantum_exception = 0x07,
85 ieee_inexact_and_truncated = 0x08,
86 simulated_ieee_inexact = 0x0B,
87 ieee_inexact_and_incremented = 0x0C,
88 ieee_underflow_exact = 0x10,
89 simulated_ieee_underflow_exact = 0x13,
90 ieee_underflow_inexact_and_truncated = 0x18,
91 simulated_ieee_underflow_inexact = 0x1B,
92 ieee_underflow_inexact_and_incremented = 0x1C,
93 ieee_overflow_exact = 0x20,
94 simulated_ieee_overflow_exact = 0x23,
95 ieee_overflow_inexact_and_truncated = 0x28,
96 simulated_ieee_overflow_inexact = 0x2B,
97 ieee_overflow_inexact_and_incremented = 0x2C,
98 ieee_division_by_zero = 0x40,
99 simulated_ieee_division_by_zero = 0x43,
100 ieee_invalid_operation = 0x80,
101 simulated_ieee_invalid_operation = 0x83,
102 vector_instruction = 0xFE,
103 compare_and_trap_instruction = 0xFF,
105 enum class per_asce_type : u8 {
108 secondary_asce = 0b10,
112 using per_code = lib::record<u16, lib::msb0_t,
113 lib::rw<R"(per_code\successful_branching)", lib::bits<0, 0>>,
114 lib::rw<R"(per_code\instruction_fetching)", lib::bits<1, 1>>,
115 lib::rw<R"(per_code\storage_alter)", lib::bits<2, 2>>,
116 lib::rw<R"(per_code\storage_key_alter)", lib::bits<3, 3>>,
117 lib::rw<R"(per_code\store_using_real_addr)", lib::bits<4, 4>>,
118 lib::rw<R"(per_code\zero_addr_detection)", lib::bits<5, 5>>,
119 lib::rw<R"(per_code\transaction_end)", lib::bits<6, 6>>,
120 lib::rw<R"(per_code\inst_fetching_nullification)", lib::bits<7, 7>>,
121 lib::rw<R"(atmid\psw_bit_31)", lib::bits<8, 8>>,
122 lib::rw<R"(atmid\validity_bit)", lib::bits<9, 9>>,
123 lib::rw<R"(atmid\psw_bit_32)", lib::bits<10, 10>>,
124 lib::rw<R"(atmid\psw_bit_5)", lib::bits<11, 11>>,
125 lib::rw<R"(atmid\psw_bit_16)", lib::bits<12, 12>>,
126 lib::rw<R"(atmid\psw_bit_17)", lib::bits<13, 13>>,
127 lib::rw<
"per_asce_id", lib::bits<14, 15>, per_asce_type>
130 using per_code_view = lib::record_ref<u16, lib::msb0_t,
131 lib::rw<R"(per_code\successful_branching)", lib::bits<0, 0>>,
132 lib::rw<R"(per_code\instruction_fetching)", lib::bits<1, 1>>,
133 lib::rw<R"(per_code\storage_alter)", lib::bits<2, 2>>,
134 lib::rw<R"(per_code\storage_key_alter)", lib::bits<3, 3>>,
135 lib::rw<R"(per_code\store_using_real_addr)", lib::bits<4, 4>>,
136 lib::rw<R"(per_code\zero_addr_detection)", lib::bits<5, 5>>,
137 lib::rw<R"(per_code\transaction_end)", lib::bits<6, 6>>,
138 lib::rw<R"(per_code\inst_fetching_nullification)", lib::bits<7, 7>>,
139 lib::rw<R"(atmid\psw_bit_31)", lib::bits<8, 8>>,
140 lib::rw<R"(atmid\validity_bit)", lib::bits<9, 9>>,
141 lib::rw<R"(atmid\psw_bit_32)", lib::bits<10, 10>>,
142 lib::rw<R"(atmid\psw_bit_5)", lib::bits<11, 11>>,
143 lib::rw<R"(atmid\psw_bit_16)", lib::bits<12, 12>>,
144 lib::rw<R"(atmid\psw_bit_17)", lib::bits<13, 13>>,
145 lib::rw<
"per_asce_id", lib::bits<14, 15>, per_asce_type>
148 using eaid = lib::record<u8, lib::msb0_t,
149 lib::rw<
"access_register_num", lib::bits<4, 7>>
152 using eaid_view = lib::record_ref<u8, lib::msb0_t,
153 lib::rw<
"access_register_num", lib::bits<4, 7>>
156 using per_access_id = lib::record<u8, lib::msb0_t,
157 lib::rw<
"paid", lib::bits<4, 7>>
159 using per_access_id_view = lib::record_ref<u8, lib::msb0_t,
160 lib::rw<
"paid", lib::bits<4, 7>>
163 [[nodiscard]]
constexpr auto vxc_pgm_name_for(
const vector_exception_code vxc)
noexcept -> std::string_view;
164 [[nodiscard]]
constexpr auto dxc_pgm_name_for(
const u8 code)
noexcept -> std::string_view;
165 [[nodiscard]]
constexpr auto master_pgm_name_for(
const u16 code)
noexcept -> std::string_view;
168 auto handle(cpu::irq::irq_frame* frame)
noexcept ->
void;