-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprxtypes.h
152 lines (136 loc) · 3.45 KB
/
prxtypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
* PSP Software Development Kit - https://github.com/pspdev
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* prxtypes.h - Definition of PRX specific types.
*
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
*
*/
#ifndef __PRXTYPES_H__
#define __PRXTYPES_H__
#include "types.h"
#define PSP_MODULE_MAX_NAME 28
#define PSP_LIB_MAX_NAME 128
#define PSP_ENTRY_MAX_NAME 128
/* Define the maximum number of permitted entries per lib */
#define PSP_MAX_V_ENTRIES 255
#define PSP_MAX_F_ENTRIES 65535
#define PSP_MODULE_INFO_NAME ".rodata.sceModuleInfo"
/* Remove the .rel.sceStub.text section as it shouldn't have been there */
#define PSP_MODULE_REMOVE_REL ".rel.sceStub.text"
/* Define a name for the unnamed first export */
#define PSP_SYSTEM_EXPORT "syslib"
enum PspEntryType
{
PSP_ENTRY_FUNC = 0,
PSP_ENTRY_VAR = 1
};
/* Define the in-prx structure types */
/* Structure to hold the module export information */
#pragma pack(1)
struct PspModuleExport
{
u32 name;
u32 flags;
u32 counts;
u32 exports;
//} __attribute__((packed));
};
#pragma pack()
/* Structure to hold the module import information */
struct PspModuleImport
{
u32 name;
u32 flags;
u8 entry_size;
u8 var_count;
u16 func_count;
u32 nids;
u32 funcs;
};
/* Structure to hold the module info */
struct PspModuleInfo
{
u32 flags;
char name[PSP_MODULE_MAX_NAME];
u32 gp;
u32 exports;
u32 exp_end;
u32 imports;
u32 imp_end;
};
/* Define the loaded prx types */
struct PspEntry
{
/* Name of the entry */
char name[PSP_ENTRY_MAX_NAME];
/* Nid of the entry */
u32 nid;
/* Type of the entry */
enum PspEntryType type;
/* Virtual address of the entry in the loaded elf */
u32 addr;
/* Virtual address of the nid dword */
u32 nid_addr;
};
/* Holds a linking entry for an import library */
struct PspLibImport
{
/** Previous import */
struct PspLibImport *prev;
/** Next import */
struct PspLibImport *next;
/** Name of the library */
char name[PSP_LIB_MAX_NAME];
/* Virtual address of the lib import stub */
u32 addr;
/* Copy of the import stub (in native byte order) */
struct PspModuleImport stub;
/* List of function entries */
struct PspEntry funcs[PSP_MAX_F_ENTRIES];
/* Number of function entries */
int f_count;
/* List of variable entried */
struct PspEntry vars[PSP_MAX_V_ENTRIES];
/* Number of variable entires */
int v_count;
};
/* Holds a linking entry for an export library */
struct PspLibExport
{
/** Previous export in the chain */
struct PspLibExport *prev;
/** Next export in the chain */
struct PspLibExport *next;
/** Name of the library */
char name[PSP_LIB_MAX_NAME];
/** Virtual address of the lib import stub */
u32 addr;
/** Copy of the import stub (in native byte order) */
struct PspModuleExport stub;
/** List of function entries */
struct PspEntry funcs[PSP_MAX_F_ENTRIES];
/** Number of function entries */
int f_count;
/** List of variable entried */
struct PspEntry vars[PSP_MAX_V_ENTRIES];
/** Number of variable entires */
int v_count;
};
/** Structure to hold the loaded module information */
struct PspModule
{
/** Name of the module */
char name[PSP_MODULE_MAX_NAME+1];
/** Info structure, in native byte order */
struct PspModuleInfo info;
/** Virtual address of the module info section */
u32 addr;
/** Head of the export list */
struct PspLibExport *exp_head;
/** Head of the import list */
struct PspLibImport *imp_head;
};
#endif