mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-28 12:05:06 +00:00
28 lines
1.2 KiB
C++
28 lines
1.2 KiB
C++
#include "prx/libkernel/KernelErrors.hpp"
|
|
#include "prx/libkernel/include/Api.hpp"
|
|
#include "SceTypes.hpp"
|
|
#include <cstdlib>
|
|
#include <initializer_list>
|
|
|
|
static void APS5_VABI Handler(int, void*) {}
|
|
static void APS5_VABI Other(int, void*) {}
|
|
|
|
static void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
int main() {
|
|
auto* handler = reinterpret_cast<void*>(&Handler);
|
|
auto* other = reinterpret_cast<void*>(&Other);
|
|
for (const int rejected : {0, 2, 9, 31, 128, -1})
|
|
Require(sceKernelInstallExceptionHandler(rejected, handler) == SCE_KERNEL_ERROR_EINVAL);
|
|
Require(sceKernelInstallExceptionHandler(30, nullptr) == SCE_KERNEL_ERROR_EINVAL);
|
|
Require(sceKernelRemoveExceptionHandler(9) == SCE_KERNEL_ERROR_EINVAL);
|
|
for (const int signum : {1, 4, 8, 10, 11, 30}) {
|
|
Require(sceKernelInstallExceptionHandler(signum, handler) == 0);
|
|
Require(sceKernelInstallExceptionHandler(signum, other) == SCE_KERNEL_ERROR_EAGAIN);
|
|
Require(sceKernelRemoveExceptionHandler(signum) == 0);
|
|
Require(sceKernelInstallExceptionHandler(signum, other) == 0);
|
|
Require(sceKernelRemoveExceptionHandler(signum) == 0);
|
|
}
|
|
Require(sceKernelRemoveExceptionHandler(30) == 0);
|
|
}
|