uOFW
Reverse engineered PSP kernel 6.60.
Loading...
Searching...
No Matches
module.h
1/* Copyright (C) 2011 - 2015 The uOFW team
2 See the file COPYING for copying permission.
3*/
4
5#ifndef COMMON_INCLUDED
6# error "Only include common_imp.h or common_header.h!"
7#endif
8
9#include "../pspmoduleexport.h"
10
12#define SCE_MODULE_NAME_LEN (27)
13
15#define MODULE_VERSION_MINOR (0)
16#define MODULE_VERSION_MAJOR (1)
17#define MODULE_VERSION_NUMBER_CATEGORY_SIZE (2) /* current number category size */
18
20typedef struct {
27 u8 modVersion[MODULE_VERSION_NUMBER_CATEGORY_SIZE];
29 char modName[SCE_MODULE_NAME_LEN];
33 void *gpValue;
38 void *entTop;
43 void *entEnd;
48 void *stubTop;
53 void *stubEnd;
55
56/*
57 * Entry thread structure - an entry thread is used for executing the
58 * module entry functions.
59 */
60typedef struct {
61 /* The number of entry thread parameters, typically 3. */
62 u32 numParams;
63 /* The initial priority of the entry thread. */
64 u32 initPriority;
65 /* The stack size of the entry thread. */
66 u32 stackSize;
67 /* The attributes of the entry thread. */
68 u32 attr;
69} SceModuleEntryThread;
70
71extern char _gp[];
72
76enum SceModuleAttribute {
78 SCE_MODULE_ATTR_NONE = 0x0000,
80 SCE_MODULE_ATTR_CANT_STOP = 0x0001,
85 SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002,
90 SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004,
91};
92
97enum SceModulePrivilegeLevel {
99 SCE_MODULE_USER = 0x0000,
101 SCE_MODULE_MS = 0x0200,
103 SCE_MODULE_USB_WLAN = 0x0400,
105 SCE_MODULE_APP = 0x0600,
107 SCE_MODULE_VSH = 0x0800,
109 SCE_MODULE_KERNEL = 0x1000,
111 SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000,
113 SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
114};
115
116#define SCE_MODULE_PRIVILEGE_LEVELS (SCE_MODULE_MS | SCE_MODULE_USB_WLAN | SCE_MODULE_APP | SCE_MODULE_VSH | SCE_MODULE_KERNEL)
117
118#define SCE_MODINFO_SECTION_NAME ".rodata.sceModuleInfo"
119
120#define SDK_VERSION 0x06060010
121#define SCE_SDK_VERSION(ver) const int module_sdk_version = ver
122
126#define SCE_KERNEL_START_SUCCESS (0)
127#define SCE_KERNEL_START_FAIL (1)
129#define SCE_KERNEL_RESIDENT (SCE_KERNEL_START_SUCCESS)
130#define SCE_KERNEL_NO_RESIDENT (SCE_KERNEL_START_FAIL)
135#define SCE_KERNEL_STOP_SUCCESS (0)
136#define SCE_KERNEL_STOP_FAIL (1)
141#define SCE_MODULE_BOOTSTART(name) int module_start(SceSize argSize, const void *argBlock) __attribute__((alias(name))); \
142 int module_bootstart(SceSize argSize, const void *argBlock) __attribute__((alias(name)))
143
144#define SCE_MODULE_REBOOT_BEFORE(name) int module_reboot_before(void *arg0, s32 arg1, s32 arg2, s32 arg3) __attribute__((alias(name)))
145#define SCE_MODULE_REBOOT_BEFORE_FOR_USER(name) int module_reboot_before(SceSize arglen, void *argp) __attribute__((alias(name)))
146#define SCE_MODULE_REBOOT_PHASE(name) int module_reboot_phase(s32 arg1, void *arg2, s32 arg3, s32 arg4) __attribute__((alias(name)))
147#define SCE_MODULE_STOP(name) int module_stop(SceSize argSize, const void *argBlock) __attribute__((alias(name)))
148
149#define SCE_MODULE_INFO(name, attributes, majorVersion, minorVersion) \
150 __asm__ ( \
151 " .set push\n" \
152 " .section .lib.ent.top, \"a\", @progbits\n" \
153 " .align 2\n" \
154 " .word 0\n" \
155 "__lib_ent_top:\n" \
156 " .section .lib.ent.btm, \"a\", @progbits\n" \
157 " .align 2\n" \
158 "__lib_ent_bottom:\n" \
159 " .word 0\n" \
160 " .section .lib.stub.top, \"a\", @progbits\n" \
161 " .align 2\n" \
162 " .word 0\n" \
163 "__lib_stub_top:\n" \
164 " .section .lib.stub.btm, \"a\", @progbits\n" \
165 " .align 2\n" \
166 "__lib_stub_bottom:\n" \
167 " .word 0\n" \
168 " .set pop\n" \
169 " .text\n" \
170 ); \
171 extern char __lib_ent_top[], __lib_ent_bottom[]; \
172 extern char __lib_stub_top[], __lib_stub_bottom[]; \
173 const SceModuleInfo module_info \
174 __attribute__((section(SCE_MODINFO_SECTION_NAME), \
175 aligned(16), unused)) = { \
176 attributes, { minorVersion, majorVersion }, name, 0, _gp, \
177 __lib_ent_top, __lib_ent_bottom, \
178 __lib_stub_top, __lib_stub_bottom \
179 }
180
181#define SCE_MODULE_START_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
182 const SceModuleEntryThread module_start_thread_parameter = { numParams, initPriority, stackSize, attr };
183
184#define SCE_MODULE_STOP_THREAD_PARAMETER(numParams, initPriority, stackSize, attr) \
185 const SceModuleEntryThread module_stop_thread_parameter = { numParams, initPriority, stackSize, attr };
186
Definition module.h:20
void * stubEnd
Definition module.h:53
s8 terminal
Definition module.h:31
void * entTop
Definition module.h:38
void * gpValue
Definition module.h:33
u16 modAttribute
Definition module.h:25
void * entEnd
Definition module.h:43
void * stubTop
Definition module.h:48