1 /*
2 * vim: filetype=c:tabstop=4:ai:expandtab
3 * SPDX-License-Identifier: ICU
4 * scspell-id: 4603a112-f62e-11ec-81f9-80ee73e9b8e7
5 *
6 * ---------------------------------------------------------------------------
7 *
8 * Copyright (c) 2007-2013 Michael Mondy
9 * Copyright (c) 2012-2016 Harry Reed
10 * Copyright (c) 2013-2016 Charles Anthony
11 * Copyright (c) 2021-2023 The DPS8M Development Team
12 *
13 * This software is made available under the terms of the ICU License.
14 * See the LICENSE.md file at the top-level directory of this distribution.
15 *
16 * ---------------------------------------------------------------------------
17 */
18
19 #if !defined(QUIET_UNUSED)
20 struct _fault_register {
21 // even word
22 bool ILL_OP; // IPR fault. An illegal operation code has been detected.
23 bool ILL_MOD; // IPR fault. An illegal address modifier has been detected.
24 bool ILL_SLV; // IPR fault. An illegal BAR mode procedure has been encountered.
25 bool ILL_PROC; // IPR fault. An illegal procedure other than the three above has been encountered.
26 bool NEM; // ONC fault. A nonexistent main memory address has been requested.
27 bool OOB; // STR fault. A BAR mode boundary violation has occurred.
28 bool ILL_DIG; // IPR fault. An illegal decimal digit or sign has been detected by the decimal unit.
29 bool PROC_PARU; // PAR fault. A parity error has been detected in the upper 36 bits of data. (Yeah, right)
30 bool PROC_PARL; // PAR fault. A parity error has been detected in the lower 36 bits of data. (Yeah, right)
31 bool CON_A; // CON fault. A $CONNECT signal has been received through port A.
32 bool CON_B; // CON fault. A $CONNECT signal has been received through port B.
33 bool CON_C; // CON fault. A $CONNECT signal has been received through port C.
34 bool CON_D; // CON fault. A $CONNECT signal has been received through port D.
35 bool DA_ERR; // ONC fault. Operation not complete. Processor/system controller interface
36 // sequence error 1 has been detected. (Yeah, right)
37 bool DA_ERR2; // ONC fault. Operation not completed. Processor/system controller interface
38 // sequence error 2 has been detected.
39 int IA_A; // Coded illegal action, port A. (See Table 3-2)
40 int IA_B; // Coded illegal action, port B. (See Table 3-2)
41 int IA_C; // Coded illegal action, port C. (See Table 3-2)
42 int IA_D; // Coded illegal action, port D. (See Table 3-2)
43 bool CPAR_DIV; // A parity error has been detected in the cache memory directory. (Not likely)
44 bool CPAR_STR; // PAR fault. A data parity error has been detected in the cache memory.
45 bool CPAR_IA; // PAR fault. An illegal action has been received from a system controller
46 // during a store operation with cache memory enabled.
47 bool CPAR_BLK; // PAR fault. A cache memory parity error has occurred during a cache memory data block load.
48
49 // odd word
50 // Cache Duplicate Directory WNO Buffer Overflow
51 bool PORT_A;
52 bool PORT_B;
53 bool PORT_C;
54 bool PORT_D;
55
56 bool CPD; // Cache Primary Directory WNO Buffer Overflow
57 // Write Notify (WNO) Parity Error on Port A, B, C, or D.
58
59 // Cache Duplicate Directory Parity Error
60 bool LEVEL_0;
61 bool LEVEL_1;
62 bool LEVEL_2;
63 bool LEVEL_3;
64
65 // Cache Duplicate Directory Multiple Match
66 bool CDD;
67
68 bool PAR_SDWAM; // A parity error has been detected in the SDWAM.
69 bool PAR_PTWAM; // A parity error has been detected in the PTWAM.
70 };
71
72 struct dps8faults
73 {
74 int fault_number;
75 int fault_address;
76 const char *fault_mnemonic;
77 const char *fault_name;
78 int fault_priority;
79 int fault_group;
80 };
81 typedef struct dps8faults dps8faults;
82 #endif /* if !defined(QUIET_UNUSED) */
83
84 extern char * faultNames [N_FAULTS];
85 void check_events (void);
86 void clearFaultCycle (cpu_state_t * cpup);
87 void emCallReportFault (void);
88
89 void cu_safe_restore (cpu_state_t * cpup);
90
91 NO_RETURN void doG7Fault(cpu_state_t * cpup, bool allowTR);
92
93 #if defined(NEED_128)
94 # define fst_zero (_fault_subtype) {.bits=0}
95 # define fst_acv9 (_fault_subtype) {.fault_acv_subtype=ACV9}
96 # define fst_acv15 (_fault_subtype) {.fault_acv_subtype=ACV15}
97 # define fst_ill_mod (_fault_subtype) {.fault_ipr_subtype=FR_ILL_MOD}
98 # define fst_ill_proc (_fault_subtype) {.fault_ipr_subtype=FR_ILL_PROC}
99 # define fst_ill_dig (_fault_subtype) {.fault_ipr_subtype=FR_ILL_DIG}
100 # define fst_ill_op (_fault_subtype) {.fault_ipr_subtype=FR_ILL_OP}
101 # define fst_str_oob (_fault_subtype) {.fault_str_subtype=flt_str_oob}
102 # define fst_str_nea (_fault_subtype) {.fault_str_subtype=flt_str_nea}
103 # define fst_str_ptr (_fault_subtype) {.fault_str_subtype=flt_str_ill_ptr}
104 # define fst_cmd_lprpn (_fault_subtype) {.fault_cmd_subtype=flt_cmd_lprpn_bits}
105 # define fst_cmd_ctl (_fault_subtype) {.fault_cmd_subtype=flt_cmd_not_control}
106 # define fst_onc_nem (_fault_subtype) {.fault_onc_subtype=flt_onc_nem}
107 #else
108 extern const _fault_subtype fst_zero;
109 extern const _fault_subtype fst_acv9;
110 extern const _fault_subtype fst_acv15;
111 extern const _fault_subtype fst_ill_mod;
112 extern const _fault_subtype fst_ill_proc;
113 extern const _fault_subtype fst_ill_dig;
114 extern const _fault_subtype fst_ill_op;
115 extern const _fault_subtype fst_str_oob;
116 extern const _fault_subtype fst_str_nea;
117 extern const _fault_subtype fst_str_ptr;
118 extern const _fault_subtype fst_cmd_lprpn;
119 extern const _fault_subtype fst_cmd_ctl;
120 extern const _fault_subtype fst_onc_nem;
121 #endif /* if defined(NEED_128) */
122
123 NO_RETURN void doFault (_fault faultNumber, _fault_subtype faultSubtype,
124 const char * faultMsg);
125 void dlyDoFault (_fault faultNumber, _fault_subtype subFault,
126 const char * faultMsg);
127 bool bG7PendingNoTRO (cpu_state_t * cpup);
128 bool bG7Pending (cpu_state_t * cpup);
129 void setG7fault (uint cpuNo, _fault faultNo);
130 //void doG7Fault (void);
131 void clearTROFault (cpu_state_t * cpup);
132 void advanceG7Faults (cpu_state_t * cpup);
133 void set_FFV_fault (cpu_state_t * cpup, uint f_fault_no);
134 void do_FFV_fault (cpu_state_t * cpup, uint fault_number, const char * fault_msg);