|
libdragon
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
12#ifndef __LIBDRAGON_COP0_H
13#define __LIBDRAGON_COP0_H
18#define C0_COUNT() ({ \
20 asm volatile("mfc0 %0,$9":"=r"(x)); \
25#define C0_WRITE_COUNT(x) ({ \
26 asm volatile("mtc0 %0,$9"::"r"(x)); \
31#define C0_COMPARE() ({ \
33 asm volatile("mfc0 %0,$11":"=r"(x)); \
38#define C0_WRITE_COMPARE(x) ({ \
39 asm volatile("mtc0 %0,$11"::"r"(x)); \
44#define C0_STATUS() ({ \
46 asm volatile("mfc0 %0,$12":"=r"(x)); \
51#define C0_WRITE_STATUS(x) ({ \
52 asm volatile("mtc0 %0,$12"::"r"(x)); \
64#define C0_CAUSE() ({ \
66 asm volatile("mfc0 %0,$13" : "=r" (x) : ); \
75#define C0_WRITE_CAUSE(x) ({ \
76 asm volatile("mtc0 %0,$13"::"r"(x)); \
81#define C0_CR() C0_CAUSE()
82#define C0_WRITE_CR(x) C0_WRITE_CAUSE(x)
92#define C0_BADVADDR() ({ \
94 asm volatile("dmfc0 %0,$8" : "=r" (x) : ); \
110 asm volatile("mfc0 %0,$14" : "=r" (x) : ); \
120#define C0_INDEX() ({ \
122 asm volatile("mfc0 %0,$0":"=r"(x)); \
132#define C0_WRITE_INDEX(x) asm volatile("mtc0 %0,$0; nop; nop"::"r"(x))
141#define C0_ENTRYHI() ({ \
143 asm volatile("mfc0 %0,$10":"=r"(x)); \
152#define C0_WRITE_ENTRYHI(x) asm volatile("mtc0 %0,$10; nop; nop"::"r"(x))
160#define C0_ENTRYLO0() ({ \
162 asm volatile("mfc0 %0,$2":"=r"(x)); \
172#define C0_WRITE_ENTRYLO0(x) asm volatile("mtc0 %0,$2; nop; nop"::"r"(x))
180#define C0_ENTRYLO1() ({ \
182 asm volatile("mfc0 %0,$3":"=r"(x)); \
192#define C0_WRITE_ENTRYLO1(x) asm volatile("mtc0 %0,$3; nop; nop"::"r"(x))
201#define C0_PAGEMASK() ({ \
203 asm volatile("mfc0 %0,$5":"=r"(x)); \
213#define C0_WRITE_PAGEMASK(x) asm volatile("mtc0 %0,$5; nop; nop"::"r"(x))
223#define C0_WIRED() ({ \
225 asm volatile("mfc0 %0,$6":"=r"(x)); \
235#define C0_WATCHLO() ({ \
237 asm volatile("mfc0 %0,$18":"=r"(x)); \
247#define C0_WRITE_WATCHLO(x) asm volatile("mtc0 %0,$18"::"r"(x))
256#define C0_WRITE_WIRED(x) asm volatile("mtc0 %0,$6; nop; nop"::"r"(x))
260#define C0_READ_CR() C0_CAUSE()
261#define C0_READ_EPC() C0_EPC()
262#define C0_READ_BADVADDR() C0_BADVADDR()
266#define C0_STATUS_IE 0x00000001
267#define C0_STATUS_EXL 0x00000002
268#define C0_STATUS_ERL 0x00000004
271#define C0_CAUSE_BD 0x80000000
272#define C0_CAUSE_CE 0x30000000
273#define C0_CAUSE_EXC_CODE 0x0000007C
276#define C0_INTERRUPT_0 0x00000100
277#define C0_INTERRUPT_1 0x00000200
278#define C0_INTERRUPT_2 0x00000400
279#define C0_INTERRUPT_3 0x00000800
280#define C0_INTERRUPT_4 0x00001000
281#define C0_INTERRUPT_5 0x00002000
282#define C0_INTERRUPT_6 0x00004000
283#define C0_INTERRUPT_7 0x00008000
285#define C0_INTERRUPT_RCP C0_INTERRUPT_2
286#define C0_INTERRUPT_CART C0_INTERRUPT_3
287#define C0_INTERRUPT_PRENMI C0_INTERRUPT_4
288#define C0_INTERRUPT_TIMER C0_INTERRUPT_7
296#define C0_GET_CAUSE_CE(cr) (((cr) & C0_CAUSE_CE) >> 28)
301#define C0_GET_CAUSE_EXC_CODE(sr) (((sr) & C0_CAUSE_EXC_CODE) >> 2)
304#define C0_ENTRYLO_GLOBAL (1<<0)
305#define C0_ENTRYLO_VALID (1<<1)
306#define C0_ENTRYLO_DIRTY (1<<2)
309#define C0_INDEX_PROBE_FAILED (1<<31)
318#define C0_TLBWI() asm volatile("tlbwi; nop; nop; nop; nop")
327#define C0_TLBWR() asm volatile("tlbwr; nop; nop; nop; nop")
336#define C0_TLBR() asm volatile("tlbr; nop; nop; nop; nop")
346#define C0_TLBP() asm volatile("tlbp; nop; nop; nop; nop")