00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PSPMODULEINFO_H
00015 #define PSPMODULEINFO_H
00016
00017
00018
00019
00020
00021
00022 typedef struct _scemoduleinfo {
00023 unsigned short modattribute;
00024 unsigned char modversion[2];
00025 char modname[27];
00026 char terminal;
00027 void * gp_value;
00028 void * ent_top;
00029 void * ent_end;
00030 void * stub_top;
00031 void * stub_end;
00032 } _sceModuleInfo;
00033
00034 typedef const _sceModuleInfo SceModuleInfo;
00035
00036 extern char _gp[];
00037
00038 enum PspModuleInfoAttr
00039 {
00040 PSP_MODULE_USER = 0,
00041 PSP_MODULE_KERNEL = 0x1000,
00042 };
00043
00044 #ifdef __cplusplus
00045
00046
00047 #define PSP_MODULE_INFO(name, attributes, major_version, minor_version) \
00048 __asm__ ( \
00049 " .set push\n" \
00050 " .section .lib.ent.top, \"a\", @progbits\n" \
00051 " .align 2\n" \
00052 " .word 0\n" \
00053 "__lib_ent_top:\n" \
00054 " .section .lib.ent.btm, \"a\", @progbits\n" \
00055 " .align 2\n" \
00056 "__lib_ent_bottom:\n" \
00057 " .word 0\n" \
00058 " .section .lib.stub.top, \"a\", @progbits\n" \
00059 " .align 2\n" \
00060 " .word 0\n" \
00061 "__lib_stub_top:\n" \
00062 " .section .lib.stub.btm, \"a\", @progbits\n" \
00063 " .align 2\n" \
00064 "__lib_stub_bottom:\n" \
00065 " .word 0\n" \
00066 " .set pop\n" \
00067 " .text\n" \
00068 ); \
00069 extern char __lib_ent_top[], __lib_ent_bottom[]; \
00070 extern char __lib_stub_top[], __lib_stub_bottom[]; \
00071 extern SceModuleInfo module_info \
00072 __attribute__((section(".rodata.sceModuleInfo"), \
00073 aligned(16), unused)) = { \
00074 attributes, { minor_version, major_version }, #name, 0, _gp, \
00075 __lib_ent_top, __lib_ent_bottom, \
00076 __lib_stub_top, __lib_stub_bottom \
00077 }
00078 #else
00079
00080 #define PSP_MODULE_INFO(name, attributes, major_version, minor_version) \
00081 __asm__ ( \
00082 " .set push\n" \
00083 " .section .lib.ent.top, \"a\", @progbits\n" \
00084 " .align 2\n" \
00085 " .word 0\n" \
00086 "__lib_ent_top:\n" \
00087 " .section .lib.ent.btm, \"a\", @progbits\n" \
00088 " .align 2\n" \
00089 "__lib_ent_bottom:\n" \
00090 " .word 0\n" \
00091 " .section .lib.stub.top, \"a\", @progbits\n" \
00092 " .align 2\n" \
00093 " .word 0\n" \
00094 "__lib_stub_top:\n" \
00095 " .section .lib.stub.btm, \"a\", @progbits\n" \
00096 " .align 2\n" \
00097 "__lib_stub_bottom:\n" \
00098 " .word 0\n" \
00099 " .set pop\n" \
00100 " .text\n" \
00101 ); \
00102 extern char __lib_ent_top[], __lib_ent_bottom[]; \
00103 extern char __lib_stub_top[], __lib_stub_bottom[]; \
00104 SceModuleInfo module_info \
00105 __attribute__((section(".rodata.sceModuleInfo"), \
00106 aligned(16), unused)) = { \
00107 attributes, { minor_version, major_version }, name, 0, _gp, \
00108 __lib_ent_top, __lib_ent_bottom, \
00109 __lib_stub_top, __lib_stub_bottom \
00110 }
00111 #endif
00112
00113
00114 #define PSP_MAIN_THREAD_PRIORITY(priority) \
00115 unsigned int sce_newlib_priority = (priority)
00116
00117 #define PSP_MAIN_THREAD_STACK_SIZE_KB(size_kb) \
00118 unsigned int sce_newlib_stack_kb_size = (size_kb)
00119
00120 #define PSP_MAIN_THREAD_ATTR(attr) \
00121 unsigned int sce_newlib_attribute = (attr)
00122 #define PSP_MAIN_THREAD_ATTRIBUTE PSP_MAIN_THREAD_ATTR
00123
00124
00125 #define PSP_MAIN_THREAD_PARAMS(priority, size_kb, attribute) \
00126 PSP_MAIN_THREAD_PRIORITY(priority); \
00127 PSP_MAIN_THREAD_STACK_SIZE_KB(size_kb); \
00128 PSP_MAIN_THREAD_ATTR(attribute)
00129
00130
00131 #define PSP_NO_CREATE_MAIN_THREAD() \
00132 int sce_newlib_nocreate_thread_in_start = 1
00133
00134
00135 #define PSP_HEAP_SIZE_KB(size_kb) \
00136 unsigned int sce_newlib_heap_kb_size = (size_kb)
00137
00138
00139 #define PSP_MAIN_THREAD_NAME(s) const char* sce_newlib_main_thread_name = (s)
00140
00141 #endif