Compare commits

...

9 Commits

Author SHA1 Message Date
Wouter Wijsman
c84807b850 Merge pull request #328 from GrayJack/load-core
refactor: Update `SceModule` definition
2025-09-15 23:00:46 +02:00
Wouter Wijsman
787b593c08 Merge pull request #327 from JoseAaronLopezGarcia/master
add kermit header and stubs
2025-09-15 20:12:43 +02:00
GrayJack
bd7e8509b3 refactor: Move SceKernelThreadEntry to psptypes.h
Avoids type definition conflicts.
2025-09-09 05:47:45 -03:00
GrayJack
c4df37300e refactor: Update SceModule definition 2025-09-09 05:21:43 -03:00
JoseAaronLopezGarcia
8660800f8c renamed header 2025-09-07 14:52:00 +02:00
JoseAaronLopezGarcia
9ba2c9ec4e improve header 2025-09-05 17:22:38 +02:00
JoseAaronLopezGarcia
6f541cfb8d use weak imports 2025-09-05 16:13:57 +02:00
JoseAaronLopezGarcia
eaf85fb61c fix config 2025-09-05 16:03:53 +02:00
JoseAaronLopezGarcia
bac379ba88 add kermit header and stubs 2025-09-05 15:53:40 +02:00
13 changed files with 675 additions and 58 deletions

View File

@@ -107,6 +107,7 @@ AC_CONFIG_FILES([Makefile
src/gu/Makefile
src/gum/Makefile
src/hprm/Makefile
src/kermit/Makefile
src/kernel/Makefile
src/libcglue/Makefile
src/libpthreadglue/Makefile

View File

@@ -11,6 +11,7 @@ SUBDIRS = \
gu \
gum \
hprm \
kermit \
kernel \
libcglue \
libpthreadglue \

View File

@@ -427,6 +427,9 @@ typedef struct ScePspDateTime {
unsigned int microsecond;
} ScePspDateTime;
/* Thread entry function type. */
typedef int (*SceKernelThreadEntry)(SceSize args, void *argp);
#ifdef __cplusplus
}
#endif

58
src/kermit/Makefile.am Normal file
View File

@@ -0,0 +1,58 @@
libdir = @PSPSDK_LIBDIR@
CC = @PSP_CC@
CCAS = $(CC)
AR = @PSP_AR@
RANLIB = @PSP_RANLIB@
CPPFLAGS = -I$(top_srcdir)/src/base -I$(top_srcdir)/src/kernel
CFLAGS = @PSPSDK_CFLAGS@
CCASFLAGS = $(CFLAGS)
KERMIT_DRIVER_OBJS = sceKermit_driver_0000.o sceKermit_driver_0001.o sceKermit_driver_0002.o sceKermit_driver_0003.o sceKermit_driver_0004.o sceKermit_driver_0005.o
KERMIT_FLASHFS_DRIVER_OBJS = sceKermitFlashfs_driver_0000.o sceKermitFlashfs_driver_0001.o
KERMIT_MSFS_DRIVER_OBJS = sceKermitMsfs_driver_0000.o sceKermitMsfs_driver_0001.o sceKermitMsfs_driver_0002.o sceKermitMsfs_driver_0003.o sceKermitMsfs_driver_0004.o sceKermitMsfs_driver_0005.o sceKermitMsfs_driver_0006.o
KERMIT_MEMORY_DRIVER_OBJS = sceKermitMemory_driver_0000.o sceKermitMemory_driver_0001.o sceKermitMemory_driver_0002.o sceKermitMemory_driver_0003.o
KERMIT_PERIPHERAL_OBJS = sceKermitPeripheral_0000.o sceKermitPeripheral_0001.o sceKermitPeripheral_0002.o sceKermitPeripheral_0003.o
KERMIT_PERIPHERAL_DRIVER_OBJS = sceKermitPeripheral_driver_0000.o sceKermitPeripheral_driver_0001.o sceKermitPeripheral_driver_0002.o sceKermitPeripheral_driver_0003.o sceKermitPeripheral_driver_0004.o sceKermitPeripheral_driver_0005.o sceKermitPeripheral_driver_0006.o sceKermitPeripheral_driver_0007.o sceKermitPeripheral_driver_0008.o sceKermitPeripheral_driver_0009.o sceKermitPeripheral_driver_0010.o sceKermitPeripheral_driver_0011.o sceKermitPeripheral_driver_0012.o sceKermitPeripheral_driver_0013.o sceKermitPeripheral_driver_0014.o sceKermitPeripheral_driver_0015.o sceKermitPeripheral_driver_0016.o sceKermitPeripheral_driver_0017.o sceKermitPeripheral_driver_0018.o
kermitincludedir = @PSPSDK_INCLUDEDIR@
kermitinclude_HEADERS = pspkermit.h
lib_LIBRARIES = libpspkermit_driver.a libpspkermitflashfs_driver.a libpspkermitmsfs_driver.a libpspkermitmemory_driver.a libpspkermitperipheral.a libpspkermitperipheral_driver.a
libpspkermit_driver_a_SOURCES = sceKermit_driver.S
libpspkermit_driver_a_LIBADD = $(KERMIT_DRIVER_OBJS)
libpspkermitflashfs_driver_a_SOURCES = sceKermitFlashfs_driver.S
libpspkermitflashfs_driver_a_LIBADD = $(KERMIT_FALSHFS_DRIVER_OBJS)
libpspkermitmsfs_driver_a_SOURCES = sceKermitMsfs_driver.S
libpspkermitmsfs_driver_a_LIBADD = $(KERMIT_MSFS_DRIVER_OBJS)
libpspkermitmemory_driver_a_SOURCES = sceKermitMemory_driver.S
libpspkermitmemory_driver_a_LIBADD = $(KERMIT_MEMORY_DRIVER_OBJS)
libpspkermitperipheral_a_SOURCES = sceKermitPeripheral.S
libpspkermitperipheral_a_LIBADD = $(KERMIT_PERIPHERAL_OBJS)
libpspkermitperipheral_driver_a_SOURCES = sceKermitPeripheral_driver.S
libpspkermitperipheral_driver_a_LIBADD = $(KERMIT_PERIPHERAL_DRIVER_OBJS)
$(KERMIT_DRIVER_OBJS): sceKermit_driver.S
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
$(KERMIT_FLASHFS_DRIVER_OBJS): sceKermitFlashfs_driver.S
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
$(KERMIT_MSFS_DRIVER_OBJS): sceKermitMsfs_driver.S
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
$(KERMIT_MEMORY_DRIVER_OBJS): sceKermitMemory_driver.S
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
$(KERMIT_PERIPHERAL_OBJS): sceKermitPeripheral.S
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
$(KERMIT_PERIPHERAL_DRIVER_OBJS): sceKermitPeripheral_driver.S
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@

264
src/kermit/pspkermit.h Normal file
View File

@@ -0,0 +1,264 @@
#ifndef __KERMIT_H__
#define __KERMIT_H__
#include <pspsdk.h>
#define KERMIT_MAX_ARGC (14)
/* kermit KERMIT_MODE_PERIPHERAL commands */
#define KERMIT_CMD_RTC_GET_CURRENT_TICK (0x0)
#define KERMIT_CMD_ID_STORAGE_LOOKUP (0x1)
#define KERMIT_CMD_POWER_FREQUENCY (0x2)
#define KERMIT_CMD_AUDIO_ROUTING (0x3)
#define KERMIT_CMD_GET_CAMERA_DIRECTION (0x5)
#define KERMIT_CMD_GET_IDPSC_ENABLE (0x6)
#define KERMIT_CMD_DISABLE_MULTITASKING (0x7)
#define KERMIT_CMD_ERROR_EXIT (0x8)
#define KERMIT_CMD_ERROR_EXIT_2 (0x422)
#define KERMIT_CMD_ENABLE_MULTITASKING (0x9)
#define KERMIT_CMD_RESUME_DEVICE (0xA)
#define KERMIT_CMD_REQUEST_SUSPEND (0xB)
#define KERMIT_CMD_IS_FIRST_BOOT (0xC)
#define KERMIT_CMD_GET_PREFIX_SSID (0xD)
#define KERMIT_CMD_SET_PS_BUTTON_STATE (0x10)
/* kermit KERMIT_MODE_MSFS commands */
#define KERMIT_CMD_INIT_MS (0x0)
#define KERMIT_CMD_EXIT_MS (0x1)
#define KERMIT_CMD_OPEN_MS (0x2)
#define KERMIT_CMD_CLOSE_MS (0x3)
#define KERMIT_CMD_READ_MS (0x4)
#define KERMIT_CMD_WRITE_MS (0x5)
#define KERMIT_CMD_SEEK_MS (0x6)
#define KERMIT_CMD_IOCTL_MS (0x7)
#define KERMIT_CMD_REMOVE_MS (0x8)
#define KERMIT_CMD_MKDIR_MS (0x9)
#define KERMIT_CMD_RMDIR_MS (0xA)
#define KERMIT_CMD_DOPEN_MS (0xB)
#define KERMIT_CMD_DCLOSE_MS (0xC)
#define KERMIT_CMD_DREAD_MS (0xD)
#define KERMIT_CMD_GETSTAT_MS (0xE)
#define KERMIT_CMD_CHSTAT_MS (0xF)
#define KERMIT_CMD_RENAME_MS (0x10)
#define KERMIT_CMD_CHDIR_MS (0x11)
#define KERMIT_CMD_DEVCTL (0x14)
/* kermit KERMIT_MODE_AUDIO commands */
#define KERMIT_CMD_INIT_AUDIO_IN 0x0
#define KERMIT_CMD_OUTPUT_1 0x1
#define KERMIT_CMD_OUTPUT_2 0x2
#define KERMIT_CMD_SUSPEND_AUDIO 0x3
#define KERMIT_CMD_RESUME 0x4
/* kermit KERMIT_MODE_ME commands */
#define KERMIT_CMD_UNK0 0x0
#define KERMIT_CMD_SETAVC_TIMESTAMPINTERNAL 0x1
#define KERMIT_CMD_BOOT_START 0x2
/* kermit KERMIT_MODE_LOWIO commands */
#define KERMIT_CMD_UNK9 0x9
#define KERMIT_CMD_UNKA 0xA
#define KERMIT_CMD_UNKB 0xB
#define KERMIT_CMD_UNKC 0xC
/* kermit KERMIT_MODE_WLAN commands */
#define KERMIT_CMD_INIT 0x0
#define KERMIT_CMD_GET_SWITCH_INTERNAL_STATE 0x2
#define KERMIT_CMD_GET_ETHER_ADDR 0x3
#define KERMIT_CMD_ADHOC_CTL_INIT 0x6
#define KERMIT_CMD_ADHOC_CTL_TERM 0x7
#define KERMIT_CMD_ADHOC_SCAN 0x8
#define KERMIT_CMD_ADHOC_JOIN 0x9
#define KERMIT_CMD_ADHOC_CREATE 0xA
#define KERMIT_CMD_ADHOC_LEAVE 0xB
#define KERMIT_CMD_ADHOC_TX_DATA 0xC
#define KERMIT_CMD_ADHOC_RX_DATA 0xD
#define KERMIT_CMD_INET_INIT 0xE
#define KERMIT_CMD_INET_START 0xF
#define KERMIT_CMD_INET_TERM 0x10
#define KERMIT_CMD_INET_SOCKET 0x11
#define KERMIT_CMD_INET_CLOSE 0x12
#define KERMIT_CMD_INET_BIND 0x13
#define KERMIT_CMD_INET_LISTEN 0x14
#define KERMIT_CMD_INET_CONNECT 0x15
#define KERMIT_CMD_INET_SHUTDOWN 0x16
#define KERMIT_CMD_INET_POLL 0x17
#define KERMIT_CMD_INET_ACCEPT 0x18
#define KERMIT_CMD_INET_GET_PEER_NAME 0x19
#define KERMIT_CMD_INET_GET_SOCK_NAME 0x1A
#define KERMIT_CMD_INET_GET_OPT 0x1B
#define KERMIT_CMD_INET_SET_OPT 0x1C
#define KERMIT_CMD_INET_RECV_FROM 0x1D
#define KERMIT_CMD_INET_SENDTO_INTERNAL 0x1E
#define KERMIT_CMD_INET_SOIOCTL 0x1F
#define KERMIT_CMD_SUSPEND_WLAN 0x20
#define KERMIT_CMD_SET_WOL_PARAM 0x22
#define KERMIT_CMD_GET_WOL_INFO 0x23
#define KERMIT_CMD_SET_HOST_DISCOVER 0x24
/* kermit KERMIT_MODE_UTILITY commands */
#define KERMIT_CMD_OSK_START (0x0)
#define KERMIT_CMD_OSK_SHUTDOWN (0x1)
#define KERMIT_CMD_OSK_UPDATE (0x3)
/* kermit KERMIT_MODE_USB commands */
#define KERMIT_CMD_INIT 0x0
#define KERMIT_CMD_ACTIVATE 0x15
#define KERMIT_CMD_DEACTIVATE 0x16
#define KERMIT_CMD_SET_OP 0x19
#define KERMIT_CMD_SET_OP_BIS 0x1A
#define KERMIT_CMD_UNK1B 0x1B
/* KERMIT_PACKET address macros */
#define KERNEL(x) ((x & 0x80000000)? 1:0)
#define KERMIT_PACKET(x) (x | (2-KERNEL(x))*0x20000000)
#define ALIGN_64(x) ((x) & -64)
#define KERMIT_CALLBACK_DISABLE 0
enum KermitModes {
KERMIT_MODE_NONE,
KERMIT_MODE_UNK_1,
KERMIT_MODE_UNK_2,
KERMIT_MODE_MSFS,
KERMIT_MODE_FLASHFS,
KERMIT_MODE_AUDIOOUT,
KERMIT_MODE_ME,
KERMIT_MODE_LOWIO,
KERMIT_MODE_POCS_USBPSPCM,
KERMIT_MODE_PERIPHERAL,
KERMIT_MODE_WLAN,
KERMIT_MODE_AUDIOIN,
KERMIT_MODE_USB,
KERMIT_MODE_UTILITY,
KERMIT_MODE_EXTRA_1,
KERMIT_MODE_EXTRA_2,
};
enum KermitVirtualInterrupts {
KERMIT_VIRTUAL_INTR_NONE,
KERMIT_VIRTUAL_INTR_AUDIO_CH1,
KERMIT_VIRTUAL_INTR_AUDIO_CH2,
KERMIT_VIRTUAL_INTR_AUDIO_CH3,
KERMIT_VIRTUAL_INTR_ME_DMA_CH1,
KERMIT_VIRTUAL_INTR_ME_DMA_CH2,
KERMIT_VIRTUAL_INTR_ME_DMA_CH3,
KERMIT_VIRTUAL_INTR_WLAN_CH1,
KERMIT_VIRTUAL_INTR_WLAN_CH2,
KERMIT_VIRTUAL_INTR_IMPOSE_CH1,
KERMIT_VIRTUAL_INTR_POWER_CH1,
KERMIT_VIRTUAL_INTR_UNKNOWN_CH1, // <- used after settings
KERMIT_VIRTUAL_INTR_USBGPS_CH1,
KERMIT_VIRTUAL_INTR_USBPSPCM_CH1,
};
enum KermitArgumentModes {
KERMIT_INPUT_MODE = 0x1,
KERMIT_OUTPUT_MODE = 0x2,
};
typedef struct {
uint32_t cmd; //0x0
SceUID sema_id; //0x4
uint64_t *response; //0x8
uint32_t padding; //0xC
uint64_t args[14]; // 0x10
} SceKermitRequest; //0x80
// 0xBFC00800
typedef struct {
uint32_t cmd; //0x00
SceKermitRequest *request; //0x04
} SceKermitCommand; //0x8
// 0xBFC00840
typedef struct {
uint64_t result; //0x0
SceUID sema_id; //0x8
int32_t unk_C; //0xC
uint64_t *response; //0x10
uint64_t unk_1C; //0x1C
} SceKermitResponse; //0x24 or 0x30????
// 0xBFC008C0
typedef struct {
int32_t unk_0; //0x0
int32_t unk_4; //0x4
} SceKermitInterrupt; //0x8
typedef struct KermitPacket_
{
u32 cmd; //0x0
SceUID sema; //0x4
struct KermitPacket_ *self; //0x8
u32 unk_C; //0xC
} KermitPacket;
/*
Issue a command to kermit.
packet: a kermit packet. Header followed by 64 bit words (LE) as arguements.
cmd_mode: a valid command mode type.
cmd: a valid command subtype of cmd_mode.
argc: the number of 64 bit arguements following the header. Max 13 arguements.
allow_callback: set non-zero to use callback permitting semaphore wait.
resp: 64 bit word returned by the kermit call.
returns 0 on success, else < 0 on error.
*/
int sceKermit_driver_4F75AA05(KermitPacket *packet, u32 cmd_mode, u32 cmd, u32 argc, u32 allow_callback, u64 *resp);
/*
Apply IO to kermit packet.
packet: a kermit packet. Header followed by 64 bit words (LE) as arguements.
argc: the number of arguements in the packet. Max 13 arguements.
buffer: the input buffer containing the data to be sent or the output buffer to store data.
buffer_size: the size of the input data, else the size of the output buffer.
io_mode: KERMIT_INPUT_MODE for data input. KERMIT_OUTPUT_MODE for expecting output data.
*/
void sceKermitMemorySetArgument(KermitPacket *packet, u32 argc, u8 *buffer, u32 buffer_size, u32 io_mode);
/*
Send data to vita host.
data: pointer to the data to be sent to host.
len: the size of the data to be sent.
*/
void sceKermitMemory_driver_80E1240A(u8 *data, u32 len);
/*
Recieve data from vita host.
data: pointer to buffer to store output data.
len: the size of the expected output data.
*/
void sceKermitMemory_driver_90B662D0(u8 *data, u32 data_size);
/*
Register handler for a kermit virtual interrupt.
interrupt: ID of the virtual interrupt.
handler: function pointer.
returns 0 on success, else < 0 on error.
*/
int sceKermitRegisterVirtualIntrHandler(u32 interrupt, void* handler);
/*
Send a request to kermit.
request: pointer to SceKermitRequest data structure.
mode: ID of the request mode (see enum KermitModes).
cmd: request command ID.
argc: unknown, pass 0.
callback: callback mode, pass KERMIT_CALLBACK_DISABLE (0).
response: pointer to return value.
returns 0 on success, else < 0 on error.
*/
int sceKermitSendRequest(SceKermitRequest* request, u32 mode, u32 cmd, int argc, u32 callback, u64* response);
#endif /* __KERMIT_H__ */

View File

@@ -0,0 +1,10 @@
.set noreorder
#include "pspimport.s"
#ifdef F_sceKermitFlashfs_driver_0000
IMPORT_START "sceKermitFlashfs_driver",0x00090000
#endif
#ifdef F_sceKermitFlashfs_driver_0001
IMPORT_FUNC "sceKermitFlashfs_driver",0x78D76B63,sceKermitFlashfs_driver_78D76B63
#endif

View File

@@ -0,0 +1,16 @@
.set noreorder
#include "pspimport.s"
#ifdef F_sceKermitMemory_driver_0000
IMPORT_START "sceKermitMemory_driver",0x00090000
#endif
#ifdef F_sceKermitMemory_driver_0001
IMPORT_FUNC "sceKermitMemory_driver",0x80E1240A,sceKermitMemory_driver_80E1240A
#endif
#ifdef F_sceKermitMemory_driver_0002
IMPORT_FUNC "sceKermitMemory_driver",0x90B662D0,sceKermitMemory_driver_90B662D0
#endif
#ifdef F_sceKermitMemory_driver_0003
IMPORT_FUNC "sceKermitMemory_driver",0xAAF047AC,sceKermitMemorySetArgument
#endif

View File

@@ -0,0 +1,25 @@
.set noreorder
#include "pspimport.s"
#ifdef F_sceKermitMsfs_driver_0000
IMPORT_START "sceKermitMsfs_driver",0x00090000
#endif
#ifdef F_sceKermitMsfs_driver_0001
IMPORT_FUNC "sceKermitMsfs_driver",0x1A4DC9B7,sceKermitMsfs_driver_1A4DC9B7
#endif
#ifdef F_sceKermitMsfs_driver_0002
IMPORT_FUNC "sceKermitMsfs_driver",0x7668D90C,sceKermitMsfs_driver_7668D90C
#endif
#ifdef F_sceKermitMsfs_driver_0003
IMPORT_FUNC "sceKermitMsfs_driver",0x93B61A29,sceKermitMsfs_driver_93B61A29
#endif
#ifdef F_sceKermitMsfs_driver_0004
IMPORT_FUNC "sceKermitMsfs_driver",0xBE954163,sceKermitMsfs_driver_BE954163
#endif
#ifdef F_sceKermitMsfs_driver_0005
IMPORT_FUNC "sceKermitMsfs_driver",0xC1B4213A,sceKermitMsfs_driver_C1B4213A
#endif
#ifdef F_sceKermitMsfs_driver_0006
IMPORT_FUNC "sceKermitMsfs_driver",0xEAD1D2C6,sceKermitMsfs_driver_EAD1D2C6
#endif

View File

@@ -0,0 +1,16 @@
.set noreorder
#include "pspimport.s"
#ifdef F_sceKermitPeripheral_0000
IMPORT_START "sceKermitPeripheral",0x40090000
#endif
#ifdef F_sceKermitPeripheral_0001
IMPORT_FUNC "sceKermitPeripheral",0x4A26B7C8,sceKermitPeripheral_4A26B7C8
#endif
#ifdef F_sceKermitPeripheral_0002
IMPORT_FUNC "sceKermitPeripheral",0xC0EBC631,sceKermitPeripheral_C0EBC631
#endif
#ifdef F_sceKermitPeripheral_0003
IMPORT_FUNC "sceKermitPeripheral",0xD27C5E03,sceKermitPeripheral_D27C5E03
#endif

View File

@@ -0,0 +1,61 @@
.set noreorder
#include "pspimport.s"
#ifdef F_sceKermitPeripheral_driver_0000
IMPORT_START "sceKermitPeripheral_driver",0x00090000
#endif
#ifdef F_sceKermitPeripheral_driver_0001
IMPORT_FUNC "sceKermitPeripheral_driver",0x0648E1A3,sceKermitPeripheral_driver_0648E1A3
#endif
#ifdef F_sceKermitPeripheral_driver_0002
IMPORT_FUNC "sceKermitPeripheral_driver",0x15F5C107,sceKermitPeripheral_driver_15F5C107
#endif
#ifdef F_sceKermitPeripheral_driver_0003
IMPORT_FUNC "sceKermitPeripheral_driver",0x1617E966,sceKermitPeripheral_driver_1617E966
#endif
#ifdef F_sceKermitPeripheral_driver_0004
IMPORT_FUNC "sceKermitPeripheral_driver",0x20638B97,sceKermitPeripheral_driver_20638B97
#endif
#ifdef F_sceKermitPeripheral_driver_0005
IMPORT_FUNC "sceKermitPeripheral_driver",0x4A26B7C8,sceKermitPeripheral_driver_4A26B7C8
#endif
#ifdef F_sceKermitPeripheral_driver_0006
IMPORT_FUNC "sceKermitPeripheral_driver",0x55D690DD,sceKermitPeripheral_driver_55D690DD
#endif
#ifdef F_sceKermitPeripheral_driver_0007
IMPORT_FUNC "sceKermitPeripheral_driver",0x61BEA1D2,sceKermitPeripheral_driver_61BEA1D2
#endif
#ifdef F_sceKermitPeripheral_driver_0008
IMPORT_FUNC "sceKermitPeripheral_driver",0x65D98A21,sceKermitPeripheral_driver_65D98A21
#endif
#ifdef F_sceKermitPeripheral_driver_0009
IMPORT_FUNC "sceKermitPeripheral_driver",0x675DB2C1,sceKermitPeripheral_driver_675DB2C1
#endif
#ifdef F_sceKermitPeripheral_driver_0010
IMPORT_FUNC "sceKermitPeripheral_driver",0x6D6AA215,sceKermitPeripheral_driver_6D6AA215
#endif
#ifdef F_sceKermitPeripheral_driver_0011
IMPORT_FUNC "sceKermitPeripheral_driver",0x76BE2E28,sceKermitPeripheral_driver_76BE2E28
#endif
#ifdef F_sceKermitPeripheral_driver_0012
IMPORT_FUNC "sceKermitPeripheral_driver",0x8C7903E7,sceKermitPeripheral_driver_8C7903E7
#endif
#ifdef F_sceKermitPeripheral_driver_0013
IMPORT_FUNC "sceKermitPeripheral_driver",0x9EF7501D,sceKermitPeripheral_driver_9EF7501D
#endif
#ifdef F_sceKermitPeripheral_driver_0014
IMPORT_FUNC "sceKermitPeripheral_driver",0xAB29C68B,sceKermitPeripheral_driver_AB29C68B
#endif
#ifdef F_sceKermitPeripheral_driver_0015
IMPORT_FUNC "sceKermitPeripheral_driver",0xB778DB22,sceKermitPeripheral_driver_B778DB22
#endif
#ifdef F_sceKermitPeripheral_driver_0016
IMPORT_FUNC "sceKermitPeripheral_driver",0xB93A88E2,sceKermitPeripheral_driver_B93A88E2
#endif
#ifdef F_sceKermitPeripheral_driver_0017
IMPORT_FUNC "sceKermitPeripheral_driver",0xC6F8B4E1,sceKermitPeripheral_driver_C6F8B4E1
#endif
#ifdef F_sceKermitPeripheral_driver_0018
IMPORT_FUNC "sceKermitPeripheral_driver",0xD0A69002,sceKermitPeripheral_driver_D0A69002
#endif

View File

@@ -0,0 +1,22 @@
.set noreorder
#include "pspimport.s"
#ifdef F_sceKermit_driver_0000
IMPORT_START "sceKermit_driver",0x00090000
#endif
#ifdef F_sceKermit_driver_0001
IMPORT_FUNC "sceKermit_driver",0x36666181,sceKermitSendRequest
#endif
#ifdef F_sceKermit_driver_0002
IMPORT_FUNC "sceKermit_driver",0x4C3A362D,sceKermit_driver_4C3A362D
#endif
#ifdef F_sceKermit_driver_0003
IMPORT_FUNC "sceKermit_driver",0x5280B410,sceKermitRegisterVirtualIntrHandler
#endif
#ifdef F_sceKermit_driver_0004
IMPORT_FUNC "sceKermit_driver",0x9DDD7DCA,sceKermit_driver_9DDD7DCA
#endif
#ifdef F_sceKermit_driver_0005
IMPORT_FUNC "sceKermit_driver",0xD69C50BB,sceKermit_driver_D69C50BB
#endif

View File

@@ -26,32 +26,174 @@ extern "C" {
/** @addtogroup LoadCore Interface to the LoadCoreForKernel library. */
/**@{*/
/** Describes a module. This structure could change in future firmware revisions. */
/** Reboot preparation functions */
typedef s32 (*SceKernelRebootBeforeForKernel)(void *arg1, s32 arg2, s32 arg3, s32 arg4);
typedef s32 (*SceKernelRebootPhaseForKernel)(s32 arg1, void *arg2, s32 arg3, s32 arg4);
/** Module type attributes. */
enum SceModuleAttribute {
/** No module attributes. */
SCE_MODULE_ATTR_NONE = 0x0000,
/** Resident module - stays in memory. You cannot unload such a module. */
SCE_MODULE_ATTR_CANT_STOP = 0x0001,
/**
* Only one instance of the module (one version) can be loaded into the system. If you want to load another
* version of that module, you have to delete the loaded version first.
*/
SCE_MODULE_ATTR_EXCLUSIVE_LOAD = 0x0002,
/**
* Only one instance of the module (one version) can be started. If you want to start another
* version of that module, you have to stop the currently running version first.
*/
SCE_MODULE_ATTR_EXCLUSIVE_START = 0x0004,
};
/**
* Module Privilege Levels - These levels define the permissions a
* module can have.
*/
enum SceModulePrivilegeLevel {
/** Lowest permission. */
SCE_MODULE_USER = 0x0000,
/** POPS/Demo. */
SCE_MODULE_MS = 0x0200,
/** Module Gamesharing. */
SCE_MODULE_USB_WLAN = 0x0400,
/** Application module. */
SCE_MODULE_APP = 0x0600,
/** VSH module. */
SCE_MODULE_VSH = 0x0800,
/** Highest permission. */
SCE_MODULE_KERNEL = 0x1000,
/** The module uses KIRK's memlmd resident library. */
SCE_MODULE_KIRK_MEMLMD_LIB = 0x2000,
/** The module uses KIRK's semaphore resident library. */
SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
};
/** Describes a loaded module in memory. This structure could change in future firmware revisions. */
typedef struct SceModule {
struct SceModule *next;
unsigned short attribute;
unsigned char version[2];
char modname[27];
char terminal;
unsigned int unknown1;
unsigned int unknown2;
SceUID modid;
unsigned int unknown3[4];
void * ent_top;
unsigned int ent_size;
void * stub_top;
unsigned int stub_size;
unsigned int unknown4[4];
unsigned int entry_addr;
unsigned int gp_value;
unsigned int text_addr;
unsigned int text_size;
unsigned int data_size;
unsigned int bss_size;
unsigned int nsegment;
unsigned int segmentaddr[4];
unsigned int segmentsize[4];
} __attribute__((packed)) SceModule;
/** Pointer to the next registered module. Modules are connected via a linked list. */
struct SceModule *next;
/** The attributes of a module. One or more of ::SceModuleAttribute and ::SceModulePrivilegeLevel. */
u16 attribute;
/**
* The version of the module. Consists of a major and minor part. There can be several modules
* loaded with the same name and version.
*/
u8 version[2];
/** The module's name. There can be several modules loaded with the same name. */
char modname[27];
/** String terminator (always '\0'). */
char terminal;
/**
* The status of the module. Contains information whether the module has been started, stopped,
* is a user module, etc.
*/
u16 mod_state;
char padding[2];
/** A secondary ID for the module. */
SceUID sec_id;
/** The module's UID. */
SceUID modid;
/** The thread ID of a user module. */
SceUID user_mod_thid;
/** The ID of the memory block belonging to the module. */
SceUID mem_id;
/** The ID of the TEXT segment's memory partition. */
u32 mpid_text;
/** The ID of the DATA segment's memory partition. */
u32 mpid_data;
/** Pointer to the first resident library entry table of the module. */
void * ent_top;
/** The size of all resident library entry tables of the module. */
SceSize ent_size;
/** Pointer to the first stub library entry table of the module. */
void * stub_top;
/** The size of all stub library entry tables of the module. */
SceSize stub_size;
/**
* A pointer to the (required) module's start entry function. This function is executed during
* the module's startup.
*/
SceKernelThreadEntry module_start;
/**
* A pointer to the (required) module's stop entry function. This function is executed during
* the module's stopping phase.
*/
SceKernelThreadEntry module_stop;
/**
* A pointer to a module's Bootstart entry function. This function is probably executed after
* a reboot.
*/
SceKernelThreadEntry module_bootstart;
/**
* A pointer to a module's rebootBefore entry function. This function is probably executed
* before a reboot.
*/
SceKernelRebootBeforeForKernel module_reboot_before;
/**
* A pointer to a module's rebootPhase entry function. This function is probably executed
* during a reboot.
*/
SceKernelRebootPhaseForKernel module_reboot_phase;
/**
* The entry address of the module. It is the offset from the start of the TEXT segment to the
* program's entry point.
*/
u32 entry_addr;
/** Contains the offset from the start of the TEXT segment of the program's GP register value. */
u32 gp_value;
/** The start address of the TEXT segment. */
u32 text_addr;
/** The size of the TEXT segment. */
u32 text_size;
/** The size of the DATA segment. */
u32 data_size;
/** The size of the BSS segment. */
u32 bss_size;
/** The number of segments the module consists of. */
u8 nsegment;
/** Reserved. */
u8 padding2[3];
/** An array containing the start address of each segment. */
u32 segmentaddr[4];
/** An array containing the size of each segment. */
SceSize segmentsize[4];
/** An array containing the alignment information of each segment. */
u32 segmentalign[4];
/** The priority of the module start thread. */
s32 module_start_thread_priority;
/** The stack size of the module start thread. */
SceSize module_start_thread_stacksize;
/** The attributes of the module start thread. */
SceUInt module_start_thread_attr;
/** The priority of the module stop thread. */
s32 module_stop_thread_priority;
/** The stack size of the module stop thread. */
SceSize module_stop_thread_stacksize;
/** The attributes of the module stop thread. */
SceUInt module_stop_thread_attr;
/** The priority of the module reboot before thread. */
s32 module_reboot_before_thread_priority;
/** The stack size of the module reboot before thread. */
SceSize module_reboot_before_thread_stacksize;
/** The attributes of the module reboot before thread. */
SceUInt module_reboot_before_thread_attr;
/** The value of the coprocessor 0's count register when the module is created. */
u32 count_reg_val;
/** The segment checksum of the module's segments. */
u32 segment_checksum;
/** TEXT segment checksum of the module. */
u32 text_segment_checksum;
/**
* Whether to compute the text segment checksum before starting the module (see prologue).
* If non-zero, the text segment checksum will be computed after the module's resident libraries
* have been registered, and its stub libraries have been linked.
*/
u32 compute_text_segment_checksum;
} SceModule;
/** Defines a library and its exported functions and variables. Use the len
member to determine the real size of the table (size = len * 4). */

View File

@@ -46,7 +46,7 @@ enum PspThreadAttributes
{
/** Enable VFPU access for the thread. */
PSP_THREAD_ATTR_VFPU = 0x00004000,
/** Start the thread in user mode (done automatically
/** Start the thread in user mode (done automatically
if the thread creating it is in user mode). */
PSP_THREAD_ATTR_USER = 0x80000000,
/** Thread is part of the USB/WLAN API. */
@@ -68,8 +68,6 @@ enum PspThreadAttributes
/* Threads. */
typedef int (*SceKernelThreadEntry)(SceSize args, void *argp);
/** Additional options used when creating threads. */
typedef struct SceKernelThreadOptParam {
/** Size of the ::SceKernelThreadOptParam structure. */
@@ -193,7 +191,7 @@ int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp);
*/
int sceKernelExitThread(int status);
/**
/**
* Exit a thread and delete itself.
*
* @param status - Exit status
@@ -228,7 +226,7 @@ int sceKernelSuspendDispatchThread(void);
/**
* Resume the dispatch thread
*
* @param state - The state of the dispatch thread
* @param state - The state of the dispatch thread
* (from ::sceKernelSuspendDispatchThread)
*
* @return 0 on success, < 0 on error
@@ -289,7 +287,7 @@ int sceKernelSuspendThread(SceUID thid);
*/
int sceKernelResumeThread(SceUID thid);
/**
/**
* Wait until a thread has ended.
*
* @param thid - Id of the thread to wait for.
@@ -299,7 +297,7 @@ int sceKernelResumeThread(SceUID thid);
*/
int sceKernelWaitThreadEnd(SceUID thid, SceUInt *timeout);
/**
/**
* Wait until a thread has ended and handle callbacks if necessary.
*
* @param thid - Id of the thread to wait for.
@@ -364,7 +362,7 @@ int sceKernelChangeCurrentThreadAttr(int unknown, SceUInt attr);
/**
* Change the threads current priority.
*
*
* @param thid - The ID of the thread (from sceKernelCreateThread or sceKernelGetThreadId)
* @param priority - The new priority (the lower the number the higher the priority)
*
@@ -383,7 +381,7 @@ int sceKernelChangeThreadPriority(SceUID thid, int priority);
* Rotate thread ready queue at a set priority
*
* @param priority - The priority of the queue
*
*
* @return 0 on success, < 0 on error.
*/
int sceKernelRotateThreadReadyQueue(int priority);
@@ -397,7 +395,7 @@ int sceKernelRotateThreadReadyQueue(int priority);
*/
int sceKernelReleaseWaitThread(SceUID thid);
/**
/**
* Get the current thread Id
*
* @return The thread id of the calling thread.
@@ -437,9 +435,9 @@ int sceKernelCheckThreadStack(void);
*/
int sceKernelGetThreadStackFreeSize(SceUID thid);
/**
/**
* Get the status information for the specified thread.
*
*
* @param thid - Id of the thread to get status
* @param info - Pointer to the info structure to receive the data.
* Note: The structures size field should be set to
@@ -451,7 +449,7 @@ int sceKernelGetThreadStackFreeSize(SceUID thid);
* status.size = sizeof(SceKernelThreadInfo);
* if(sceKernelReferThreadStatus(thid, &status) == 0)
* { Do something... }
* @endcode
* @endcode
* @return 0 if successful, otherwise the error code.
*/
int sceKernelReferThreadStatus(SceUID thid, SceKernelThreadInfo *info);
@@ -506,7 +504,7 @@ typedef struct SceKernelSemaInfo {
*
* @param name - Specifies the name of the sema
* @param attr - Sema attribute flags (normally set to 0)
* @param initVal - Sema initial value
* @param initVal - Sema initial value
* @param maxVal - Sema maximum value
* @param option - Sema options (normally set to 0)
* @return A semaphore id
@@ -707,7 +705,7 @@ enum PspEventFlagWaitTypes
PSP_EVENT_WAITCLEAR = 0x20
};
/**
/**
* Create an event flag.
*
* @param name - The name of the event flag.
@@ -724,7 +722,7 @@ enum PspEventFlagWaitTypes
*/
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt);
/**
/**
* Set an event flag bit pattern.
*
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -744,7 +742,7 @@ int sceKernelSetEventFlag(SceUID evid, u32 bits);
*/
int sceKernelClearEventFlag(SceUID evid, u32 bits);
/**
/**
* Poll an event flag for a given bit pattern.
*
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -755,7 +753,7 @@ int sceKernelClearEventFlag(SceUID evid, u32 bits);
*/
int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
/**
/**
* Wait for an event flag for a given bit pattern.
*
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -767,7 +765,7 @@ int sceKernelPollEventFlag(int evid, u32 bits, u32 wait, u32 *outBits);
*/
int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
/**
/**
* Wait for an event flag for a given bit pattern with callback.
*
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -779,7 +777,7 @@ int sceKernelWaitEventFlag(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *
*/
int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout);
/**
/**
* Delete an event flag
*
* @param evid - The event id returned by sceKernelCreateEventFlag.
@@ -788,9 +786,9 @@ int sceKernelWaitEventFlagCB(int evid, u32 bits, u32 wait, u32 *outBits, SceUInt
*/
int sceKernelDeleteEventFlag(int evid);
/**
/**
* Get the status of an event flag.
*
*
* @param event - The UID of the event.
* @param status - A pointer to a ::SceKernelEventFlagInfo structure.
*
@@ -878,7 +876,7 @@ int sceKernelDeleteMbx(SceUID mbxid);
*
* @param mbxid - The mbx id returned from sceKernelCreateMbx
* @param message - A message to be forwarded to the receiver.
* The start of the message should be the
* The start of the message should be the
* ::SceKernelMsgPacket structure, the rest
*
* @return < 0 On error.
@@ -984,7 +982,7 @@ typedef struct SceKernelAlarmInfo {
void * common;
} SceKernelAlarmInfo;
/**
/**
* Set an alarm.
* @param clock - The number of micro seconds till the alarm occurrs.
* @param handler - Pointer to a ::SceKernelAlarmHandler
@@ -996,11 +994,11 @@ SceUID sceKernelSetAlarm(SceUInt clock, SceKernelAlarmHandler handler, void *com
/**
* Set an alarm using a ::SceKernelSysClock structure for the time
*
*
* @param clock - Pointer to a ::SceKernelSysClock structure
* @param handler - Pointer to a ::SceKernelAlarmHandler
* @param common - Common pointer for the alarm handler.
*
*
* @return A UID representing the created alarm, < 0 on error.
*/
SceUID sceKernelSetSysClockAlarm(SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common);
@@ -1142,7 +1140,7 @@ enum SceKernelIdListType
};
/**
* Get a list of UIDs from threadman. Allows you to enumerate
* Get a list of UIDs from threadman. Allows you to enumerate
* resources such as threads or semaphores.
*
* @param type - The type of resource to list, one of ::SceKernelIdListType.
@@ -1305,7 +1303,7 @@ typedef struct SceKernelMppInfo {
int numSendWaitThreads;
int numReceiveWaitThreads;
} SceKernelMppInfo;
/**
* Get the status of a Message Pipe
*
@@ -1369,7 +1367,7 @@ int sceKernelAllocateVpl(SceUID uid, unsigned int size, void **data, unsigned in
int sceKernelAllocateVplCB(SceUID uid, unsigned int size, void **data, unsigned int *timeout);
/**
* Try to allocate from the pool
* Try to allocate from the pool
*
* @param uid - The UID of the pool
* @param size - The size to allocate
@@ -1471,7 +1469,7 @@ int sceKernelAllocateFpl(SceUID uid, void **data, unsigned int *timeout);
int sceKernelAllocateFplCB(SceUID uid, void **data, unsigned int *timeout);
/**
* Try to allocate from the pool
* Try to allocate from the pool
*
* @param uid - The UID of the pool
* @param data - Receives the address of the allocated data
@@ -1527,7 +1525,7 @@ int sceKernelReferFplStatus(SceUID uid, SceKernelFplInfo *info);
void _sceKernelReturnFromTimerHandler(void);
/**
* Return from a callback (used as a syscall for the return
* Return from a callback (used as a syscall for the return
* of the callback function)
*/
void _sceKernelReturnFromCallback(void);
@@ -1544,7 +1542,7 @@ int sceKernelUSec2SysClock(unsigned int usec, SceKernelSysClock *clock);
/**
* Convert a number of microseconds to a wide time
*
*
* @param usec - Number of microseconds.
*
* @return The time
@@ -1762,7 +1760,7 @@ void _sceKernelExitThread(void);
* Get the type of a threadman uid
*
* @param uid - The uid to get the type from
*
*
* @return The type, < 0 on error
*/
enum SceKernelIdListType sceKernelGetThreadmanIdType(SceUID uid);