# prxtypes.h

Go to the documentation of this file.

    00001 /*
    00002  * PSP Software Development Kit - http://www.pspdev.org
    00003  * -----------------------------------------------------------------------
    00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
    00005  *
    00006  * prxtypes.h - Definition of PRX specific types.
    00007  *
    00008  * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
    00009  *
    00010  * $Id: prxtypes.h 1095 2005-09-27 21:02:16Z jim $
    00011  */
    00012
    00013 #ifndef __PRXTYPES_H__
    00014 #define __PRXTYPES_H__
    00015
    00016 #include "types.h"
    00017
    00018 #define PSP_MODULE_MAX_NAME 28
    00019 #define PSP_LIB_MAX_NAME 128
    00020 #define PSP_ENTRY_MAX_NAME 128
    00021 /* Define the maximum number of permitted entries per lib */
    00022 #define PSP_MAX_V_ENTRIES 255
    00023 #define PSP_MAX_F_ENTRIES 65535
    00024
    00025 #define PSP_MODULE_INFO_NAME ".rodata.sceModuleInfo"
    00026
    00027 /* Remove the .rel.sceStub.text section as it shouldn't have been there */
    00028 #define PSP_MODULE_REMOVE_REL ".rel.sceStub.text"
    00029
    00030 /* Define a name for the unnamed first export */
    00031 #define PSP_SYSTEM_EXPORT "syslib"
    00032
    00033 enum PspEntryType
    00034 {
    00035         PSP_ENTRY_FUNC = 0,
    00036         PSP_ENTRY_VAR = 1
    00037 };
    00038
    00039 /* Define the in-prx structure types */
    00040
    00041 /* Structure to hold the module export information */
    00042 struct PspModuleExport
    00043 {
    00044         u32 name;
    00045         u32 flags;
    00046         u32 counts;
    00047         u32 exports;
    00048 } __attribute__((packed));
    00049
    00050 /* Structure to hold the module import information */
    00051 struct PspModuleImport
    00052 {
    00053         u32 name;
    00054         u32 flags;
    00055         u8  entry_size;
    00056         u8  var_count;
    00057         u16 func_count;
    00058         u32 nids;
    00059         u32 funcs;
    00060 };
    00061
    00062 /* Structure to hold the module info */
    00063 struct PspModuleInfo
    00064 {
    00065         u32 flags;
    00066         char name[PSP_MODULE_MAX_NAME];
    00067         u32 gp;
    00068         u32 exports;
    00069         u32 exp_end;
    00070         u32 imports;
    00071         u32 imp_end;
    00072 };
    00073
    00074 /* Define the loaded prx types */
    00075 struct PspEntry
    00076 {
    00077         /* Name of the entry */
    00078         char name[PSP_ENTRY_MAX_NAME];
    00079         /* Nid of the entry */
    00080         u32 nid;
    00081         /* Type of the entry */
    00082         enum PspEntryType type;
    00083         /* Virtual address of the entry in the loaded elf */
    00084         u32 addr;
    00085         /* Virtual address of the nid dword */
    00086         u32 nid_addr;
    00087 };
    00088
    00089 /* Holds a linking entry for an import library */
    00090 struct PspLibImport
    00091 {
    00093         struct PspLibImport *prev;
    00095         struct PspLibImport *next;
    00097         char name[PSP_LIB_MAX_NAME];
    00098         /* Virtual address of the lib import stub */
    00099         u32 addr;
    00100         /* Copy of the import stub (in native byte order) */
    00101         struct PspModuleImport stub;
    00102         /* List of function entries */
    00103         struct PspEntry funcs[PSP_MAX_F_ENTRIES];
    00104         /* Number of function entries */
    00105         int f_count;
    00106         /* List of variable entried */
    00107         struct PspEntry vars[PSP_MAX_V_ENTRIES];
    00108         /* Number of variable entires */
    00109         int v_count;
    00110 };
    00111
    00112 /* Holds a linking entry for an export library */
    00113 struct PspLibExport
    00114 {
    00116         struct PspLibExport *prev;
    00118         struct PspLibExport *next;
    00120         char name[PSP_LIB_MAX_NAME];
    00122         u32 addr;
    00124         struct PspModuleExport stub;
    00126         struct PspEntry funcs[PSP_MAX_F_ENTRIES];
    00128         int f_count;
    00130         struct PspEntry vars[PSP_MAX_V_ENTRIES];
    00132         int v_count;
    00133 };
    00134
    00136 struct PspModule
    00137 {
    00139         char name[PSP_MODULE_MAX_NAME+1];
    00141         struct PspModuleInfo info;
    00143         u32 addr;
    00145         struct PspLibExport *exp_head;
    00147         struct PspLibImport *imp_head;
    00148 };
    00149
    00150 #endif