vitasdk
Documentation of the vitasdk
excpmgr.h
Go to the documentation of this file.
1 
7 #ifndef _PSP2KERN_KERNEL_EXCPMGR_H_
8 #define _PSP2KERN_KERNEL_EXCPMGR_H_
9 
10 #include <vitasdk/build_utils.h>
11 #include <psp2kern/types.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 typedef enum SceExcpKind {
25  SCE_EXCP_FIQ = 7
27 
28 typedef enum SceExcpHandlingCode {
35 
36 typedef struct SceExcpmgrData { //Data in each array is per-CPU core
38  int unused[4];
39  void *ExcpStackTop[4];
40  void *ExcpStackBottom[4];
43 
44 typedef struct SceExcpmgrExceptionContext {
45  uint32_t r0;
46  uint32_t r1;
47  uint32_t r2;
48  uint32_t r3;
49  uint32_t r4;
50  uint32_t r5;
51  uint32_t r6;
52  uint32_t r7;
53  uint32_t r8;
54  uint32_t r9;
55  uint32_t r10;
56  uint32_t r11;
57  uint32_t r12;
58  uint32_t sp;
59  uint32_t lr;
60  uint32_t address_of_faulting_instruction; //<! Address where the faulty instruction is located
61  SceExcpKind ExceptionKind; //<! The kind of exception the CPU encountered
62  uint32_t SPSR;
63  uint32_t CPACR;
64  uint32_t FPSCR;
65  uint32_t FPEXC;
66  uint32_t CONTEXTIDR;
67  uint32_t TPIDRURW;
68  uint32_t TPIDRURO;
69  uint32_t TPIDRPRW;
70  uint32_t TTBR1;
71  uint32_t unused68;
72  uint32_t DACR;
73  uint32_t DFSR;
74  uint32_t IFSR;
75  uint32_t DFAR;
76  uint32_t IFAR;
77  uint32_t PAR;
78  uint32_t TEEHBR;
79  uint32_t PMCR;
80  uint32_t PMCNTENSET;
81  uint32_t PMCNTENSET_2; //<! Second copy of PMCNTENSET
82  uint32_t PMSELR;
83  uint32_t PMCCNTR;
84  uint32_t PMUSERENR;
85  uint32_t PMXEVTYPER0;
86  uint32_t PMXEVCNTR0;
87  uint32_t PMXEVTYPER1;
88  uint32_t PMXEVCNTR1;
89  uint32_t PMXEVTYPER2;
90  uint32_t PMXEVCNTR2;
91  uint32_t PMXEVTYPER3;
92  uint32_t PMXEVCNTR3;
93  uint32_t PMXEVTYPER4;
94  uint32_t PMXEVCNTR4;
95  uint32_t PMXEVTYPER5;
96  uint32_t PMXEVCNTR5;
97  uint32_t unusedD0;
98  uint32_t unkD4; //<! Comes from SceVfpIntRegs memblock
99  uint32_t DBGSCRext;
100  uint32_t unusedDC[9];
101  uint64_t VFP_registers[32]; //<! Content of floating-point registers d0-d31
102  uint32_t unk200[128]; //<! Comes from SceVfpIntRegs memblock
105 
106 typedef void(SceExcpmgrExceptionHandler)(SceExcpmgrExceptionContext* context, SceExcpHandlingCode code); //<! Exception handler function
107 
116 
129 int ksceExcpmgrRegisterHandler(SceExcpKind kind, int priority, void *handler);
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* _PSP2KERN_KERNEL_EXCPMGR_H_ */
uint32_t r3
Definition: excpmgr.h:48
uint32_t lr
Definition: excpmgr.h:59
uint32_t r5
Definition: excpmgr.h:50
uint32_t PMXEVCNTR2
Definition: excpmgr.h:90
void() SceExcpmgrExceptionHandler(SceExcpmgrExceptionContext *context, SceExcpHandlingCode code)
Definition: excpmgr.h:106
uint32_t PMXEVTYPER5
Definition: excpmgr.h:95
uint32_t IFSR
Definition: excpmgr.h:74
uint32_t IFAR
Definition: excpmgr.h:76
uint32_t r7
Definition: excpmgr.h:52
uint32_t unk200[128]
Definition: excpmgr.h:102
uint32_t PAR
Definition: excpmgr.h:77
uint32_t PMCNTENSET
Definition: excpmgr.h:80
uint32_t r9
Definition: excpmgr.h:54
uint32_t PMCCNTR
Definition: excpmgr.h:83
uint32_t PMSELR
Definition: excpmgr.h:82
uint32_t TTBR1
Definition: excpmgr.h:70
uint32_t DFSR
Definition: excpmgr.h:73
uint32_t PMXEVCNTR1
Definition: excpmgr.h:88
uint32_t PMCNTENSET_2
Definition: excpmgr.h:81
uint32_t PMXEVCNTR3
Definition: excpmgr.h:92
uint32_t PMCR
Definition: excpmgr.h:79
uint32_t PMXEVTYPER0
Definition: excpmgr.h:85
uint32_t PMXEVTYPER2
Definition: excpmgr.h:89
uint32_t unkD4
Definition: excpmgr.h:98
uint32_t DBGSCRext
Definition: excpmgr.h:99
SceExcpHandlingCode
Definition: excpmgr.h:28
uint32_t r0
< Size is 0x400 on FW 3.60
Definition: excpmgr.h:45
uint32_t r4
Definition: excpmgr.h:49
uint32_t sp
Definition: excpmgr.h:58
uint32_t r6
Definition: excpmgr.h:51
uint32_t FPSCR
Definition: excpmgr.h:64
uint32_t r1
Definition: excpmgr.h:46
SceExcpmgrData * ksceExcpmgrGetData(void)
Get a pointer to SceExcpmgr's internal data.
uint32_t CPACR
Definition: excpmgr.h:63
uint32_t TEEHBR
Definition: excpmgr.h:78
uint64_t VFP_registers[32]
Definition: excpmgr.h:101
int unused[4]
Seemingly unused.
Definition: excpmgr.h:38
SceExcpKind
Definition: excpmgr.h:17
int nestedExceptionCount[4]
Number of times an exception handler has been entered on core - panic if > 1 on exception return.
Definition: excpmgr.h:37
uint32_t unusedD0
Definition: excpmgr.h:97
uint32_t DACR
Definition: excpmgr.h:72
uint32_t PMUSERENR
Definition: excpmgr.h:84
uint32_t TPIDRURW
Definition: excpmgr.h:67
void * ExcpStackTop[4]
Top of the exception stack (size is 0x1000)
Definition: excpmgr.h:39
uint32_t PMXEVTYPER1
Definition: excpmgr.h:87
VITASDK_BUILD_ASSERT_EQ(0x40, SceExcpmgrData)
uint32_t r2
Definition: excpmgr.h:47
uint32_t DFAR
Definition: excpmgr.h:75
uint32_t TPIDRURO
Definition: excpmgr.h:68
uint32_t r8
Definition: excpmgr.h:53
uint32_t r10
Definition: excpmgr.h:55
uint32_t FPEXC
Definition: excpmgr.h:65
uint32_t r12
Definition: excpmgr.h:57
uint32_t unused68
Definition: excpmgr.h:71
uint32_t PMXEVCNTR0
Definition: excpmgr.h:86
uint32_t address_of_faulting_instruction
Definition: excpmgr.h:60
uint32_t PMXEVTYPER4
Definition: excpmgr.h:93
SceExcpKind ExceptionKind
Definition: excpmgr.h:61
uint32_t PMXEVCNTR4
Definition: excpmgr.h:94
int ksceExcpmgrRegisterHandler(SceExcpKind kind, int priority, void *handler)
Register an exception handler.
uint32_t CONTEXTIDR
Definition: excpmgr.h:66
uint32_t unusedDC[9]
Definition: excpmgr.h:100
uint32_t PMXEVCNTR5
Definition: excpmgr.h:96
void * ExcpStackBottom[4]
Bottom of the exception stack.
Definition: excpmgr.h:40
uint32_t PMXEVTYPER3
Definition: excpmgr.h:91
uint32_t SPSR
Definition: excpmgr.h:62
uint32_t TPIDRPRW
Definition: excpmgr.h:69
uint32_t r11
Definition: excpmgr.h:56
@ SCE_EXCPMGR_EXCEPTION_NOT_HANDLED
Exception not handled - kills app with C2-12828-1.
Definition: excpmgr.h:30
@ SCE_EXCPMGR_EXCEPTION_HANDLING_CODE_2
Definition: excpmgr.h:31
@ SCE_EXCPMGR_EXCEPTION_HANDLING_CODE_4
Definition: excpmgr.h:33
@ SCE_EXCPMGR_EXCEPTION_HANDLED
Exception handled.
Definition: excpmgr.h:29
@ SCE_EXCPMGR_EXCEPTION_NOT_HANDLED_FATAL
Fatal exception - panics the kernel.
Definition: excpmgr.h:32
@ SCE_EXCP_FIQ
Definition: excpmgr.h:25
@ SCE_EXCP_IRQ
Definition: excpmgr.h:24
@ SCE_EXCP_UNDEF_INSTRUCTION
Definition: excpmgr.h:19
@ SCE_EXCP_DABT
Definition: excpmgr.h:22
@ SCE_EXCP_PABT
Definition: excpmgr.h:21
@ SCE_EXCP_UNUSED
Definition: excpmgr.h:23
@ SCE_EXCP_SVC
Definition: excpmgr.h:20
@ SCE_EXCP_RESET
Definition: excpmgr.h:18
Definition: excpmgr.h:36
Definition: excpmgr.h:44