Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/kernel/InitForKernel.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
IMPORT_FUNC "InitForKernel",0x2C6E9FE9,sceKernelGetChunk
#endif
#ifdef F_InitForKernel_0004
IMPORT_FUNC "InitForKernel",0x33D30F49,InitForKernel_33D30F49
IMPORT_FUNC "InitForKernel",0x33D30F49,sceKernelShowIntrHandlerInfo
#endif
#ifdef F_InitForKernel_0005
IMPORT_FUNC_WITH_ALIAS "InitForKernel",0x7233B5BC,sceKernelApplicationType,sceKernelInitKeyConfig
Expand All @@ -24,17 +24,17 @@
IMPORT_FUNC "InitForKernel",0x7A2333AD,sceKernelInitApitype
#endif
#ifdef F_InitForKernel_0007
IMPORT_FUNC "InitForKernel",0x9F9AE99C,InitForKernel_9F9AE99C
IMPORT_FUNC "InitForKernel",0x9F9AE99C,sceKernelSetInitCallback
#endif
#ifdef F_InitForKernel_0008
IMPORT_FUNC "InitForKernel",0xA6E71B93,sceKernelInitFileName
#endif
#ifdef F_InitForKernel_0009
IMPORT_FUNC "InitForKernel",0xC4F1BA33,InitForKernel_C4F1BA33
IMPORT_FUNC "InitForKernel",0xC4F1BA33,sceKernelStartIntrLogging
#endif
#ifdef F_InitForKernel_0010
IMPORT_FUNC "InitForKernel",0xCE88E870,sceKernelReleaseChunk
#endif
#ifdef F_InitForKernel_0011
IMPORT_FUNC "InitForKernel",0xFD0F25AD,InitForKernel_FD0F25AD
IMPORT_FUNC "InitForKernel",0xFD0F25AD,sceKernelShowIntrMaskTime
#endif
9 changes: 9 additions & 0 deletions src/kernel/pspintrman_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ int sceKernelDisableIntr(int intno);
*/
int sceKernelIsIntrContext(void);

/**
* Query system call number of `function`.
*
* @param[in] function A function pointer of the function to get the syscall number.
*
* @return System call number if `>= 0`, `< 0` on error.
*/
int sceKernelQuerySystemCall(void *function);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a function pointer is expected, shouldn't we use a proper function prototype for the callback?
either using a typedef or fully inline as in e.g. qsort: void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless this works like e.g. scnum = sceKernelQuerySystemCall(sceKernelQuerySystemCall); in which case the function documentation is kinda lacking/misleading. if so it would also be interesting to know what the result is good for and how it can be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is, there is no way do descrive a system call function "shape" (case in point: sceIoRead and sceKernelRegisterExitCallback are both syscalls, but they don't share the same number of arguments, these arguments don't have the same types, in this case the return type is the same, but could be different)

Copy link
Contributor Author

@GrayJack GrayJack Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if so it would also be interesting to know what the result is good for and how it can be used

It can be used to know if a given function is exported as syscall, it also can be used to create a system call instruction to insert in a module to patch it. You can give a look into the ARK or Adrenaline implementation of sctrlHookImportByNID to see it being used to both check the function is exported as syscall and to create and patch a syscall instruction


#ifdef __cplusplus
}
#endif
Expand Down