NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
PPCArch.h
1#ifndef RVL_SDK_PPC_ARCH_H
2#define RVL_SDK_PPC_ARCH_H
3#include <types.h>
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8u32 PPCMfmsr(void);
9void PPCMtmsr(u32 val);
10
11u32 PPCMfhid0(void);
12void PPCMthid0(u32 val);
13
14u32 PPCMfl2cr(void);
15void PPCMtl2cr(u32 val);
16
17void PPCMtdec(u32 val);
18
19void PPCSync(void);
20void PPCHalt(void);
21
22void PPCMtmmcr0(u32 val);
23void PPCMtmmcr1(u32 val);
24
25void PPCMtpmc1(u32 val);
26void PPCMtpmc2(u32 val);
27void PPCMtpmc3(u32 val);
28void PPCMtpmc4(u32 val);
29
30u32 PPCMffpscr(void);
31void PPCMtfpscr(u32 val);
32
33u32 PPCMfhid2(void);
34void PPCMthid2(u32 val);
35
36u32 PPCMfwpar(void);
37void PPCMtwpar(u32 val);
38
39void PPCDisableSpeculation(void);
40void PPCSetFpNonIEEEMode(void);
41
42void PPCMthid4(u32 val);
43
44#ifdef __cplusplus
45}
46#endif
47#endif
48
49/**
50 * MSR
51 * Machine Status Register
52 */
53// Power management enable
54#define MSR_POW (1 << (31 - 13))
55// Exception little-endian mode
56#define MSR_ILE (1 << (31 - 15))
57// External interrupt enable
58#define MSR_EE (1 << (31 - 16))
59// Privilege level
60#define MSR_PR (1 << (31 - 17))
61// Floating-point available
62#define MSR_FP (1 << (31 - 18))
63// Machine check enable
64#define MSR_ME (1 << (31 - 19))
65// IEEE floating-point exception mode 0
66#define MSR_FE0 (1 << (31 - 20))
67// Single-step trace enable
68#define MSR_SE (1 << (31 - 21))
69// Branch trace enable
70#define MSR_BE (1 << (31 - 22))
71// IEEE floating-point exception mode 1
72#define MSR_FE1 (1 << (31 - 23))
73// Exception prefix
74#define MSR_IP (1 << (31 - 25))
75// Instruction address translation
76#define MSR_IR (1 << (31 - 26))
77// Data address translation
78#define MSR_DR (1 << (31 - 27))
79// Performance monitor marked mode
80#define MSR_PM (1 << (31 - 29))
81// Indicates whether system reset or machine check exception is recoverable
82#define MSR_RI (1 << (31 - 30))
83// Little-endian mode enable
84#define MSR_LE (1 << (31 - 31))
85
86/**
87 * HID0
88 * Hardware Implementation-Dependent Register 0
89 */
90// Enable MCP
91#define HID0_EMCP (1 << (31 - 0))
92// Enable/disable 60x bus address and data parity generation
93#define HID0_DBP (1 << (31 - 1))
94// Enable/disable 60x bus address parity checking
95#define HID0_EBA (1 << (31 - 2))
96// Enable 60x bus data parity checking
97#define HID0_EBD (1 << (31 - 3))
98// CLK_OUT enable
99#define HID0_BCLK (1 << (31 - 4))
100// CLK_OUT enable
101#define HID0_ECLK (1 << (31 - 6))
102// Disable precharge of ARTRY
103#define HID0_PAR (1 << (31 - 7))
104// Doze mode enable
105#define HID0_DOZE (1 << (31 - 8))
106// Nap mode enable
107#define HID0_NAP (1 << (31 - 9))
108// Sleep mode enable
109#define HID0_SLEEP (1 << (31 - 10))
110// Dynamic power management enable
111#define HID0_DPM (1 << (31 - 11))
112// Not hard reset (software-use only)
113#define HID0_NHR (1 << (31 - 15))
114// Instruction cache enable
115#define HID0_ICE (1 << (31 - 16))
116// Data cache enable
117#define HID0_DCE (1 << (31 - 17))
118// Instruction cache lock
119#define HID0_ILOCK (1 << (31 - 18))
120// Data cache lock
121#define HID0_DLOCK (1 << (31 - 19))
122// Instruction cache flash invalidate
123#define HID0_ICFI (1 << (31 - 20))
124// Data cache flash invalidate
125#define HID0_DCFI (1 << (31 - 21))
126// Speculative cache access disable
127#define HID0_SPD (1 << (31 - 22))
128// Enable M bit on bus for instruction fetches
129#define HID0_IFEM (1 << (31 - 23))
130// Store gathering enable
131#define HID0_SGE (1 << (31 - 24))
132// Data cache flush assist
133#define HID0_DCFA (1 << (31 - 25))
134// Branch Target Instruction Cache enable
135#define HID0_BTIC (1 << (31 - 26))
136// Address broadcast enable
137#define HID0_ABE (1 << (31 - 28))
138// Branch history table enable
139#define HID0_BHT (1 << (31 - 29))
140// No-op the data cache touch instructions
141#define HID0_NOOPTI (1 << (31 - 31))
142
143/**
144 * HID1
145 * Hardware Implementation-Dependent Register 1
146 */
147// PLL configuration bits (read-only)
148#define HID1_PC0 (1 << (31 - 0))
149#define HID1_PC1 (1 << (31 - 1))
150#define HID1_PC2 (1 << (31 - 2))
151#define HID1_PC3 (1 << (31 - 3))
152#define HID1_PC4 (1 << (31 - 4))
153
154/**
155 * L2CR
156 * L2 Control Register
157 */
158// L2 enable
159#define L2CR_L2E (1 << (31 - 0))
160// L2 Checkstop enable
161#define L2CR_L2CE (1 << (31 - 1))
162// L2 data-only
163#define L2CR_L2DO (1 << (31 - 9))
164// L2 global invalidate
165#define L2CR_L2I (1 << (31 - 10))
166// L2 write-through
167#define L2CR_L2WT (1 << (31 - 12))
168// L2 test support
169#define L2CR_L2TS (1 << (31 - 13))
170// L2 global invalidate in progress (read only)
171#define L2CR_L2IP (1 << (31 - 31))
172
173/**
174 * PMC1-PMC4
175 * Performance Monitor Counter Registers
176 */
177// Overflow
178#define PMC_OV (1 << (31 - 0))
179
180/**
181 * FPSCR
182 * Floating-Point Status and Control Register
183 */
184// Floating-point exception summary
185#define FPSCR_FX (1 << (31 - 0))
186// Floating-point enabled exception summary
187#define FPSCR_FEX (1 << (31 - 1))
188// Floating-point invalid operation exception summary
189#define FPSCR_VX (1 << (31 - 2))
190// Floating-point overflow exception
191#define FPSCR_OX (1 << (31 - 3))
192// Floating-point underflow exception
193#define FPSCR_UX (1 << (31 - 4))
194// Floating-point zero divide exception
195#define FPSCR_ZX (1 << (31 - 5))
196// Floating-point inexact exception
197#define FPSCR_XX (1 << (31 - 6))
198// Floating-point invalid operation exception for SNaN
199#define FPSCR_VXSNAN (1 << (31 - 7))
200// Floating-point invalid operation exception for (inf - inf)
201#define FPSCR_VXISI (1 << (31 - 8))
202// Floating-point invalid operation exception for (inf / inf)
203#define FPSCR_VXIDI (1 << (31 - 9))
204// Floating-point invalid operation exception for (0 / 0)
205#define FPSCR_VXZDZ (1 << (31 - 10))
206// Floating-point invalid operation exception for (inf * 0)
207#define FPSCR_VXIMZ (1 << (31 - 11))
208// Floating-point invalid operation exception for invalid compare
209#define FPSCR_VXVC (1 << (31 - 12))
210// Floating-point fraction rounded
211#define FPSCR_FR (1 << (31 - 13))
212// Floating-point fraction inexact
213#define FPSCR_FI (1 << (31 - 14))
214// Floating-point result flags
215#define FPSCR_FPRF (0b11111 << (31 - 19))
216// Unknown
217#define FPSCR_UNK20 (1 << (31 - 20))
218// Floating-point invalid operation exception for software request
219#define FPSCR_VXSOFT (1 << (31 - 21))
220// Floating-point invalid operation exception for invalid square root
221#define FPSCR_VXSQRT (1 << (31 - 22))
222// Floating-point invalid operation exception for invalid integer convert
223#define FPSCR_VXCVI (1 << (31 - 23))
224// Floating-point invalid operation exception enable
225#define FPSCR_VE (1 << (31 - 24))
226// IEEE floating-point overflow exception enable
227#define FPSCR_OE (1 << (31 - 25))
228// IEEE floating-point underflow exception enable
229#define FPSCR_UE (1 << (31 - 26))
230// IEEE floating-point zero divide exception enable
231#define FPSCR_ZE (1 << (31 - 27))
232// Floating-point inexact exception enable
233#define FPSCR_XE (1 << (31 - 28))
234// Floating-point non-IEEE mode
235#define FPSCR_NI (1 << (31 - 29))
236// Floating-point rounding control
237#define FPSCR_RN (0b11 << (31 - 31))
238
239/**
240 * HID2
241 * Hardware Implementation-Dependent Register 2
242 */
243// Write pipe enable
244#define HID2_WPE (1 << (31 - 1))
245// Paired-single enable
246#define HID2_PSE (1 << (31 - 2))
247// Locked cache enable
248#define HID2_LCE (1 << (31 - 3))
249// DMA queue length (read only)
250#define HID2_DMAQL \
251 ((1 << (31 - 4)) | (1 << (31 - 5)) | (1 << (31 - 6)) | (1 << (31 - 7)))
252// dcbz_l cache hit error
253#define HID2_DCHERR (1 << (31 - 8))
254// DMA access to normal cache error
255#define HID2_DNCERR (1 << (31 - 9))
256// DMA cache miss error
257#define HID2_DCMERR (1 << (31 - 10))
258// DMA queue overflow error
259#define HID2_DQOERR (1 << (31 - 11))
260// dcbz_l cache hit error enable
261#define HID2_DCHEE (1 << (31 - 12))
262// DMA access to normal cache error enable
263#define HID2_DNCEE (1 << (31 - 13))
264// DMA cache miss error enable
265#define HID2_DCMEE (1 << (31 - 14))
266// DMA queue overflow error enable
267#define HID2_DQOEE (1 << (31 - 15))
268
269/**
270 * WPAR
271 * Write Pipe Address Register
272 */
273// High order address bits of the data to be gathered
274#define WPAR_GB_ADDR (0x07FFFFFF << (31 - 26))
275// Buffer not empty (read only)
276#define WPAR_BNE (1 << (31 - 31))
277
278/**
279 * DMAU
280 * Direct Memory Access Upper Register
281 */
282// High order address bits of starting address in external memory of the DMA
283// transfer
284#define DMAU_MEM_ADDR (0x07FFFFFF << (31 - 26))
285// High order bits of transfer length, in cache lines. Low order bits are in
286// DMAL
287#define DMAU_DMA_LEN_U (0x0000001F << (31 - 31))
288
289/**
290 * DMAL
291 * Direct Memory Access Lower Register
292 */
293// High order address bits of starting address in locked cache of the DMA
294// transfer
295#define DMAL_LC_ADDR (0x07FFFFFF << (31 - 26))
296// DMA load command
297#define DMAL_DMA_LD (1 << (31 - 27))
298// Low order bits of transfer length, in cache lines. High order bits are in
299// DMAU
300#define DMAL_DMA_LEN_L (0b11 << (31 - 29))
301// Trigger bit
302#define DMAL_DMA_T (1 << (31 - 30))
303// Flush bit
304#define DMAL_DMA_F (1 << (31 - 31))
305
306/**
307 * PVR
308 * Processor Version Register
309 */
310// A 16-bit number that uniquely identifies a particular processor version
311#define PVR_VER (0xFFFF0000)
312// A 16-bit number that distinguishes between various releases of a particular
313// version (that is, an engineering change level)
314#define PVR_REV (0x0000FFFF)
315
316/**
317 * HID4
318 * Hardware Implementation-Dependent Register 4
319 */
320// Unknown
321#define HID4_H4A (1 << (31 - 0))
322// L2 fetch mode
323#define HID4_L2FM (0b11 << (31 - 2))
324// Bus pipeline depth
325#define HID4_BPD (0b11 << (31 - 4))
326// L2 second castout buffer enable
327#define HID4_BCO (1 << (31 - 5))
328// Secondary BAT enable
329#define HID4_SBE (1 << (31 - 6))
330// Paired-singles control bit 1
331#define HID4_PS1_CTL (1 << (31 - 7))
332// Data bus parking
333#define HID4_DBP (1 << (31 - 9))
334// L2 MUM enable
335#define HID4_L2MUM (1 << (31 - 10))
336// L2CFI - L2 complete castout prior to L2 flash invalidate
337#define HID4_L2_CCFI (1 << (31 - 11))
338// Paired-singles control bit 2
339#define HID4_PSS2_CTL (1 << (31 - 12))