This commit is contained in:
red-prig 2022-10-01 00:25:10 +03:00
parent c98fb2f046
commit 0482c59a4a
7 changed files with 925 additions and 694 deletions

View File

@ -1,257 +1,375 @@
const
STOP_REASON_SIGHUP =$00000001; //Stop caused by SIGHUP signal.
STOP_REASON_SIGINT =$00000002; //Stop caused by SIGINT signal.
STOP_REASON_SIGQUIT =$00000003; //Stop caused by SIGQUIT signal.
STOP_REASON_SIGILL =$00000004; //Stop caused by SIGILL signal.
STOP_REASON_SIGTRAP =$00000005; //Stop caused by SIGTRAP signal.
STOP_REASON_SIGABRT =$00000006; //Stop caused by SIGABRT signal.
STOP_REASON_SIGEMT =$00000007; //Stop caused by SIGEMT (emulator trap) signal.
STOP_REASON_SIGFPE =$00000008; //Stop caused by SIGFPE signal.
STOP_REASON_SIGKILL =$00000009; //Stop caused by SIGKILL signal.
STOP_REASON_SIGBUS =$0000000A; //Stop caused by SIGBUS signal.
STOP_REASON_SIGSEGV =$0000000B; //Stop caused by SIGSEGV signal.
STOP_REASON_SIGSYS =$0000000C; //Stop caused by SIGSYS signal.
STOP_REASON_SIGPIPE =$0000000D; //Stop caused by SIGPIPE signal.
STOP_REASON_SIGALRM =$0000000E; //Stop caused by SIGALRM signal.
STOP_REASON_SIGTERM =$0000000F; //Stop caused by SIGTERM signal.
STOP_REASON_SIGURG =$00000010; //Stop caused by SIGURG signal.
STOP_REASON_SIGSTOP =$00000011; //Stop caused by SIGSTOP signal.
STOP_REASON_SIGTSTP =$00000012; //Stop caused by SIGTSTP signal.
STOP_REASON_SIGCONT =$00000013; //Stop caused by SIGCONT signal.
STOP_REASON_SIGCHLD =$00000014; //Stop caused by SIGCHLD signal.
STOP_REASON_SIGTTIN =$00000015; //Stop caused by SIGTTIN signal.
STOP_REASON_SIGTTOU =$00000016; //Stop caused by SIGTTOU signal.
STOP_REASON_SIGIO =$00000017; //Stop caused by SIGIO (SIGPOLL) signal.
STOP_REASON_SIGXCPU =$00000018; //Stop caused by SIGXCPU signal.
STOP_REASON_SIGXFSZ =$00000019; //Stop caused by SIGXFSZ signal.
STOP_REASON_SIGVTALRM =$0000001A; //Stop caused by SIGVTALRM signal.
STOP_REASON_SIGPROF =$0000001B; //Stop caused by SIGPROF signal.
STOP_REASON_SIGWINCH =$0000001C; //Stop caused by SIGWINCH signal.
STOP_REASON_SIGINFO =$0000001D; //Stop caused by SIGINFO signal.
STOP_REASON_SIGUSR1 =$0000001E; //Stop caused by SIGUSR1 signal.
STOP_REASON_SIGUSR2 =$0000001F; //Stop caused by SIGUSR2 signal.
STOP_REASON_SIGTHR =$00000020; //Reserved by thread library.
STOP_REASON_SIGNONE =$00000080; //When this reason is used in SceDbgpProcInfo, it means the process is running. When this reason is used in SceDbgpThrInfo, it means the thread is running no matter what the process state is.
STOP_REASON_SIGSUSPEND_PROCESS =$00000081; //Stopped because SCE_DBGP_TYPE_SUSPEND_PROCESS_CMD was received, or the process was spawned with SceDbgpLoadFlags.loadSuspended = 1 and has not been resumed.
STOP_REASON_SIGSUSPEND_THREAD =$00000082; //Stopped because SCE_DBGP_TYPE_SUSPEND_THREAD_CMD was received.
STOP_REASON_SIGSWBRKPT =$00000083; //Stopped due to hitting software breakpoint inserted with SET_SWBRKPT_CMD.
STOP_REASON_DL_STOP_INIT =$00000084; //Stopped due to loading dynamic module for the process when dlStop bit is set.
STOP_REASON_DL_START_UP_FAILED =$00000085; //Error was encountered when preparing to start or on starting a dynamic library.
STOP_REASON_SIGHWBRKPT =$00000086; //Stopped due to hitting hardware breakpoint inserted with SET_HWBRKPT_CMD. Even though hardware breakpoints are not thread specific, only the thread that hit the breakpoint should have this reason.
STOP_REASON_GPU_FAULT_ASYNC =$a0d0c001; //GPU exception was detected.
STOP_REASON_GPU_HP3D_TIMEOUT_ASYNC =$a0d04002; //System software forcibly shutdown the process because of GPU timeout.
STOP_REASON_GPU_SUBMITDONE_TIMEOUT_ASYNC =$a0d04003; //System software forcibly shutdown the process because of submitDone timeout.
STOP_REASON_GPU_BREAK_ASYNC =$a0d0c004; //GPU breakpoint detected.
STOP_REASON_GPU_FAULT_PAGE_FAULT_ASYNC =$a0d0c005; //GPU page fault detected.
STOP_REASON_GPU_FAULT_BAD_OP_CODE_ASYNC =$a0d0c006; //GPU encountered illegal instruction.
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC =$a0d0c007; //System software forcibly shutdown the process because of submitDone timeout. GPU was in busy state.
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC =$a0d0c008; //System software failed to suspend the process because of submitDone timeout. GPU was in busy state.
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC =$a0d0c009; //System software forcibly shutdown the process because of submitDone timeout. GPU was in idle state.
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC =$a0d0c00a; //System software failed to suspend the process because of submitDone timeout. GPU was in idle state.
STOP_REASON_GPU_FAULT_IDLE_TIMEOUT_AFTER_SUBMITDONE_ASYNC =$a0d0c00b; //GPU idle timeout after submitDone.
STOP_REASON_LIBC_RETURN_MAIN_SUCCESS =$a0020001; //Returned from main with zero.
STOP_REASON_LIBC_RETURN_MAIN_FAIL =$a0020002; //Returned from main with non-zero.
STOP_REASON_LIBC_EXIT_SUCCESS =$a0020003; //exit is called with zero.
STOP_REASON_LIBC_EXIT_FAIL =$a0020004; //exit is called with non-zero.
STOP_REASON_LIBC__EXIT_SUCCESS =$a0020005; //_Exit is called with zero.
STOP_REASON_LIBC__EXIT_FAIL =$a0020006; //_Exit is called with non-zero.
STOP_REASON_LIBC_ASSERT =$a0020007; //assert is called.
STOP_REASON_LIBC_TERMINATE =$a0020008; //terminate is called.
STOP_REASON_LIBC_UNEXPECTED =$a0020009; //unexpected is called.
STOP_REASON_LIBC_PURE_VIRTUAL =$a002000a; //pure virtual function is called.
STOP_REASON_LIBC_ABORT =$a002000b; //abort is called.
STOP_REASON_LIBC_QUICK_EXIT_SUCCESS =$a002000c; //quick_exit is called with zero.
STOP_REASON_LIBC_QUICK_EXIT_FAIL =$a002000d; //quick_exit is called with non-zero.
STOP_REASON_LIBC_FAILED_TO_CREATE_HEAP =$a002000e; //Failed to create the heap. Please check the value of sceLibcHeapSize.
STOP_REASON_LIBC_FAILED_TO_REPLACE_MALLOC =$a0020010; //Failed to replace malloc. Please check that you defined all necessary functions.
STOP_REASON_LIBC_FAILED_TO_REPLACE_NEW =$a0020011; //Failed to replace new. Please check that you defined all necessary functions.
STOP_REASON_LIBC_FAILED_TO_REPLACE_TLS_MALLOC =$a0020012; //Failed to replace malloc for TLS. Please check that you defined all necessary functions.
STOP_REASON_LIBC_FAILED_TO_MALLOC_INIT =$a0020013; //Failed to initialize malloc.
STOP_REASON_LIBC_FAILED_TO_TLS_MALLOC_INIT =$a0020014; //Failed to initialize malloc for TLS.
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_SUCCESS =$a0020081; //Returned from main with zero(system).
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_FAIL =$a0020082; //Returned from main with non-zero(system).
STOP_REASON_LIBC_INTERNAL_EXIT_SUCCESS =$a0020083; //exit is called with zero(system).
STOP_REASON_LIBC_INTERNAL_EXIT_FAIL =$a0020084; //exit is called with non-zero(system).
STOP_REASON_LIBC_INTERNAL__EXIT_SUCCESS =$a0020085; //_Exit is called with zero(system).
STOP_REASON_LIBC_INTERNAL__EXIT_FAIL =$a0020086; //_Exit is called with non-zero(system).
STOP_REASON_LIBC_INTERNAL_ASSERT =$a0020087; //assert is called(system).
STOP_REASON_LIBC_INTERNAL_TERMINATE =$a0020088; //terminate is called(system).
STOP_REASON_LIBC_INTERNAL_UNEXPECTED =$a0020089; //unexpected is called(system).
STOP_REASON_LIBC_INTERNAL_PURE_VIRTUAL =$a002008a; //pure virtual function is called(system).
STOP_REASON_LIBC_INTERNAL_ABORT =$a002008b; //abort is called(system).
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_SUCCESS =$a002008c; //quick_exit is called with zero(system).
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_FAIL =$a002008d; //quick_exit is called with non-zero(system).
STOP_REASON_LIBC_INTERNAL_FAILED_TO_CREATE_SYSTEM_MEMORY =$a002008f; //Failed to create the system memory (please report it in devnet).
STOP_REASON_PRX_NOT_RESOLVED_FUNCTION =$a0020101; //Called PRX function was not resolved.
STOP_REASON_PRX_SCE_MODULE_LOAD_ERROR =$a0020102; //Cannot load necessary modules from sce_module.
STOP_REASON_PRX_RUNTIME_ERROR =$a0020103; //An error occured in dynamic library (PRX) runtime.
STOP_REASON_PRX_PROCESS_STARTUP_FAILURE =$a0020104; //System software failed to initialize process environment.
STOP_REASON_SYSTEM_FATAL_LOAD_ERROR =$a0020302; //System software could not start the program.
STOP_REASON_SYSTEM_PTHREAD_RUNTIME_ERROR =$a0020305; //ScePthread runtime detected a fatal runtime error.
STOP_REASON_SYSTEM_INTERNAL_PTHREAD_RUNTIME_ERROR =$a0020306; //ScePthread runtime detected a fatal runtime error(internal).
STOP_REASON_SYSTEM_STACK_CHECK_FAILURE =$a0020307; //System software detected user stack is corrupted.
STOP_REASON_SYSTEM_INTERNAL_STACK_CHECK_FAILURE =$a0020308; //System software detected user stack is corrupted(internal).
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR =$a0020309; //The process was forcibly terminated due to unknown fatal error.
STOP_REASON_SYSTEM_ILLEGAL_FUNCTION_CALL =$a002030a; //The process was terminated with illegal function call.
STOP_REASON_SYSTEM_SCE_BREAK =$a002030b; //The process was terminated with unhandled SCE_BREAK.
STOP_REASON_SYSTEM_SCE_STOP =$a002030c; //The process was terminated with unhandled SCE_STOP.
STOP_REASON_SYSTEM_UNKNOWN_KERNEL_ERROR =$a002030d; //System software forcibly shutdown the process(driver).
STOP_REASON_SYSTEM_EXECUTABLE_ACCESS_ERROR =$a0020311; //Failed to verify executable.
STOP_REASON_KERNEL_ABORT_SYSTEM_ABNORMAL_TERMINATION_REQUEST =$a0020318; //The process terminated with sceSystemServiceReportAbnormalTermination.
STOP_REASON_SYSTEM_INTERNAL_DATA_ACCESS_ERROR =$a0020319; //System software is corrupted.
STOP_REASON_SYSTEM_ILLEGAL_EXCEPTION_CODE =$a002031a; //The process misused a library and was terminated.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_ERROR =$a002031c; //Failed to request system software service.
STOP_REASON_SYSTEM_DEBUG_RUNTIME_ERROR =$a002031d; //Cannot continue process instrumentation.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_FATAL =$a002031e; //Failed to request system software service.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_ERROR =$a002031f; //Failed to request system software service.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_FATAL =$a0020320; //Failed to request system software service.
STOP_REASON_SYSTEM_PTHREAD_MUTEX_ERROR =$a0020321; //Critical error on pthread mutex.
STOP_REASON_SYSTEM_WRITE_ADDRESS_WRAPAROUND =$a0020323; //System software detected wraparound of write address.
STOP_REASON_SYSTEM_ASAN_FATAL_ASSERT =$a0020325; //The process encountered a fatal ASan error.
STOP_REASON_SYSTEM_BAILOUT_REQUEST =$a0020404; //Terminating system service(s) without crash reporting. (Internal)
STOP_REASON_SYSTEM_BAILOUT_LOW_MEMORY =$a0020405; //Terminating system service(s) without crash reporting. (Internal)
STOP_REASON_SYSTEM_SUSPEND_BLOCK_TIMEOUT_ASYNC =$a0024301; //System software forcibly shutdown the process because of suspend blocker timeout.
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR_ASYNC =$a0024303; //System software forcibly shutdown the process.
STOP_REASON_SYSTEM_USER_DEBUG_REQUEST_ASYNC =$a0024304; //The process received debug termination request.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_TIMEOUT_ASYNC =$a002431b; //Terminating system service(s). (Internal)
STOP_REASON_SYSTEM_SOFTWARE_TIMEOUT_ASYNC =$a0024402; //The process was forcibly terminated with operation timeout.
STOP_REASON_SYSTEM_BAILOUT_GENERIC_ASYNC =$a0024403; //Terminating system service(s) without crash reporting. (Internal)
STOP_REASON_SYSTEM_DEBUGHANDLER_TIMEOUT =$a0028310; //The core dump handler timed out.
STOP_REASON_SYSTEM_DEBUGHANDLER_REJECTED =$a0028316; //Core dump handler was skipped due to application suspend.
STOP_REASON_SYSTEM_TRIGGER_COREDUMP_REQUEST =$a0028322; //The process requested core dump generation.
STOP_REASON_SYSTEM_ASAN_ASSERT =$a0028324; //The process encountered an ASan error.
STOP_REASON_SYSTEM_VM_RUNTIME =$a0028401; //The process was terminated with VM runtime exception.
STOP_REASON_SYSTEM_DUMP_AND_CONTINUE_REQUEST_ASYNC =$a002c315; //The process received core dump request.
STOP_REASON_KERNEL_EXCEPTION_SYSTEM_DEBUG_REQUEST_TIMEOUT_ASYNC=$a002c317; //Debug suspend request was timed out.
STOP_REASON_SIGHUP = $00000001; // Stop caused by SIGHUP signal.
STOP_REASON_SIGINT = $00000002; // Stop caused by SIGINT signal.
STOP_REASON_SIGQUIT = $00000003; // Stop caused by SIGQUIT signal.
STOP_REASON_SIGILL = $00000004; // Stop caused by SIGILL signal.
STOP_REASON_SIGTRAP = $00000005; // Stop caused by SIGTRAP signal.
STOP_REASON_SIGABRT = $00000006; // Stop caused by SIGABRT signal.
STOP_REASON_SIGEMT = $00000007; // Stop caused by SIGEMT (emulator trap) signal.
STOP_REASON_SIGFPE = $00000008; // Stop caused by SIGFPE signal.
STOP_REASON_SIGKILL = $00000009; // Stop caused by SIGKILL signal.
STOP_REASON_SIGBUS = $0000000A; // Stop caused by SIGBUS signal.
STOP_REASON_SIGSEGV = $0000000B; // Stop caused by SIGSEGV signal.
STOP_REASON_SIGSYS = $0000000C; // Stop caused by SIGSYS signal.
STOP_REASON_SIGPIPE = $0000000D; // Stop caused by SIGPIPE signal.
STOP_REASON_SIGALRM = $0000000E; // Stop caused by SIGALRM signal.
STOP_REASON_SIGTERM = $0000000F; // Stop caused by SIGTERM signal.
STOP_REASON_SIGURG = $00000010; // Stop caused by SIGURG signal.
STOP_REASON_SIGSTOP = $00000011; // Stop caused by SIGSTOP signal.
STOP_REASON_SIGTSTP = $00000012; // Stop caused by SIGTSTP signal.
STOP_REASON_SIGCONT = $00000013; // Stop caused by SIGCONT signal.
STOP_REASON_SIGCHLD = $00000014; // Stop caused by SIGCHLD signal.
STOP_REASON_SIGTTIN = $00000015; // Stop caused by SIGTTIN signal.
STOP_REASON_SIGTTOU = $00000016; // Stop caused by SIGTTOU signal.
STOP_REASON_SIGIO = $00000017; // Stop caused by SIGIO (SIGPOLL) signal.
STOP_REASON_SIGXCPU = $00000018; // Stop caused by SIGXCPU signal.
STOP_REASON_SIGXFSZ = $00000019; // Stop caused by SIGXFSZ signal.
STOP_REASON_SIGVTALRM = $0000001A; // Stop caused by SIGVTALRM signal.
STOP_REASON_SIGPROF = $0000001B; // Stop caused by SIGPROF signal.
STOP_REASON_SIGWINCH = $0000001C; // Stop caused by SIGWINCH signal.
STOP_REASON_SIGINFO = $0000001D; // Stop caused by SIGINFO signal.
STOP_REASON_SIGUSR1 = $0000001E; // Stop caused by SIGUSR1 signal.
STOP_REASON_SIGUSR2 = $0000001F; // Stop caused by SIGUSR2 signal.
STOP_REASON_SIGTHR = $00000020; // Reserved by thread library.
STOP_REASON_SIGNONE = $00000080; // When this reason is used in IProcessInfo, it means the process is running. When this reason is used in IThreadInfo, it means the thread is running no matter what the process state is.
STOP_REASON_SIGSUSPEND_PROCESS = $00000081; // Stopped because SCE_DBGP_TYPE_SUSPEND_PROCESS_CMD was received, or the process was spawned with LOAD_OPTIONS_LOAD_SUSPENDED and has not been resumed.
STOP_REASON_SIGSUSPEND_THREAD = $00000082; // Stopped because SCE_DBGP_TYPE_SUSPEND_THREAD_CMD was received.
STOP_REASON_SIGSWBRKPT = $00000083; // Stopped due to hitting software breakpoint inserted with SET_SWBRKPT_CMD.
STOP_REASON_DL_STOP_INIT = $00000084; // Stopped due to loading dynamic module for the process when dlStop bit is set.
STOP_REASON_DL_START_UP_FAILED = $00000085; // error was encountered when preparing to start or on starting a dynamic library.
STOP_REASON_SIGHWBRKPT = $00000086; // Stopped due to hitting hardware breakpoint inserted with SET_HWBRKPT_CMD. Even though hardware breakpoints are not thread specific, only the thread that hit the breakpoint should have this reason.
STOP_REASON_LIBC_RETURN_MAIN_SUCCESS = $a0020001; // Returned from main with zero.
STOP_REASON_LIBC_RETURN_MAIN_FAIL = $a0020002; // Returned from main with non-zero.
STOP_REASON_LIBC_EXIT_SUCCESS = $a0020003; // exit is called with zero.
STOP_REASON_LIBC_EXIT_FAIL = $a0020004; // exit is called with non-zero.
STOP_REASON_LIBC__EXIT_SUCCESS = $a0020005; // _Exit is called with zero.
STOP_REASON_LIBC__EXIT_FAIL = $a0020006; // _Exit is called with non-zero.
STOP_REASON_LIBC_ASSERT = $a0020007; // assert is called.
STOP_REASON_LIBC_TERMINATE = $a0020008; // Terminate is called.
STOP_REASON_LIBC_UNEXPECTED = $a0020009; // unexpected is called.
STOP_REASON_LIBC_PURE_VIRTUAL = $a002000a; // pure virtual function is called.
STOP_REASON_LIBC_ABORT = $a002000b; // abort is called.
STOP_REASON_LIBC_QUICK_EXIT_SUCCESS = $a002000c; // quick_exit is called with zero.
STOP_REASON_LIBC_QUICK_EXIT_FAIL = $a002000d; // quick_exit is called with non-zero.
STOP_REASON_LIBC_FAILED_TO_CREATE_HEAP = $a002000e; // Failed to create the heap. Please check the value of sceLibcHeapSize.
STOP_REASON_LIBC_FAILED_TO_REPLACE_MALLOC = $a0020010; // Failed to replace malloc. Please check that you defined all necessary functions.
STOP_REASON_LIBC_FAILED_TO_REPLACE_NEW = $a0020011; // Failed to replace new. Please check that you defined all necessary functions.
STOP_REASON_LIBC_FAILED_TO_REPLACE_TLS_MALLOC = $a0020012; // Failed to replace malloc for TLS. Please check that you defined all necessary functions.
STOP_REASON_LIBC_FAILED_TO_MALLOC_INIT = $a0020013; // Failed to initialize malloc.
STOP_REASON_LIBC_FAILED_TO_TLS_MALLOC_INIT = $a0020014; // Failed to initialize malloc for TLS.
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_SUCCESS = $a0020081; // Returned from main with zero(system).
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_FAIL = $a0020082; // Returned from main with non-zero(system).
STOP_REASON_LIBC_INTERNAL_EXIT_SUCCESS = $a0020083; // exit is called with zero(system).
STOP_REASON_LIBC_INTERNAL_EXIT_FAIL = $a0020084; // exit is called with non-zero(system).
STOP_REASON_LIBC_INTERNAL__EXIT_SUCCESS = $a0020085; // _Exit is called with zero(system).
STOP_REASON_LIBC_INTERNAL__EXIT_FAIL = $a0020086; // _Exit is called with non-zero(system).
STOP_REASON_LIBC_INTERNAL_ASSERT = $a0020087; // assert is called(system).
STOP_REASON_LIBC_INTERNAL_TERMINATE = $a0020088; // Terminate is called(system).
STOP_REASON_LIBC_INTERNAL_UNEXPECTED = $a0020089; // unexpected is called(system).
STOP_REASON_LIBC_INTERNAL_PURE_VIRTUAL = $a002008a; // pure virtual function is called(system).
STOP_REASON_LIBC_INTERNAL_ABORT = $a002008b; // abort is called(system).
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_SUCCESS = $a002008c; // quick_exit is called with zero(system).
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_FAIL = $a002008d; // quick_exit is called with non-zero(system).
STOP_REASON_LIBC_INTERNAL_FAILED_TO_CREATE_SYSTEM_MEMORY = $a002008f; // Failed to create the system memory (please report it in devnet).
STOP_REASON_PRX_NOT_RESOLVED_FUNCTION = $a0020101; // Called PRX function was not resolved.
STOP_REASON_PRX_SCE_MODULE_LOAD_ERROR = $a0020102; // Cannot load necessary modules from sce_module.
STOP_REASON_PRX_RUNTIME_ERROR = $a0020103; // An error occured in dynamic library (PRX) runtime.
STOP_REASON_PRX_PROCESS_STARTUP_FAILURE = $a0020104; // System software failed to initialize process environment.
STOP_REASON_PRX_INVALID_IMAGE = $a0020105; // The program loader detected a critical error in the executable file.
STOP_REASON_PRX_TLS_ALLOC_ERROR = $a0020106; // Dynamic library (PRX) runtime cannot allocate TLS.
STOP_REASON_SYSTEM_FATAL_LOAD_ERROR = $a0020302; // System software could not start the program.
STOP_REASON_SYSTEM_PTHREAD_RUNTIME_ERROR = $a0020305; // ScePthread runtime detected a fatal runtime error.
STOP_REASON_SYSTEM_INTERNAL_PTHREAD_RUNTIME_ERROR = $a0020306; // ScePthread runtime detected a fatal runtime error(internal).
STOP_REASON_SYSTEM_STACK_CHECK_FAILURE = $a0020307; // System software detected user stack is corrupted.
STOP_REASON_SYSTEM_INTERNAL_STACK_CHECK_FAILURE = $a0020308; // System software detected user stack is corrupted(internal).
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR = $a0020309; // The process was forcibly terminated due to unknown fatal error.
STOP_REASON_SYSTEM_ILLEGAL_FUNCTION_CALL = $a002030a; // The process was terminated with illegal function call.
STOP_REASON_SYSTEM_SCE_BREAK = $a002030b; // The process was terminated with unhandled SCE_BREAK.
STOP_REASON_SYSTEM_SCE_STOP = $a002030c; // The process was terminated with unhandled SCE_STOP.
STOP_REASON_SYSTEM_UNKNOWN_KERNEL_ERROR = $a002030d; // System software forcibly shutdown the process(driver).
STOP_REASON_SYSTEM_EXECUTABLE_ACCESS_ERROR = $a0020311; // Failed to verify executable.
STOP_REASON_KERNEL_ABORT_SYSTEM_ABNORMAL_TERMINATION_REQUEST = $a0020318; // The process terminated with sceSystemServiceReportAbnormalTermination.
STOP_REASON_SYSTEM_INTERNAL_DATA_ACCESS_ERROR = $a0020319; // System software is corrupted.
STOP_REASON_SYSTEM_ILLEGAL_EXCEPTION_CODE = $a002031a; // The process misused a library and was terminated.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_ERROR = $a002031c; // Failed to request system software service.
STOP_REASON_SYSTEM_DEBUG_RUNTIME_ERROR = $a002031d; // Cannot continue process instrumentation.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_FATAL = $a002031e; // Failed to request system software service.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_ERROR = $a002031f; // Failed to request system software service.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_FATAL = $a0020320; // Failed to request system software service.
STOP_REASON_SYSTEM_PTHREAD_MUTEX_ERROR = $a0020321; // Critical error on pthread mutex.
STOP_REASON_SYSTEM_WRITE_ADDRESS_WRAPAROUND = $a0020323; // System software detected wraparound of write address.
STOP_REASON_SYSTEM_ASAN_FATAL_ASSERT = $a0020325; // The process encountered a fatal ASan error.
STOP_REASON_SYSTEM_IMAGE_ALLOC_ERROR = $a0020326; // process creation failure: The specified FMEM size is too small.
STOP_REASON_SYSTEM_DEBUG_RUNTIME_SHADOW_MEMORY_ALLOW_ERROR = $a0020327; // The process was terminated due to lack of memory for mapping the shadow memory for address sanitizer.
STOP_REASON_SYSTEM_BAILOUT_REQUEST = $a0020404; // Terminating system service(s) without crash reporting. (Internal)
STOP_REASON_SYSTEM_BAILOUT_LOW_MEMORY = $a0020405; // Terminating system service(s) without crash reporting. (Internal)
STOP_REASON_SYSTEM_SUSPEND_BLOCK_TIMEOUT_ASYNC = $a0024301; // System software forcibly shutdown the process because of suspend blocker timeout.
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR_ASYNC = $a0024303; // System software forcibly shutdown the process.
STOP_REASON_SYSTEM_USER_DEBUG_REQUEST_ASYNC = $a0024304; // The process received debug termination request.
STOP_REASON_SYSTEM_INTERNAL_SERVICE_TIMEOUT_ASYNC = $a002431b; // Terminating system service(s). (Internal)
STOP_REASON_SYSTEM_SOFTWARE_TIMEOUT_ASYNC = $a0024402; // The process was forcibly terminated with operation timeout.
STOP_REASON_SYSTEM_BAILOUT_GENERIC_ASYNC = $a0024403; // Terminating system service(s) without crash reporting. (Internal)
STOP_REASON_SYSTEM_DEBUGHANDLER_TIMEOUT = $a0028310; // The core dump handler timed out.
STOP_REASON_SYSTEM_DEBUGHANDLER_REJECTED = $a0028316; // Core dump handler was skipped due to application suspend.
STOP_REASON_SYSTEM_TRIGGER_COREDUMP_REQUEST = $a0028322; // The process requested coredump generation.
STOP_REASON_SYSTEM_ASAN_ASSERT = $a0028324; // The process encountered an ASan error.
STOP_REASON_SYSTEM_VM_RUNTIME = $a0028401; // The process was terminated with VM runtime exception.
STOP_REASON_SYSTEM_DUMP_AND_CONTINUE_REQUEST_ASYNC = $a002c315; // The process received coredump request.
STOP_REASON_KERNEL_EXCEPTION_SYSTEM_DEBUG_REQUEST_TIMEOUT_ASYNC = $a002c317; // Debug suspend request was timed out.
STOP_REASON_GPU_FAULT_ASYNC = $a0d0c001; // GPU exception was detected.
STOP_REASON_GPU_HP3D_TIMEOUT_ASYNC = $a0d04002; // System software forcibly shutdown the process because of GPU timeout.
STOP_REASON_GPU_SUBMITDONE_TIMEOUT_ASYNC = $a0d04003; // System software forcibly shutdown the process because of submitDone timeout.
STOP_REASON_GPU_BREAK_ASYNC = $a0d0c004; /// GPU breakpoint detected.
STOP_REASON_GPU_FAULT_PAGE_FAULT_ASYNC = $a0d0c005; // GPU page fault detected.
STOP_REASON_GPU_FAULT_BAD_OP_CODE_ASYNC = $a0d0c006; // GPU encountered illegal instruction.
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC = $a0d0c007; // System software forcibly shutdown the process because of submitDone timeout. GPU was in busy state.
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC = $a0d0c008; // System software failed to suspend the process because of submitDone timeout. GPU was in busy state.
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC = $a0d0c009; // System software forcibly shutdown the process because of submitDone timeout. GPU was in idle state.
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC = $a0d0c00a; // System software failed to suspend the process because of submitDone timeout. GPU was in idle state.
STOP_REASON_GPU_FAULT_IDLE_TIMEOUT_AFTER_SUBMITDONE_ASYNC = $a0d0c00b; // GPU idle timeout after submitDone.
STOP_REASON_SLV_MUTEX_UNLOCK_NOT_OWNED = $a0ff8301; // ScePthreadMutexUnlock() : Unlocking mutex that is not locked by the calling thread.
STOP_REASON_SLV_POSIX_MUTEX_UNLOCK_NOT_OWNED = $a0ff8302; // pthread_mutex_unlock() : Unlocking mutex that is not locked by the calling thread.
STOP_REASON_SLV_MUTEX_DESTROY_LOCKED = $a0ff8303; // ScePthreadMutexDestroy() : Destroying locked mutex.
STOP_REASON_SLV_POSIX_MUTEX_DESTROY_LOCKED = $a0ff8304; // pthread_mutex_destroy() : Destroying locked mutex.
STOP_REASON_SLV_MUTEX_LOCK_DESTROYED = $a0ff8305; // ScePthreadMutexLock() : Locking destroyed mutex.
STOP_REASON_SLV_POSIX_MUTEX_LOCK_DESTROYED = $a0ff8306; // pthread_mutex_lock() : Locking destroyed mutex.
STOP_REASON_SLV_CLOSE_NOT_PERMITTED_FD = $a0ff8307; // SceKernelClose() : Closing specified fd is not permitted.
STOP_REASON_SLV_POSIX_CLOSE_NOT_PERMITTED_FD = $a0ff8308; // close() : Closing specified fd is not permitted.
STOP_REASON_SLV_MUTEX_DESTROY_DESTROYED = $a0ff8309; // ScePthreadMutexDestroy() : Destroying destroyed mutex.
STOP_REASON_SLV_POSIX_MUTEX_DESTROY_DESTROYED = $a0ff830a; // pthread_mutex_destroy() : Destroying destroyed mutex.
STOP_REASON_SLV_MUTEX_TIMEDLOCK_DESTROYED = $a0ff830b; // ScePthreadMutexTimedlock() : Locking destroyed mutex (with timeout).
STOP_REASON_SLV_MUTEX_TRYLOCK_DESTROYED = $a0ff830c; // ScePthreadMutexTrylock() : Trying to lock destroyed mutex.
STOP_REASON_SLV_POSIX_MUTEX_TRYLOCK_DESTROYED = $a0ff830d; // pthread_mutex_trylock() : Trying to lock destroyed mutex.
STOP_REASON_SLV_MUTEX_UNLOCK_DESTROYED = $a0ff830e; // ScePthreadMutexUnlock() : Unlocking destroyed mutex.
STOP_REASON_SLV_POSIX_MUTEX_UNLOCK_DESTROYED = $a0ff830f; // pthread_mutex_unlock() : Unlocking destroyed mutex.
STOP_REASON_SLV_COND_BROADCAST_DESTROYED = $a0ff8310; // ScePthreadCondBroadcast() : Broadcasting destroyed condition variable.
STOP_REASON_SLV_POSIX_COND_BROADCAST_DESTROYED = $a0ff8311; // pthread_cond_broadcast() : Broadcasting destroyed condition variable.
STOP_REASON_SLV_COND_DESTROY_DESTROYED = $a0ff8312; // ScePthreadCondDestroy() : Destroying destroyed condition variable.
STOP_REASON_SLV_POSIX_COND_DESTROY_DESTROYED = $a0ff8313; // pthread_cond_destroy() : Destroying destroyed condition variable.
STOP_REASON_SLV_COND_SIGNAL_DESTROYED = $a0ff8314; // ScePthreadCondSignal() : Signaling destroyed condition variable.
STOP_REASON_SLV_POSIX_COND_SIGNAL_DESTROYED = $a0ff8315; // pthread_cond_signal() : Signaling destroyed condition variable.
STOP_REASON_SLV_COND_SIGNALTO_DESTROYED = $a0ff8316; // ScePthreadCondSignalto() : Signaling destroyed condition variable (specific thread).
STOP_REASON_SLV_COND_TIMEDWAIT_DESTROYED = $a0ff8317; // ScePthreadCondTimedwait() : Waiting destroyed condition variable (with timeout).
STOP_REASON_SLV_COND_TIMEDWAIT_MUTEX_NOT_OWNED = $a0ff8318; // ScePthreadCondTimedwait() : Mutex is not locked by the calling thread.
STOP_REASON_SLV_POSIX_COND_TIMEDWAIT_MUTEX_NOT_OWNED = $a0ff8319; // pthread_cond_timedwait() : Mutex is not locked by the calling thread.
STOP_REASON_SLV_COND_WAIT_DESTROYED = $a0ff831a; // ScePthreadCondWait() : Waiting destroyed condition variable.
STOP_REASON_SLV_POSIX_COND_WAIT_DESTROYED = $a0ff831b; // pthread_cond_wait() : Waiting destroyed condition variable.
STOP_REASON_SLV_COND_WAIT_MUTEX_NOT_OWNED = $a0ff831c; // ScePthreadCondWait() : mutex is not locked by the calling thread.
STOP_REASON_SLV_POSIX_COND_WAIT_MUTEX_NOT_OWNED = $a0ff831d; // pthread_cond_wait() : Mutex is not locked by the calling thread.
STOP_REASON_SLV_RWLOCK_DESTROY_DESTROYED = $a0ff831e; // ScePthreadRwlockDestroy() : Destroying destroyed read / write lock.
STOP_REASON_SLV_POSIX_RWLOCK_DESTROY_DESTROYED = $a0ff831f; // pthread_rwlock_destroy() : Destroying destroyed read / write lock.
STOP_REASON_SLV_RWLOCK_RDLOCK_DESTROYED = $a0ff8320; // ScePthreadRwlockRdlock() : Locking destroyed read / write lock (for reading).
STOP_REASON_SLV_POSIX_RWLOCK_RDLOCK_DESTROYED = $a0ff8321; // pthread_rwlock_rdlock() : Locking destroyed read / write lock (for reading).
STOP_REASON_SLV_RWLOCK_TIMEDRDLOCK_DESTROYED = $a0ff8322; // ScePthreadRwlockTimedrdlock() : Locking destroyed read / write lock (for reading, with timeout).
STOP_REASON_SLV_RWLOCK_TIMEDWRLOCK_DESTROYED = $a0ff8323; // ScePthreadRwlockTimedwrlock() : Locking destroyed read / write lock (for writing, with timeout).
STOP_REASON_SLV_RWLOCK_TRYRDLOCK_DESTROYED = $a0ff8324; // ScePthreadRwlockTryrdlock() : Trying to lock destroyed read / write lock (for reading).
STOP_REASON_SLV_POSIX_RWLOCK_TRYRDLOCK_DESTROYED = $a0ff8325; // pthread_rwlock_tryrdlock() : Trying to lock destroyed read / write lock (for reading).
STOP_REASON_SLV_RWLOCK_TRYWRLOCK_DESTROYED = $a0ff8326; // ScePthreadRwlockTrywrlock() : Trying to lock destroyed read / write lock (for writing).
STOP_REASON_SLV_POSIX_RWLOCK_TRYWRLOCK_DESTROYED = $a0ff8327; // pthread_rwlock_trywrlock() : Trying to lock destroyed read / write lock (for writing).
STOP_REASON_SLV_RWLOCK_UNLOCK_DESTROYED = $a0ff8328; // ScePthreadRwlockUnlock() : Unlocking destroyed read / write lock.
STOP_REASON_SLV_POSIX_RWLOCK_UNLOCK_DESTROYED = $a0ff8329; // pthread_rwlock_unlock() : Unlocking destroyed read / write lock.
STOP_REASON_SLV_RWLOCK_UNLOCK_NOT_OWNED = $a0ff832a; // ScePthreadRwlockUnlock() : Read / write lock is not locked by the calling thread.
STOP_REASON_SLV_POSIX_RWLOCK_UNLOCK_NOT_OWNED = $a0ff832b; // pthread_rwlock_unlock() : Read / write lock is not locked by the calling thread.
STOP_REASON_SLV_RWLOCK_WRLOCK_DESTROYED = $a0ff832c; // ScePthreadRwlockWrlock() : Locking destroyed read / write lock (for writing).
STOP_REASON_SLV_POSIX_RWLOCK_WRLOCK_DESTROYED = $a0ff832d; // pthread_rwlock_wrlock() : Locking destroyed read / write lock (for writing).
STOP_REASON_SLV_BARRIER_DESTROY_DESTROYED = $a0ff832e; // ScePthreadBarrierDestroy() : Destroying destroyed barrier.
STOP_REASON_SLV_POSIX_BARRIER_DESTROY_DESTROYED = $a0ff832f; // pthread_barrier_destroy() : Destroying destroyed barrier.
STOP_REASON_SLV_BARRIER_DESTROY_IN_USE = $a0ff8330; // ScePthreadBarrierDestroy() : Destroying barrier that is being used by any one of the threads.
STOP_REASON_SLV_POSIX_BARRIER_DESTROY_IN_USE = $a0ff8331; // pthread_barrier_destroy() : Destroying barrier that is being used by any one of the threads.
STOP_REASON_SLV_BARRIER_WAIT_DESTROYED = $a0ff8332; // ScePthreadBarrierWait() : Waiting destroyed barrier.
STOP_REASON_SLV_POSIX_BARRIER_WAIT_DESTROYED = $a0ff8333; // pthread_barrier_wait() : Waiting destroyed barrier.
STOP_REASON_SLV_POSIX_MUTEX_TIMEDLOCK_DESTROYED = $a0ff8334; // Specified mutex is not valid.
STOP_REASON_SLV_POSIX_COND_TIMEDWAIT_DESTROYED = $a0ff8335; // Specified condition variable is not valid.
STOP_REASON_SLV_POSIX_RWLOCK_TIMEDRDLOCK_DESTROYED = $a0ff8336; // Specified read / write lock is not valid.
STOP_REASON_SLV_POSIX_RWLOCK_TIMEDWRLOCK_DESTROYED = $a0ff8337; // Specified read / write lock is not valid.
function GetStopReasonInfo(dwStopReason:DWORD):RawByteString;
begin
Case dwStopReason of
STOP_REASON_SIGHUP :Result:='Stop caused by SIGHUP signal.';
STOP_REASON_SIGINT :Result:='Stop caused by SIGINT signal.';
STOP_REASON_SIGQUIT :Result:='Stop caused by SIGQUIT signal.';
STOP_REASON_SIGILL :Result:='Stop caused by SIGILL signal.';
STOP_REASON_SIGTRAP :Result:='Stop caused by SIGTRAP signal.';
STOP_REASON_SIGABRT :Result:='Stop caused by SIGABRT signal.';
STOP_REASON_SIGEMT :Result:='Stop caused by SIGEMT (emulator trap) signal.';
STOP_REASON_SIGFPE :Result:='Stop caused by SIGFPE signal.';
STOP_REASON_SIGKILL :Result:='Stop caused by SIGKILL signal.';
STOP_REASON_SIGBUS :Result:='Stop caused by SIGBUS signal.';
STOP_REASON_SIGSEGV :Result:='Stop caused by SIGSEGV signal.';
STOP_REASON_SIGSYS :Result:='Stop caused by SIGSYS signal.';
STOP_REASON_SIGPIPE :Result:='Stop caused by SIGPIPE signal.';
STOP_REASON_SIGALRM :Result:='Stop caused by SIGALRM signal.';
STOP_REASON_SIGTERM :Result:='Stop caused by SIGTERM signal.';
STOP_REASON_SIGURG :Result:='Stop caused by SIGURG signal.';
STOP_REASON_SIGSTOP :Result:='Stop caused by SIGSTOP signal.';
STOP_REASON_SIGTSTP :Result:='Stop caused by SIGTSTP signal.';
STOP_REASON_SIGCONT :Result:='Stop caused by SIGCONT signal.';
STOP_REASON_SIGCHLD :Result:='Stop caused by SIGCHLD signal.';
STOP_REASON_SIGTTIN :Result:='Stop caused by SIGTTIN signal.';
STOP_REASON_SIGTTOU :Result:='Stop caused by SIGTTOU signal.';
STOP_REASON_SIGIO :Result:='Stop caused by SIGIO (SIGPOLL) signal.';
STOP_REASON_SIGXCPU :Result:='Stop caused by SIGXCPU signal.';
STOP_REASON_SIGXFSZ :Result:='Stop caused by SIGXFSZ signal.';
STOP_REASON_SIGVTALRM :Result:='Stop caused by SIGVTALRM signal.';
STOP_REASON_SIGPROF :Result:='Stop caused by SIGPROF signal.';
STOP_REASON_SIGWINCH :Result:='Stop caused by SIGWINCH signal.';
STOP_REASON_SIGINFO :Result:='Stop caused by SIGINFO signal.';
STOP_REASON_SIGUSR1 :Result:='Stop caused by SIGUSR1 signal.';
STOP_REASON_SIGUSR2 :Result:='Stop caused by SIGUSR2 signal.';
STOP_REASON_SIGTHR :Result:='Reserved by thread library.';
STOP_REASON_SIGNONE :Result:='When this reason is used in SceDbgpProcInfo, it means the process is running. When this reason is used in SceDbgpThrInfo, it means the thread is running no matter what the process state is.';
STOP_REASON_SIGSUSPEND_PROCESS :Result:='Stopped because SCE_DBGP_TYPE_SUSPEND_PROCESS_CMD was received, or the process was spawned with SceDbgpLoadFlags.loadSuspended = 1 and has not been resumed.';
STOP_REASON_SIGSUSPEND_THREAD :Result:='Stopped because SCE_DBGP_TYPE_SUSPEND_THREAD_CMD was received.';
STOP_REASON_SIGSWBRKPT :Result:='Stopped due to hitting software breakpoint inserted with SET_SWBRKPT_CMD.';
STOP_REASON_DL_STOP_INIT :Result:='Stopped due to loading dynamic module for the process when dlStop bit is set.';
STOP_REASON_DL_START_UP_FAILED :Result:='Error was encountered when preparing to start or on starting a dynamic library.';
STOP_REASON_SIGHWBRKPT :Result:='Stopped due to hitting hardware breakpoint inserted with SET_HWBRKPT_CMD. Even though hardware breakpoints are not thread specific, only the thread that hit the breakpoint should have this reason.';
STOP_REASON_GPU_FAULT_ASYNC :Result:='GPU exception was detected.';
STOP_REASON_GPU_HP3D_TIMEOUT_ASYNC :Result:='System software forcibly shutdown the process because of GPU timeout.';
STOP_REASON_GPU_SUBMITDONE_TIMEOUT_ASYNC :Result:='System software forcibly shutdown the process because of submitDone timeout.';
STOP_REASON_GPU_BREAK_ASYNC :Result:='GPU breakpoint detected.';
STOP_REASON_GPU_FAULT_PAGE_FAULT_ASYNC :Result:='GPU page fault detected.';
STOP_REASON_GPU_FAULT_BAD_OP_CODE_ASYNC :Result:='GPU encountered illegal instruction.';
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC :Result:='System software forcibly shutdown the process because of submitDone timeout. GPU was in busy state.';
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC :Result:='System software failed to suspend the process because of submitDone timeout. GPU was in busy state.';
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC :Result:='System software forcibly shutdown the process because of submitDone timeout. GPU was in idle state.';
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC :Result:='System software failed to suspend the process because of submitDone timeout. GPU was in idle state.';
STOP_REASON_GPU_FAULT_IDLE_TIMEOUT_AFTER_SUBMITDONE_ASYNC :Result:='GPU idle timeout after submitDone.';
STOP_REASON_LIBC_RETURN_MAIN_SUCCESS :Result:='Returned from main with zero.';
STOP_REASON_LIBC_RETURN_MAIN_FAIL :Result:='Returned from main with non-zero.';
STOP_REASON_LIBC_EXIT_SUCCESS :Result:='exit is called with zero.';
STOP_REASON_LIBC_EXIT_FAIL :Result:='exit is called with non-zero.';
STOP_REASON_LIBC__EXIT_SUCCESS :Result:='_Exit is called with zero.';
STOP_REASON_LIBC__EXIT_FAIL :Result:='_Exit is called with non-zero.';
STOP_REASON_LIBC_ASSERT :Result:='assert is called.';
STOP_REASON_LIBC_TERMINATE :Result:='terminate is called.';
STOP_REASON_LIBC_UNEXPECTED :Result:='unexpected is called.';
STOP_REASON_LIBC_PURE_VIRTUAL :Result:='pure virtual function is called.';
STOP_REASON_LIBC_ABORT :Result:='abort is called.';
STOP_REASON_LIBC_QUICK_EXIT_SUCCESS :Result:='quick_exit is called with zero.';
STOP_REASON_LIBC_QUICK_EXIT_FAIL :Result:='quick_exit is called with non-zero.';
STOP_REASON_LIBC_FAILED_TO_CREATE_HEAP :Result:='Failed to create the heap. Please check the value of sceLibcHeapSize.';
STOP_REASON_LIBC_FAILED_TO_REPLACE_MALLOC :Result:='Failed to replace malloc. Please check that you defined all necessary functions.';
STOP_REASON_LIBC_FAILED_TO_REPLACE_NEW :Result:='Failed to replace new. Please check that you defined all necessary functions.';
STOP_REASON_LIBC_FAILED_TO_REPLACE_TLS_MALLOC :Result:='Failed to replace malloc for TLS. Please check that you defined all necessary functions.';
STOP_REASON_LIBC_FAILED_TO_MALLOC_INIT :Result:='Failed to initialize malloc.';
STOP_REASON_LIBC_FAILED_TO_TLS_MALLOC_INIT :Result:='Failed to initialize malloc for TLS.';
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_SUCCESS :Result:='Returned from main with zero(system).';
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_FAIL :Result:='Returned from main with non-zero(system).';
STOP_REASON_LIBC_INTERNAL_EXIT_SUCCESS :Result:='exit is called with zero(system).';
STOP_REASON_LIBC_INTERNAL_EXIT_FAIL :Result:='exit is called with non-zero(system).';
STOP_REASON_LIBC_INTERNAL__EXIT_SUCCESS :Result:='_Exit is called with zero(system).';
STOP_REASON_LIBC_INTERNAL__EXIT_FAIL :Result:='_Exit is called with non-zero(system).';
STOP_REASON_LIBC_INTERNAL_ASSERT :Result:='assert is called(system).';
STOP_REASON_LIBC_INTERNAL_TERMINATE :Result:='terminate is called(system).';
STOP_REASON_LIBC_INTERNAL_UNEXPECTED :Result:='unexpected is called(system).';
STOP_REASON_LIBC_INTERNAL_PURE_VIRTUAL :Result:='pure virtual function is called(system).';
STOP_REASON_LIBC_INTERNAL_ABORT :Result:='abort is called(system).';
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_SUCCESS :Result:='quick_exit is called with zero(system).';
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_FAIL :Result:='quick_exit is called with non-zero(system).';
STOP_REASON_LIBC_INTERNAL_FAILED_TO_CREATE_SYSTEM_MEMORY :Result:='Failed to create the system memory (please report it in devnet).';
STOP_REASON_PRX_NOT_RESOLVED_FUNCTION :Result:='Called PRX function was not resolved.';
STOP_REASON_PRX_SCE_MODULE_LOAD_ERROR :Result:='Cannot load necessary modules from sce_module.';
STOP_REASON_PRX_RUNTIME_ERROR :Result:='An error occured in dynamic library (PRX) runtime.';
STOP_REASON_PRX_PROCESS_STARTUP_FAILURE :Result:='System software failed to initialize process environment.';
STOP_REASON_SYSTEM_FATAL_LOAD_ERROR :Result:='System software could not start the program.';
STOP_REASON_SYSTEM_PTHREAD_RUNTIME_ERROR :Result:='ScePthread runtime detected a fatal runtime error.';
STOP_REASON_SYSTEM_INTERNAL_PTHREAD_RUNTIME_ERROR :Result:='ScePthread runtime detected a fatal runtime error(internal).';
STOP_REASON_SYSTEM_STACK_CHECK_FAILURE :Result:='System software detected user stack is corrupted.';
STOP_REASON_SYSTEM_INTERNAL_STACK_CHECK_FAILURE :Result:='System software detected user stack is corrupted(internal).';
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR :Result:='The process was forcibly terminated due to unknown fatal error.';
STOP_REASON_SYSTEM_ILLEGAL_FUNCTION_CALL :Result:='The process was terminated with illegal function call.';
STOP_REASON_SYSTEM_SCE_BREAK :Result:='The process was terminated with unhandled SCE_BREAK.';
STOP_REASON_SYSTEM_SCE_STOP :Result:='The process was terminated with unhandled SCE_STOP.';
STOP_REASON_SYSTEM_UNKNOWN_KERNEL_ERROR :Result:='System software forcibly shutdown the process(driver).';
STOP_REASON_SYSTEM_EXECUTABLE_ACCESS_ERROR :Result:='Failed to verify executable.';
STOP_REASON_KERNEL_ABORT_SYSTEM_ABNORMAL_TERMINATION_REQUEST :Result:='The process terminated with sceSystemServiceReportAbnormalTermination.';
STOP_REASON_SYSTEM_INTERNAL_DATA_ACCESS_ERROR :Result:='System software is corrupted.';
STOP_REASON_SYSTEM_ILLEGAL_EXCEPTION_CODE :Result:='The process misused a library and was terminated.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_ERROR :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_DEBUG_RUNTIME_ERROR :Result:='Cannot continue process instrumentation.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_FATAL :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_ERROR :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_FATAL :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_PTHREAD_MUTEX_ERROR :Result:='Critical error on pthread mutex.';
STOP_REASON_SYSTEM_WRITE_ADDRESS_WRAPAROUND :Result:='System software detected wraparound of write address.';
STOP_REASON_SYSTEM_ASAN_FATAL_ASSERT :Result:='The process encountered a fatal ASan error.';
STOP_REASON_SYSTEM_BAILOUT_REQUEST :Result:='Terminating system service(s) without crash reporting. (Internal)';
STOP_REASON_SYSTEM_BAILOUT_LOW_MEMORY :Result:='Terminating system service(s) without crash reporting. (Internal)';
STOP_REASON_SYSTEM_SUSPEND_BLOCK_TIMEOUT_ASYNC :Result:='System software forcibly shutdown the process because of suspend blocker timeout.';
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR_ASYNC :Result:='System software forcibly shutdown the process.';
STOP_REASON_SYSTEM_USER_DEBUG_REQUEST_ASYNC :Result:='The process received debug termination request.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_TIMEOUT_ASYNC :Result:='Terminating system service(s). (Internal)';
STOP_REASON_SIGHUP :Result:='Stop caused by SIGHUP signal.';
STOP_REASON_SIGINT :Result:='Stop caused by SIGINT signal.';
STOP_REASON_SIGQUIT :Result:='Stop caused by SIGQUIT signal.';
STOP_REASON_SIGILL :Result:='Stop caused by SIGILL signal.';
STOP_REASON_SIGTRAP :Result:='Stop caused by SIGTRAP signal.';
STOP_REASON_SIGABRT :Result:='Stop caused by SIGABRT signal.';
STOP_REASON_SIGEMT :Result:='Stop caused by SIGEMT (emulator trap) signal.';
STOP_REASON_SIGFPE :Result:='Stop caused by SIGFPE signal.';
STOP_REASON_SIGKILL :Result:='Stop caused by SIGKILL signal.';
STOP_REASON_SIGBUS :Result:='Stop caused by SIGBUS signal.';
STOP_REASON_SIGSEGV :Result:='Stop caused by SIGSEGV signal.';
STOP_REASON_SIGSYS :Result:='Stop caused by SIGSYS signal.';
STOP_REASON_SIGPIPE :Result:='Stop caused by SIGPIPE signal.';
STOP_REASON_SIGALRM :Result:='Stop caused by SIGALRM signal.';
STOP_REASON_SIGTERM :Result:='Stop caused by SIGTERM signal.';
STOP_REASON_SIGURG :Result:='Stop caused by SIGURG signal.';
STOP_REASON_SIGSTOP :Result:='Stop caused by SIGSTOP signal.';
STOP_REASON_SIGTSTP :Result:='Stop caused by SIGTSTP signal.';
STOP_REASON_SIGCONT :Result:='Stop caused by SIGCONT signal.';
STOP_REASON_SIGCHLD :Result:='Stop caused by SIGCHLD signal.';
STOP_REASON_SIGTTIN :Result:='Stop caused by SIGTTIN signal.';
STOP_REASON_SIGTTOU :Result:='Stop caused by SIGTTOU signal.';
STOP_REASON_SIGIO :Result:='Stop caused by SIGIO (SIGPOLL) signal.';
STOP_REASON_SIGXCPU :Result:='Stop caused by SIGXCPU signal.';
STOP_REASON_SIGXFSZ :Result:='Stop caused by SIGXFSZ signal.';
STOP_REASON_SIGVTALRM :Result:='Stop caused by SIGVTALRM signal.';
STOP_REASON_SIGPROF :Result:='Stop caused by SIGPROF signal.';
STOP_REASON_SIGWINCH :Result:='Stop caused by SIGWINCH signal.';
STOP_REASON_SIGINFO :Result:='Stop caused by SIGINFO signal.';
STOP_REASON_SIGUSR1 :Result:='Stop caused by SIGUSR1 signal.';
STOP_REASON_SIGUSR2 :Result:='Stop caused by SIGUSR2 signal.';
STOP_REASON_SIGTHR :Result:='Reserved by thread library.';
STOP_REASON_SIGNONE :Result:='When this reason is used in IProcessInfo, it means the process is running. When this reason is used in IThreadInfo, it means the thread is running no matter what the process state is.';
STOP_REASON_SIGSUSPEND_PROCESS :Result:='Stopped because SCE_DBGP_TYPE_SUSPEND_PROCESS_CMD was received, or the process was spawned with LOAD_OPTIONS_LOAD_SUSPENDED and has not been resumed.';
STOP_REASON_SIGSUSPEND_THREAD :Result:='Stopped because SCE_DBGP_TYPE_SUSPEND_THREAD_CMD was received.';
STOP_REASON_SIGSWBRKPT :Result:='Stopped due to hitting software breakpoint inserted with SET_SWBRKPT_CMD.';
STOP_REASON_DL_STOP_INIT :Result:='Stopped due to loading dynamic module for the process when dlStop bit is set.';
STOP_REASON_DL_START_UP_FAILED :Result:='error was encountered when preparing to start or on starting a dynamic library.';
STOP_REASON_SIGHWBRKPT :Result:='Stopped due to hitting hardware breakpoint inserted with SET_HWBRKPT_CMD. Even though hardware breakpoints are not thread specific, only the thread that hit the breakpoint should have this reason.';
STOP_REASON_LIBC_RETURN_MAIN_SUCCESS :Result:='Returned from main with zero.';
STOP_REASON_LIBC_RETURN_MAIN_FAIL :Result:='Returned from main with non-zero.';
STOP_REASON_LIBC_EXIT_SUCCESS :Result:='exit is called with zero.';
STOP_REASON_LIBC_EXIT_FAIL :Result:='exit is called with non-zero.';
STOP_REASON_LIBC__EXIT_SUCCESS :Result:='_Exit is called with zero.';
STOP_REASON_LIBC__EXIT_FAIL :Result:='_Exit is called with non-zero.';
STOP_REASON_LIBC_ASSERT :Result:='assert is called.';
STOP_REASON_LIBC_TERMINATE :Result:='Terminate is called.';
STOP_REASON_LIBC_UNEXPECTED :Result:='unexpected is called.';
STOP_REASON_LIBC_PURE_VIRTUAL :Result:='pure virtual function is called.';
STOP_REASON_LIBC_ABORT :Result:='abort is called.';
STOP_REASON_LIBC_QUICK_EXIT_SUCCESS :Result:='quick_exit is called with zero.';
STOP_REASON_LIBC_QUICK_EXIT_FAIL :Result:='quick_exit is called with non-zero.';
STOP_REASON_LIBC_FAILED_TO_CREATE_HEAP :Result:='Failed to create the heap. Please check the value of sceLibcHeapSize.';
STOP_REASON_LIBC_FAILED_TO_REPLACE_MALLOC :Result:='Failed to replace malloc. Please check that you defined all necessary functions.';
STOP_REASON_LIBC_FAILED_TO_REPLACE_NEW :Result:='Failed to replace new. Please check that you defined all necessary functions.';
STOP_REASON_LIBC_FAILED_TO_REPLACE_TLS_MALLOC :Result:='Failed to replace malloc for TLS. Please check that you defined all necessary functions.';
STOP_REASON_LIBC_FAILED_TO_MALLOC_INIT :Result:='Failed to initialize malloc.';
STOP_REASON_LIBC_FAILED_TO_TLS_MALLOC_INIT :Result:='Failed to initialize malloc for TLS.';
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_SUCCESS :Result:='Returned from main with zero(system).';
STOP_REASON_LIBC_INTERNAL_RETURN_MAIN_FAIL :Result:='Returned from main with non-zero(system).';
STOP_REASON_LIBC_INTERNAL_EXIT_SUCCESS :Result:='exit is called with zero(system).';
STOP_REASON_LIBC_INTERNAL_EXIT_FAIL :Result:='exit is called with non-zero(system).';
STOP_REASON_LIBC_INTERNAL__EXIT_SUCCESS :Result:='_Exit is called with zero(system).';
STOP_REASON_LIBC_INTERNAL__EXIT_FAIL :Result:='_Exit is called with non-zero(system).';
STOP_REASON_LIBC_INTERNAL_ASSERT :Result:='assert is called(system).';
STOP_REASON_LIBC_INTERNAL_TERMINATE :Result:='Terminate is called(system).';
STOP_REASON_LIBC_INTERNAL_UNEXPECTED :Result:='unexpected is called(system).';
STOP_REASON_LIBC_INTERNAL_PURE_VIRTUAL :Result:='pure virtual function is called(system).';
STOP_REASON_LIBC_INTERNAL_ABORT :Result:='abort is called(system).';
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_SUCCESS :Result:='quick_exit is called with zero(system).';
STOP_REASON_LIBC_INTERNAL_QUICK_EXIT_FAIL :Result:='quick_exit is called with non-zero(system).';
STOP_REASON_LIBC_INTERNAL_FAILED_TO_CREATE_SYSTEM_MEMORY :Result:='Failed to create the system memory (please report it in devnet).';
STOP_REASON_PRX_NOT_RESOLVED_FUNCTION :Result:='Called PRX function was not resolved.';
STOP_REASON_PRX_SCE_MODULE_LOAD_ERROR :Result:='Cannot load necessary modules from sce_module.';
STOP_REASON_PRX_RUNTIME_ERROR :Result:='An error occured in dynamic library (PRX) runtime.';
STOP_REASON_PRX_PROCESS_STARTUP_FAILURE :Result:='System software failed to initialize process environment.';
STOP_REASON_PRX_INVALID_IMAGE :Result:='The program loader detected a critical error in the executable file.';
STOP_REASON_PRX_TLS_ALLOC_ERROR :Result:='Dynamic library (PRX) runtime cannot allocate TLS.';
STOP_REASON_SYSTEM_FATAL_LOAD_ERROR :Result:='System software could not start the program.';
STOP_REASON_SYSTEM_PTHREAD_RUNTIME_ERROR :Result:='ScePthread runtime detected a fatal runtime error.';
STOP_REASON_SYSTEM_INTERNAL_PTHREAD_RUNTIME_ERROR :Result:='ScePthread runtime detected a fatal runtime error(internal).';
STOP_REASON_SYSTEM_STACK_CHECK_FAILURE :Result:='System software detected user stack is corrupted.';
STOP_REASON_SYSTEM_INTERNAL_STACK_CHECK_FAILURE :Result:='System software detected user stack is corrupted(internal).';
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR :Result:='The process was forcibly terminated due to unknown fatal error.';
STOP_REASON_SYSTEM_ILLEGAL_FUNCTION_CALL :Result:='The process was terminated with illegal function call.';
STOP_REASON_SYSTEM_SCE_BREAK :Result:='The process was terminated with unhandled SCE_BREAK.';
STOP_REASON_SYSTEM_SCE_STOP :Result:='The process was terminated with unhandled SCE_STOP.';
STOP_REASON_SYSTEM_UNKNOWN_KERNEL_ERROR :Result:='System software forcibly shutdown the process(driver).';
STOP_REASON_SYSTEM_EXECUTABLE_ACCESS_ERROR :Result:='Failed to verify executable.';
STOP_REASON_KERNEL_ABORT_SYSTEM_ABNORMAL_TERMINATION_REQUEST :Result:='The process terminated with sceSystemServiceReportAbnormalTermination.';
STOP_REASON_SYSTEM_INTERNAL_DATA_ACCESS_ERROR :Result:='System software is corrupted.';
STOP_REASON_SYSTEM_ILLEGAL_EXCEPTION_CODE :Result:='The process misused a library and was terminated.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_ERROR :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_DEBUG_RUNTIME_ERROR :Result:='Cannot continue process instrumentation.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_RUNTIME_FATAL :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_ERROR :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_CALL_FATAL :Result:='Failed to request system software service.';
STOP_REASON_SYSTEM_PTHREAD_MUTEX_ERROR :Result:='Critical error on pthread mutex.';
STOP_REASON_SYSTEM_WRITE_ADDRESS_WRAPAROUND :Result:='System software detected wraparound of write address.';
STOP_REASON_SYSTEM_ASAN_FATAL_ASSERT :Result:='The process encountered a fatal ASan error.';
STOP_REASON_SYSTEM_IMAGE_ALLOC_ERROR :Result:='process creation failure: The specified FMEM size is too small.';
STOP_REASON_SYSTEM_DEBUG_RUNTIME_SHADOW_MEMORY_ALLOW_ERROR :Result:='The process was terminated due to lack of memory for mapping the shadow memory for address sanitizer.';
STOP_REASON_SYSTEM_BAILOUT_REQUEST :Result:='Terminating system service(s) without crash reporting. (Internal)';
STOP_REASON_SYSTEM_BAILOUT_LOW_MEMORY :Result:='Terminating system service(s) without crash reporting. (Internal)';
STOP_REASON_SYSTEM_SUSPEND_BLOCK_TIMEOUT_ASYNC :Result:='System software forcibly shutdown the process because of suspend blocker timeout.';
STOP_REASON_SYSTEM_UNKNOWN_FATAL_ERROR_ASYNC :Result:='System software forcibly shutdown the process.';
STOP_REASON_SYSTEM_USER_DEBUG_REQUEST_ASYNC :Result:='The process received debug termination request.';
STOP_REASON_SYSTEM_INTERNAL_SERVICE_TIMEOUT_ASYNC :Result:='Terminating system service(s). (Internal)';
STOP_REASON_SYSTEM_SOFTWARE_TIMEOUT_ASYNC :Result:='The process was forcibly terminated with operation timeout.';
STOP_REASON_SYSTEM_BAILOUT_GENERIC_ASYNC :Result:='Terminating system service(s) without crash reporting. (Internal)';
STOP_REASON_SYSTEM_DEBUGHANDLER_TIMEOUT :Result:='The core dump handler timed out.';
STOP_REASON_SYSTEM_BAILOUT_GENERIC_ASYNC :Result:='Terminating system service(s) without crash reporting. (Internal)';
STOP_REASON_SYSTEM_DEBUGHANDLER_TIMEOUT :Result:='The core dump handler timed out.';
STOP_REASON_SYSTEM_DEBUGHANDLER_REJECTED :Result:='Core dump handler was skipped due to application suspend.';
STOP_REASON_SYSTEM_TRIGGER_COREDUMP_REQUEST :Result:='The process requested core dump generation.';
STOP_REASON_SYSTEM_TRIGGER_COREDUMP_REQUEST :Result:='The process requested coredump generation.';
STOP_REASON_SYSTEM_ASAN_ASSERT :Result:='The process encountered an ASan error.';
STOP_REASON_SYSTEM_VM_RUNTIME :Result:='The process was terminated with VM runtime exception.';
STOP_REASON_SYSTEM_DUMP_AND_CONTINUE_REQUEST_ASYNC :Result:='The process received core dump request.';
STOP_REASON_SYSTEM_DUMP_AND_CONTINUE_REQUEST_ASYNC :Result:='The process received coredump request.';
STOP_REASON_KERNEL_EXCEPTION_SYSTEM_DEBUG_REQUEST_TIMEOUT_ASYNC:Result:='Debug suspend request was timed out.';
STOP_REASON_GPU_FAULT_ASYNC :Result:='GPU exception was detected.';
STOP_REASON_GPU_HP3D_TIMEOUT_ASYNC :Result:='System software forcibly shutdown the process because of GPU timeout.';
STOP_REASON_GPU_SUBMITDONE_TIMEOUT_ASYNC :Result:='System software forcibly shutdown the process because of submitDone timeout.';
STOP_REASON_GPU_BREAK_ASYNC :Result:=' GPU breakpoint detected.';
STOP_REASON_GPU_FAULT_PAGE_FAULT_ASYNC :Result:='GPU page fault detected.';
STOP_REASON_GPU_FAULT_BAD_OP_CODE_ASYNC :Result:='GPU encountered illegal instruction.';
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC :Result:='System software forcibly shutdown the process because of submitDone timeout. GPU was in busy state.';
STOP_REASON_GPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC :Result:='System software failed to suspend the process because of submitDone timeout. GPU was in busy state.';
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_RUN_ASYNC :Result:='System software forcibly shutdown the process because of submitDone timeout. GPU was in idle state.';
STOP_REASON_CPU_FAULT_SUBMITDONE_TIMEOUT_IN_SUSPEND_ASYNC :Result:='System software failed to suspend the process because of submitDone timeout. GPU was in idle state.';
STOP_REASON_GPU_FAULT_IDLE_TIMEOUT_AFTER_SUBMITDONE_ASYNC :Result:='GPU idle timeout after submitDone.';
STOP_REASON_SLV_MUTEX_UNLOCK_NOT_OWNED :Result:='ScePthreadMutexUnlock() : Unlocking mutex that is not locked by the calling thread.';
STOP_REASON_SLV_POSIX_MUTEX_UNLOCK_NOT_OWNED :Result:='pthread_mutex_unlock() : Unlocking mutex that is not locked by the calling thread.';
STOP_REASON_SLV_MUTEX_DESTROY_LOCKED :Result:='ScePthreadMutexDestroy() : Destroying locked mutex.';
STOP_REASON_SLV_POSIX_MUTEX_DESTROY_LOCKED :Result:='pthread_mutex_destroy() : Destroying locked mutex.';
STOP_REASON_SLV_MUTEX_LOCK_DESTROYED :Result:='ScePthreadMutexLock() : Locking destroyed mutex.';
STOP_REASON_SLV_POSIX_MUTEX_LOCK_DESTROYED :Result:='pthread_mutex_lock() : Locking destroyed mutex.';
STOP_REASON_SLV_CLOSE_NOT_PERMITTED_FD :Result:='SceKernelClose() : Closing specified fd is not permitted.';
STOP_REASON_SLV_POSIX_CLOSE_NOT_PERMITTED_FD :Result:='close() : Closing specified fd is not permitted.';
STOP_REASON_SLV_MUTEX_DESTROY_DESTROYED :Result:='ScePthreadMutexDestroy() : Destroying destroyed mutex.';
STOP_REASON_SLV_POSIX_MUTEX_DESTROY_DESTROYED :Result:='pthread_mutex_destroy() : Destroying destroyed mutex.';
STOP_REASON_SLV_MUTEX_TIMEDLOCK_DESTROYED :Result:='ScePthreadMutexTimedlock() : Locking destroyed mutex (with timeout).';
STOP_REASON_SLV_MUTEX_TRYLOCK_DESTROYED :Result:='ScePthreadMutexTrylock() : Trying to lock destroyed mutex.';
STOP_REASON_SLV_POSIX_MUTEX_TRYLOCK_DESTROYED :Result:='pthread_mutex_trylock() : Trying to lock destroyed mutex.';
STOP_REASON_SLV_MUTEX_UNLOCK_DESTROYED :Result:='ScePthreadMutexUnlock() : Unlocking destroyed mutex.';
STOP_REASON_SLV_POSIX_MUTEX_UNLOCK_DESTROYED :Result:='pthread_mutex_unlock() : Unlocking destroyed mutex.';
STOP_REASON_SLV_COND_BROADCAST_DESTROYED :Result:='ScePthreadCondBroadcast() : Broadcasting destroyed condition variable.';
STOP_REASON_SLV_POSIX_COND_BROADCAST_DESTROYED :Result:='pthread_cond_broadcast() : Broadcasting destroyed condition variable.';
STOP_REASON_SLV_COND_DESTROY_DESTROYED :Result:='ScePthreadCondDestroy() : Destroying destroyed condition variable.';
STOP_REASON_SLV_POSIX_COND_DESTROY_DESTROYED :Result:='pthread_cond_destroy() : Destroying destroyed condition variable.';
STOP_REASON_SLV_COND_SIGNAL_DESTROYED :Result:='ScePthreadCondSignal() : Signaling destroyed condition variable.';
STOP_REASON_SLV_POSIX_COND_SIGNAL_DESTROYED :Result:='pthread_cond_signal() : Signaling destroyed condition variable.';
STOP_REASON_SLV_COND_SIGNALTO_DESTROYED :Result:='ScePthreadCondSignalto() : Signaling destroyed condition variable (specific thread).';
STOP_REASON_SLV_COND_TIMEDWAIT_DESTROYED :Result:='ScePthreadCondTimedwait() : Waiting destroyed condition variable (with timeout).';
STOP_REASON_SLV_COND_TIMEDWAIT_MUTEX_NOT_OWNED :Result:='ScePthreadCondTimedwait() : Mutex is not locked by the calling thread.';
STOP_REASON_SLV_POSIX_COND_TIMEDWAIT_MUTEX_NOT_OWNED :Result:='pthread_cond_timedwait() : Mutex is not locked by the calling thread.';
STOP_REASON_SLV_COND_WAIT_DESTROYED :Result:='ScePthreadCondWait() : Waiting destroyed condition variable.';
STOP_REASON_SLV_POSIX_COND_WAIT_DESTROYED :Result:='pthread_cond_wait() : Waiting destroyed condition variable.';
STOP_REASON_SLV_COND_WAIT_MUTEX_NOT_OWNED :Result:='ScePthreadCondWait() : mutex is not locked by the calling thread.';
STOP_REASON_SLV_POSIX_COND_WAIT_MUTEX_NOT_OWNED :Result:='pthread_cond_wait() : Mutex is not locked by the calling thread.';
STOP_REASON_SLV_RWLOCK_DESTROY_DESTROYED :Result:='ScePthreadRwlockDestroy() : Destroying destroyed read / write lock.';
STOP_REASON_SLV_POSIX_RWLOCK_DESTROY_DESTROYED :Result:='pthread_rwlock_destroy() : Destroying destroyed read / write lock.';
STOP_REASON_SLV_RWLOCK_RDLOCK_DESTROYED :Result:='ScePthreadRwlockRdlock() : Locking destroyed read / write lock (for reading).';
STOP_REASON_SLV_POSIX_RWLOCK_RDLOCK_DESTROYED :Result:='pthread_rwlock_rdlock() : Locking destroyed read / write lock (for reading).';
STOP_REASON_SLV_RWLOCK_TIMEDRDLOCK_DESTROYED :Result:='ScePthreadRwlockTimedrdlock() : Locking destroyed read / write lock (for reading, with timeout).';
STOP_REASON_SLV_RWLOCK_TIMEDWRLOCK_DESTROYED :Result:='ScePthreadRwlockTimedwrlock() : Locking destroyed read / write lock (for writing, with timeout).';
STOP_REASON_SLV_RWLOCK_TRYRDLOCK_DESTROYED :Result:='ScePthreadRwlockTryrdlock() : Trying to lock destroyed read / write lock (for reading).';
STOP_REASON_SLV_POSIX_RWLOCK_TRYRDLOCK_DESTROYED :Result:='pthread_rwlock_tryrdlock() : Trying to lock destroyed read / write lock (for reading).';
STOP_REASON_SLV_RWLOCK_TRYWRLOCK_DESTROYED :Result:='ScePthreadRwlockTrywrlock() : Trying to lock destroyed read / write lock (for writing).';
STOP_REASON_SLV_POSIX_RWLOCK_TRYWRLOCK_DESTROYED :Result:='pthread_rwlock_trywrlock() : Trying to lock destroyed read / write lock (for writing).';
STOP_REASON_SLV_RWLOCK_UNLOCK_DESTROYED :Result:='ScePthreadRwlockUnlock() : Unlocking destroyed read / write lock.';
STOP_REASON_SLV_POSIX_RWLOCK_UNLOCK_DESTROYED :Result:='pthread_rwlock_unlock() : Unlocking destroyed read / write lock.';
STOP_REASON_SLV_RWLOCK_UNLOCK_NOT_OWNED :Result:='ScePthreadRwlockUnlock() : Read / write lock is not locked by the calling thread.';
STOP_REASON_SLV_POSIX_RWLOCK_UNLOCK_NOT_OWNED :Result:='pthread_rwlock_unlock() : Read / write lock is not locked by the calling thread.';
STOP_REASON_SLV_RWLOCK_WRLOCK_DESTROYED :Result:='ScePthreadRwlockWrlock() : Locking destroyed read / write lock (for writing).';
STOP_REASON_SLV_POSIX_RWLOCK_WRLOCK_DESTROYED :Result:='pthread_rwlock_wrlock() : Locking destroyed read / write lock (for writing).';
STOP_REASON_SLV_BARRIER_DESTROY_DESTROYED :Result:='ScePthreadBarrierDestroy() : Destroying destroyed barrier.';
STOP_REASON_SLV_POSIX_BARRIER_DESTROY_DESTROYED :Result:='pthread_barrier_destroy() : Destroying destroyed barrier.';
STOP_REASON_SLV_BARRIER_DESTROY_IN_USE :Result:='ScePthreadBarrierDestroy() : Destroying barrier that is being used by any one of the threads.';
STOP_REASON_SLV_POSIX_BARRIER_DESTROY_IN_USE :Result:='pthread_barrier_destroy() : Destroying barrier that is being used by any one of the threads.';
STOP_REASON_SLV_BARRIER_WAIT_DESTROYED :Result:='ScePthreadBarrierWait() : Waiting destroyed barrier.';
STOP_REASON_SLV_POSIX_BARRIER_WAIT_DESTROYED :Result:='pthread_barrier_wait() : Waiting destroyed barrier.';
STOP_REASON_SLV_POSIX_MUTEX_TIMEDLOCK_DESTROYED :Result:='Specified mutex is not valid.';
STOP_REASON_SLV_POSIX_COND_TIMEDWAIT_DESTROYED :Result:='Specified condition variable is not valid.';
STOP_REASON_SLV_POSIX_RWLOCK_TIMEDRDLOCK_DESTROYED :Result:='Specified read / write lock is not valid.';
STOP_REASON_SLV_POSIX_RWLOCK_TIMEDWRLOCK_DESTROYED :Result:='Specified read / write lock is not valid.';
else
Result:='';
end;

View File

@ -29,12 +29,12 @@ int _sceKernelMapDirectMemory
uint _len;
pthread_once((pthread_once_t *)&_mem_init_ctl,_mem_init);
ret1 = L'\x80020016';
ret1 = SCE_KERNEL_ERROR_EINVAL;
if (pool_id < 3) {
adr = *virtualAddrDest;
if ((((_direct_pool_id == 1) && ((DAT_01084c7c & 2) == 0)) &&
if ((((_direct_pool_id == 1) && ((APP_INFO[4] & 2) == 0)) &&
(((long)physicalAddr < 0x3000000000 || (0x301fffffff < physicalAddr)))) &&
(((flags & 0x400U) == 0 && (0x24fffff < DAT_01059790)))) {
(((flags & 0x400U) == 0 && (0x24fffff < SDK_VERSION)))) {
ret1 = sceKernelMapDirectMemory2
(virtualAddrDest,length,-1,protections,flags,physicalAddr,alignment);
return ret1;
@ -44,9 +44,9 @@ int _sceKernelMapDirectMemory
(((uint)adr | (uint)alignment | (uint)physicalAddr | _len) & 0x3fff) == 0)) &&
((~-alignment & alignment) == 0)) {
_flags = flags & 0xfffffbff;
if (((flags & 0x10U) != 0) && (adr == (void *)0x0)) {
if (0x16fffff < DAT_01059790) {
return L'\x80020016';
if (((flags & MAP_FIXED) != 0) && (adr == (void *)0x0)) {
if (0x16fffff < SDK_VERSION) {
return SCE_KERNEL_ERROR_EINVAL;
}
_flags = flags & 0xfffffbef;
puts("[WARNING] map(addr=0, flags=MAP_FIXED)");
@ -56,7 +56,7 @@ int _sceKernelMapDirectMemory
adr = (void *)0x880000000;
}
else {
adr = (void *)((ulong)((DAT_01084c7c & 2) == 0) << 0x21);
adr = (void *)((ulong)((APP_INFO[4] & 2) == 0) << 0x21);
}
}
align = 0x4000;
@ -103,9 +103,9 @@ int sceKernelMapDirectMemory2
qword align;
pthread_once((pthread_once_t *)&_mem_init_ctl,_mem_init);
ret1 = L'\x8002002d';
if ((((_direct_pool_id == 1) && ((DAT_01084c7c & 2) == 0)) &&
(ret1 = -0x7ffdffea, (flags & 0x1f000000U) == 0)) &&
ret1 = SCE_KERNEL_ERROR_EOPNOTSUPP;
if ((((_direct_pool_id == 1) && ((APP_INFO[4] & 2) == 0)) &&
(ret1 = SCE_KERNEL_ERROR_EINVAL, (flags & 0x1f000000U) == 0)) &&
(((alignment & 0x3fff) == 0 && ((~-alignment & alignment) == 0)))) {
align = 0x4000;
if (0x4000 < alignment) {
@ -154,13 +154,13 @@ int _sceKernelMapFlexibleMemory
void *adr;
int err;
ret1 = -0x7ffdffea;
ret1 = SCE_KERNEL_ERROR_EINVAL;
if (((0x3fff < length) && ((length & 0x3fff) == 0)) &&
((flags & 0xffbfff6fU | protections & 0xffffffc8U) == 0)) {
adr = *virtualAddrDest;
if (((flags & 0x10U) != 0) && (adr == (void *)0x0)) {
if (0x16fffff < DAT_01059790) {
return L'\x80020016';
if (((flags & MAP_FIXED) != 0) && (adr == (void *)0x0)) {
if (0x16fffff < SDK_VERSION) {
return SCE_KERNEL_ERROR_EINVAL;
}
flags = flags & 0xffffffef;
puts("[WARNING] map(addr=0, flags=MAP_FIXED)");
@ -170,7 +170,7 @@ int _sceKernelMapFlexibleMemory
adr = (void *)0x880000000;
}
else {
adr = (void *)((ulong)((DAT_01084c7c & 2) == 0) << 0x21);
adr = (void *)((ulong)((APP_INFO[4] & 2) == 0) << 0x21);
}
}
adr = (void *)mmap(adr,length,protections,flags | MAP_ANON,-1,0);
@ -199,7 +199,7 @@ int sceKernelReserveVirtualRange(void **addr,size_t len,int flags,size_t alignme
int ret1;
void *adr;
ret1 = -0x7ffdffea;
ret1 = SCE_KERNEL_ERROR_EINVAL;
if ((((flags & 0xffbfff6fU) == 0) &&
(adr = *addr, (((uint)adr | (uint)alignment | (uint)len) & 0x3fff) == 0)) &&
((~-alignment & alignment) == 0)) {
@ -209,9 +209,9 @@ int sceKernelReserveVirtualRange(void **addr,size_t len,int flags,size_t alignme
}
last = flsl(align);
if (last + -1 < 0x1f) {
if (((flags & 0x10U) != 0) && (adr == (void *)0x0)) {
if (0x16fffff < DAT_01059790) {
return -0x7ffdffea;
if (((flags & MAP_FIXED) != 0) && (adr == (void *)0x0)) {
if (0x16fffff < SDK_VERSION) {
return SCE_KERNEL_ERROR_EINVAL;
}
flags = flags & 0xffffffef;
puts("[WARNING] map(addr=0, flags=MAP_FIXED)");
@ -319,10 +319,10 @@ int sceKernelReleaseFlexibleMemory(void *addr,size_t len)
int ret2;
int ret1;
ret1 = -0x7ffdffea;
ret1 = SCE_KERNEL_ERROR_EINVAL;
if ((((uint)addr | (uint)len) & 0x3fff) == 0) {
ret2 = madvise(addr,len,MADV_FREE);
ret1 = -0x7ffdffea;
ret1 = SCE_KERNEL_ERROR_EINVAL;
if (ret2 != -1) {
ret1 = 0;
}

View File

@ -57,7 +57,7 @@ type
function c(const a,b:TDirectAdrNode):Integer; static;
end;
TMemoryUnmapCb=procedure(addr:Pointer;Size:QWORD);
TMemoryUnmapCb=function(addr:Pointer;Size:QWORD):Integer;
TDirectManager=class
private
@ -76,20 +76,19 @@ type
Constructor Create;
private
procedure _Insert(const key:TDirectAdrNode);
Function _FetchFree_a(Size,Align:QWORD;var R:TDirectAdrNode):Boolean;
Function _FetchFree_s(ss,se,Size,Align:QWORD;var R:TDirectAdrNode):Boolean;
Function _FetchNode_m(mode:Byte;cmp:QWORD;var R:TDirectAdrNode):Boolean;
Function _Find_m(mode:Byte;var R:TDirectAdrNode):Boolean;
procedure _Merge(key:TDirectAdrNode);
procedure _Devide(Offset,Size:QWORD;var key:TDirectAdrNode);
procedure _UnmapVirtual(addr:Pointer;Size:QWORD);
function _UnmapVirtual(addr:Pointer;Size:QWORD):Integer;
public
var
OnMemoryUnmapCb:TMemoryUnmapCb;
Function Alloc_any(Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
Function Alloc_search(ss,se,Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
Function Alloc(ss,se,Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
Function Alloc(Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
Function Query(Offset:QWORD;next:Boolean;var ROut:TDirectAdrNode):Integer;
Function QueryMType(Offset:QWORD;var ROut:TDirectAdrNode):Integer;
Function CheckedAvailable(ss,se,Align:QWORD;var AdrOut,SizeOut:QWORD):Integer;
@ -97,8 +96,7 @@ type
Function CheckedMMap(Offset,Size:QWORD):Integer;
Function CheckedRelease(Offset,Size:QWORD):Integer;
Function Release(Offset,Size:QWORD):Integer;
Function mmap_addr(Offset,Size:QWORD;addr:Pointer):Integer;
Function mmap_addr2(Offset,Size:QWORD;addr:Pointer;mtype:Byte):Integer;
Function mmap_addr(Offset,Size:QWORD;addr:Pointer;mtype:Integer=-1):Integer;
Function unmap_addr(Offset,Size:QWORD):Integer;
procedure Print;
@ -219,30 +217,6 @@ begin
end;
//free: [Size] |[Offset]
Function TDirectManager._FetchFree_a(Size,Align:QWORD;var R:TDirectAdrNode):Boolean;
var
It:TFreePoolNodeSet.Iterator;
key:TDirectAdrNode;
Offset:QWORD;
begin
Result:=false;
key:=Default(TDirectAdrNode);
key.Size:=Size;
It:=FFreeSet.find_be(key);
if (It.Item=nil) then Exit;
repeat
key:=It.Item^;
Offset:=System.Align(key.Offset,Align);
if (Offset+Size)<=(key.Offset+key.Size) then
begin
R:=key;
FAllcSet.delete(key);
FFreeSet.erase(It);
Exit(True);
end;
until not It.Next;
end;
Function TDirectManager._FetchFree_s(ss,se,Size,Align:QWORD;var R:TDirectAdrNode):Boolean;
var
It:TFreePoolNodeSet.Iterator;
@ -423,44 +397,14 @@ begin
key.addr :=ia(Faddr,(Offset-FOffset));
end;
procedure TDirectManager._UnmapVirtual(addr:Pointer;Size:QWORD);
function TDirectManager._UnmapVirtual(addr:Pointer;Size:QWORD):Integer;
begin
if (addr=nil) or (Size=0) then Exit;
if (OnMemoryUnmapCb=nil) then Exit;
OnMemoryUnmapCb(addr,Size);
if (addr=nil) or (Size=0) then Exit(0);
if (OnMemoryUnmapCb=nil) then Exit(EINVAL);
Result:=OnMemoryUnmapCb(addr,Size);
end;
Function TDirectManager.Alloc_any(Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
var
key:TDirectAdrNode;
Offset:QWORD;
begin
Result:=0;
if (Size=0) or (Align=0) then Exit(EINVAL);
key:=Default(TDirectAdrNode);
if _FetchFree_a(Size,Align,key) then
begin
Offset:=System.Align(key.Offset,Align);
_Devide(Offset,Size,key);
//new save
key.IsFree :=False;
key.F.mtype:=mtype;
key.addr :=nil;
_Merge(key);
AdrOut:=key.Offset;
Result:=0;
end else
begin
Result:=ENOMEM;
end;
end;
Function TDirectManager.Alloc_search(ss,se,Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
Function TDirectManager.Alloc(ss,se,Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
var
key:TDirectAdrNode;
Offset:QWORD;
@ -492,6 +436,11 @@ begin
end;
end;
Function TDirectManager.Alloc(Size,Align:QWORD;mtype:Byte;var AdrOut:QWORD):Integer;
begin
Result:=Alloc(Flo,Fhi,Size,Align,mtype,AdrOut);
end;
Function TDirectManager.Query(Offset:QWORD;next:Boolean;var ROut:TDirectAdrNode):Integer;
var
It:TAllcPoolNodeSet.Iterator;
@ -678,6 +627,30 @@ var
FEndN,FEndO:QWORD;
FSize:QWORD;
function _fetch:Boolean;
begin
Result:=False;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
Result:=True;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
Result:=True;
end;
end;
function _map:Boolean;
begin
Result:=False;
@ -722,25 +695,16 @@ begin
key.IsFree:=False;
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
if _fetch then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
Result:=_UnmapVirtual(key.addr,key.Size);
_Devide(Offset,Size,key);
_UnmapVirtual(key.addr,key.Size);
if _map then Break;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
_UnmapVirtual(key.addr,key.Size);
if (Result<>0) then
begin
_Merge(key); //undo
Assert(false,IntToStr(Result));
Exit;
end;
if _map then Break;
end else
@ -759,17 +723,47 @@ begin
until false;
end;
Function TDirectManager.mmap_addr(Offset,Size:QWORD;addr:Pointer):Integer;
Function TDirectManager.mmap_addr(Offset,Size:QWORD;addr:Pointer;mtype:Integer=-1):Integer;
var
key:TDirectAdrNode;
FEndN,FEndO:QWORD;
FSize:QWORD;
function _fetch:Boolean;
begin
Result:=False;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
Result:=True;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
Result:=True;
end;
end;
function _map:Boolean;
begin
Result:=False;
//new save
if (mtype>=0) then
begin
key.F.mtype:=mtype;
end;
key.addr :=addr;
_Merge(key);
@ -809,106 +803,8 @@ begin
key.IsFree:=False;
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
if _fetch then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
if _map then Break;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
if _map then Break;
end else
if _Find_m(M_LE,key) then
begin
if _skip then Break;
end else
if _Find_m(M_BE,key) then
begin
if _skip then Break;
end else
begin
Break;
end;
until false;
end;
Function TDirectManager.mmap_addr2(Offset,Size:QWORD;addr:Pointer;mtype:Byte):Integer;
var
key:TDirectAdrNode;
FEndN,FEndO:QWORD;
FSize:QWORD;
function _map:Boolean;
begin
Result:=False;
//new save
key.F.mtype:=mtype;
key.addr :=addr;
_Merge(key);
if (FEndO>=FEndN) then Exit(True);
FSize:=FEndO-Offset;
addr :=ia(addr,FSize);
Offset:=Offset+FSize;
Size :=Size -FSize;
end;
function _skip:Boolean; inline;
begin
Result:=False;
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
if (FEndO>=FEndN) then Exit(True);
FSize:=FEndO-Offset;
addr :=ia(addr,FSize);
Offset:=Offset+FSize;
Size :=Size -FSize;
end;
begin
Result:=0;
if (Size=0) then Exit(EINVAL);
if (Offset<Flo) or (Offset>Fhi) then Exit(EINVAL);
repeat
key:=Default(TDirectAdrNode);
key.IsFree:=False;
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
if _map then Exit;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
if _map then Exit;
end else
if _Find_m(M_LE,key) then
@ -967,22 +863,22 @@ var
begin
test:=TDirectManager.Create;
test.Alloc_any(4*1024,1,0,addr[0]);
test.Alloc(4*1024,1,0,addr[0]);
Writeln(HexStr(addr[0],16));
test.Alloc_any(4*1024,1,0,addr[1]);
test.Alloc(4*1024,1,0,addr[1]);
Writeln(HexStr(addr[1],16));
test.Alloc_any(4*1024,1,0,addr[2]);
test.Alloc(4*1024,1,0,addr[2]);
Writeln(HexStr(addr[2],16));
test.Alloc_any(4*1024,1,0,addr[3]);
test.Alloc(4*1024,1,0,addr[3]);
Writeln(HexStr(addr[3],16));
test.Alloc_any(4*1024,1,0,addr[4]);
test.Alloc(4*1024,1,0,addr[4]);
Writeln(HexStr(addr[4],16));
test.Alloc_any(4*1024,1,0,addr[5]);
test.Alloc(4*1024,1,0,addr[5]);
Writeln(HexStr(addr[5],16));
writeln;

View File

@ -53,8 +53,8 @@ type
PVirtualAdrBlock=^TVirtualAdrBlock;
TVirtualAdrBlock=packed object
private
Function GetOffset:QWORD; inline;
Procedure SetOffset(q:QWORD); inline;
Function GetOffset:Pointer; inline;
Procedure SetOffset(q:Pointer); inline;
Function GetSize:QWORD; inline;
Procedure SetSize(q:QWORD); inline;
Function GetUsed:QWORD; inline;
@ -66,7 +66,7 @@ type
btype :bit8;
used :DWORD;
end;
property Offset:QWORD read GetOffset write SetOffset;
property Offset:Pointer read GetOffset write SetOffset;
property Size:QWORD read GetSize write SetSize;
property Used:QWORD read GetUsed write SetUsed;
function Commit(key:PVirtualAdrNode;prot:Integer):Integer;
@ -79,8 +79,8 @@ type
private
//free: [Size] |[Offset]
//alloc: [Offset]
Function GetOffset:QWORD; inline;
Procedure SetOffset(q:QWORD); inline;
Function GetOffset:Pointer; inline;
Procedure SetOffset(q:Pointer); inline;
Function GetSize:QWORD; inline;
Procedure SetSize(q:QWORD); inline;
Function GetAddr:QWORD; inline;
@ -102,7 +102,7 @@ type
align :bit3;
end;
block:PVirtualAdrBlock;
property Offset:QWORD read GetOffset write SetOffset;
property Offset:Pointer read GetOffset write SetOffset;
property Size:QWORD read GetSize write SetSize;
property addr:QWORD read GetAddr write SetAddr;
property IsFree:Boolean read GetIsFree write SetIsFree;
@ -117,7 +117,7 @@ type
function c(const a,b:TVirtualAdrNode):Integer; static;
end;
TDirectUnmapCb=procedure(Offset,Size:QWORD);
TDirectUnmapCb=function(Offset,Size:QWORD):Integer;
TVirtualManager=class
private
@ -126,36 +126,36 @@ type
TAllcPoolNodeSet=specialize T23treeSet<TVirtualAdrNode,TVirtualAdrAllcCompare>;
var
Flo,Fhi:QWORD;
Flo,Fhi:Pointer;
FFreeSet:TFreePoolNodeSet;
FAllcSet:TAllcPoolNodeSet;
public
property lo:QWORD read Flo;
property hi:QWORD read Fhi;
property lo:Pointer read Flo;
property hi:Pointer read Fhi;
Constructor Create(_lo,_hi:QWORD);
private
procedure _Insert(const key:TVirtualAdrNode);
Function _FetchFree_s(ss,Size,Align:QWORD;var R:TVirtualAdrNode):Boolean;
Function _FetchNode_m(mode:Byte;cmp:QWORD;var R:TVirtualAdrNode):Boolean;
Function _FetchFree_s(ss:Pointer;Size,Align:QWORD;var R:TVirtualAdrNode):Boolean;
Function _FetchNode_m(mode:Byte;cmp:Pointer;var R:TVirtualAdrNode):Boolean;
Function _Find_m(mode:Byte;var R:TVirtualAdrNode):Boolean;
procedure _Merge(key:TVirtualAdrNode);
procedure _Devide(Offset,Size:QWORD;var key:TVirtualAdrNode);
procedure _UnmapDirect(Offset,Size:QWORD);
Function _FindFreeOffset(ss,Size,Align:QWORD;var AdrOut:QWORD):Integer;
procedure _set_block(Offset,Size:QWORD;block:PVirtualAdrBlock);
procedure _mmap_addr(Offset,Size,addr:QWORD;direct:Boolean);
procedure _Devide(Offset:Pointer;Size:QWORD;var key:TVirtualAdrNode);
function _UnmapDirect(Offset,Size:QWORD):Integer;
Function _FindFreeOffset(ss:Pointer;Size,Align:QWORD;var AdrOut:Pointer):Integer;
procedure _set_block(Offset:Pointer;Size:QWORD;block:PVirtualAdrBlock);
procedure _mmap_addr(Offset:Pointer;Size,addr:QWORD;direct:Boolean);
public
var
OnDirectUnmapCb:TDirectUnmapCb;
Function check_fixed(Offset,Size:QWORD;flags:Byte):Integer;
Function mmap(Offset,Size,Align:QWORD;prot,flags:Byte;var AdrOut:QWORD):Integer;
Function check_fixed(Offset:Pointer;Size:QWORD;flags:Byte;fd:Integer):Integer;
Function mmap(Offset:Pointer;Size,Align:QWORD;prot,flags:Byte;fd:Integer;addr:QWORD;var AdrOut:Pointer):Integer;
Function CheckedAlloc(Offset,Size:QWORD):Integer;
Function Release(Offset,Size:QWORD):Integer;
Function CheckedAlloc(Offset:Pointer;Size:QWORD):Integer;
Function Release(Offset:Pointer;Size:QWORD):Integer;
procedure Print;
end;
@ -175,10 +175,10 @@ const
//
function NewAdrBlock(Offset,Size:QWORD;prot:Integer;btype:Byte;fd:Integer;offst:size_t):PVirtualAdrBlock;
function NewAdrBlock(Offset:Pointer;Size:QWORD;prot:Integer;btype:Byte;fd:Integer;offst:size_t):PVirtualAdrBlock;
var
FShift :QWORD;
FOffset:QWORD;
FOffset:Pointer;
FSize :QWORD;
err :Integer;
begin
@ -232,9 +232,9 @@ end;
//
function ia(var k:TVirtualAdrNode;addr,Size:qword):qword; inline;
function ia(b:Boolean;addr,Size:qword):qword; inline;
begin
if (k.F.direct<>0) or (k.F.mapped<>0) then
if b then
begin
Result:=addr+Size;
end else
@ -243,21 +243,26 @@ begin
end;
end;
function Max(a,b:QWORD):QWORD; inline;
function ia(var k:TVirtualAdrNode;addr,Size:qword):qword; inline;
begin
Result:=ia((k.F.direct<>0) or (k.F.mapped<>0),addr,Size);
end;
function Max(a,b:Pointer):Pointer; inline;
begin
if (a>b) then Result:=a else Result:=b;
end;
//
Function TVirtualAdrBlock.GetOffset:QWORD; inline;
Function TVirtualAdrBlock.GetOffset:Pointer; inline;
begin
Result:=QWORD(F.Offset) shl 12;
Result:=Pointer(QWORD(F.Offset) shl 12);
end;
Procedure TVirtualAdrBlock.SetOffset(q:QWORD); inline;
Procedure TVirtualAdrBlock.SetOffset(q:Pointer); inline;
begin
F.Offset:=DWORD(q shr 12);
F.Offset:=DWORD(QWORD(q) shr 12);
Assert(GetOffset=q);
end;
@ -337,14 +342,14 @@ end;
//
Function TVirtualAdrNode.GetOffset:QWORD; inline;
Function TVirtualAdrNode.GetOffset:Pointer; inline;
begin
Result:=QWORD(F.Offset) shl 12;
Result:=Pointer(QWORD(F.Offset) shl 12);
end;
Procedure TVirtualAdrNode.SetOffset(q:QWORD); inline;
Procedure TVirtualAdrNode.SetOffset(q:Pointer); inline;
begin
F.Offset:=DWORD(q shr 12);
F.Offset:=DWORD(QWORD(q) shr 12);
Assert(GetOffset=q);
end;
@ -400,12 +405,12 @@ var
begin
Assert(_lo<_hi);
Flo:=_lo;
Fhi:=_hi;
Flo:=Pointer(_lo);
Fhi:=Pointer(_hi);
key:=Default(TVirtualAdrNode);
key.IsFree:=True;
key.Offset:=_lo;
key.Offset:=Pointer(_lo);
key.Size :=(_hi-_lo+1);
_Insert(key);
@ -424,11 +429,11 @@ begin
end;
//free: [Size] |[Offset]
Function TVirtualManager._FetchFree_s(ss,Size,Align:QWORD;var R:TVirtualAdrNode):Boolean;
Function TVirtualManager._FetchFree_s(ss:Pointer;Size,Align:QWORD;var R:TVirtualAdrNode):Boolean;
var
It:TFreePoolNodeSet.Iterator;
key:TVirtualAdrNode;
Offset:QWORD;
Offset:Pointer;
begin
Result:=false;
key:=Default(TVirtualAdrNode);
@ -461,7 +466,7 @@ const
C_LE=12;
C_BE=16;
Function TVirtualManager._FetchNode_m(mode:Byte;cmp:QWORD;var R:TVirtualAdrNode):Boolean;
Function TVirtualManager._FetchNode_m(mode:Byte;cmp:Pointer;var R:TVirtualAdrNode):Boolean;
var
It:TAllcPoolNodeSet.Iterator;
key,rkey:TVirtualAdrNode;
@ -565,12 +570,12 @@ begin
_Insert(key);
end;
procedure TVirtualManager._Devide(Offset,Size:QWORD;var key:TVirtualAdrNode);
procedure TVirtualManager._Devide(Offset:Pointer;Size:QWORD;var key:TVirtualAdrNode);
var
FOffset:QWORD;
FOffset:Pointer;
FSize:QWORD;
Faddr:QWORD;
FEndN,FEndO:QWORD;
FEndN,FEndO:Pointer;
begin
FOffset:=key.Offset;
FSize :=key.Size;
@ -604,18 +609,18 @@ begin
key.addr :=ia(key,Faddr,(Offset-FOffset));
end;
procedure TVirtualManager._UnmapDirect(Offset,Size:QWORD);
function TVirtualManager._UnmapDirect(Offset,Size:QWORD):Integer;
begin
if (Size=0) then Exit;
if (OnDirectUnmapCb=nil) then Exit;
OnDirectUnmapCb(Offset,Size);
if (Size=0) then Exit(0);
if (OnDirectUnmapCb=nil) then Exit(EINVAL);
Result:=OnDirectUnmapCb(Offset,Size);
end;
Function TVirtualManager._FindFreeOffset(ss,Size,Align:QWORD;var AdrOut:QWORD):Integer;
Function TVirtualManager._FindFreeOffset(ss:Pointer;Size,Align:QWORD;var AdrOut:Pointer):Integer;
var
It:TFreePoolNodeSet.Iterator;
key:TVirtualAdrNode;
Offset:QWORD;
Offset:Pointer;
begin
Result:=0;
key:=Default(TVirtualAdrNode);
@ -638,12 +643,36 @@ begin
Result:=ENOMEM;
end;
procedure TVirtualManager._set_block(Offset,Size:QWORD;block:PVirtualAdrBlock);
procedure TVirtualManager._set_block(Offset:Pointer;Size:QWORD;block:PVirtualAdrBlock);
var
key:TVirtualAdrNode;
FEndN,FEndO:QWORD;
FEndN,FEndO:Pointer;
FSize:QWORD;
function _fetch:Boolean;
begin
Result:=False;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
Result:=True;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
Result:=True;
end;
end;
function _map:Boolean;
begin
Result:=False;
@ -686,22 +715,8 @@ begin
key:=Default(TVirtualAdrNode);
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
if _fetch then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
if _map then Break;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
if _map then Break;
end else
begin
@ -711,12 +726,36 @@ begin
until false;
end;
procedure TVirtualManager._mmap_addr(Offset,Size,addr:QWORD;direct:Boolean);
procedure TVirtualManager._mmap_addr(Offset:Pointer;Size,addr:QWORD;direct:Boolean);
var
key:TVirtualAdrNode;
FEndN,FEndO:QWORD;
FEndN,FEndO:Pointer;
FSize:QWORD;
function _fetch:Boolean;
begin
Result:=False;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
Result:=True;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
Result:=True;
end else
end;
function _map:Boolean;
begin
Result:=False;
@ -747,22 +786,8 @@ begin
key:=Default(TVirtualAdrNode);
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
if _fetch then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
if _map then Break;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
if _map then Break;
end else
begin
@ -790,11 +815,22 @@ begin
end;
end;
Function TVirtualManager.check_fixed(Offset,Size:QWORD;flags:Byte):Integer;
Function TVirtualManager.check_fixed(Offset:Pointer;Size:QWORD;flags:Byte;fd:Integer):Integer;
var
It:TAllcPoolNodeSet.Iterator;
key:TVirtualAdrNode;
FEndO:QWORD;
FEndO:Pointer;
function _overwrite:Boolean; inline;
begin
Result:=(flags and MAP_NO_OVERWRITE)=0;
end;
function _mapped:Boolean; inline;
begin
Result:=((flags and MAP_SHARED)<>0) and (fd>0);
end;
begin
Result:=0;
if (Size=0) then Exit(EINVAL);
@ -817,9 +853,12 @@ begin
begin
//
end else
if (key.F.reserv=0) then
begin
if (flags and MAP_NO_OVERWRITE)<>0 then Exit(ENOMEM);
if _mapped then Exit(ENOSYS);
if (key.F.reserv=0) then
begin
if not _overwrite then Exit(ENOMEM);
end;
end;
end;
@ -829,30 +868,88 @@ begin
end;
end;
Function TVirtualManager.mmap(Offset,Size,Align:QWORD;prot,flags:Byte;var AdrOut:QWORD):Integer;
Function TVirtualManager.mmap(Offset:Pointer;Size,Align:QWORD;prot,flags:Byte;fd:Integer;addr:QWORD;var AdrOut:Pointer):Integer;
var
key:TVirtualAdrNode;
FEndN,FEndO:QWORD;
start:Pointer;
FEndN,FEndO:Pointer;
FSize:QWORD;
err:Integer;
btype:Byte;
function _fixed:Boolean; inline;
begin
Result:=((flags and MAP_FIXED)<>0);
end;
function _commited:Boolean; inline;
begin
Result:=((flags and MAP_VOID)=0);
end;
function _reserv:Byte; inline;
begin
Result:=Byte((flags and MAP_VOID)<>0);
end;
function _direct:Byte; inline;
begin
Result:=Byte(((flags and MAP_SHARED)<>0) and (fd=0));
end;
function _mapped:Byte; inline;
begin
Result:=Byte(((flags and MAP_SHARED)<>0) and (fd>0));
end;
function _addres:Boolean; inline;
begin
Result:=((flags and MAP_SHARED)<>0);
end;
function _fetch:Boolean;
begin
Result:=False;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
Result:=True;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
Result:=True;
end;
end;
function _map:Boolean;
begin
Result:=False;
//new save
key.IsFree :=False;
key.F.addr :=0;
key.F.reserv:=Byte((flags and MAP_VOID)<>0);
key.F.direct:=0;
key.F.addr :=addr;
key.F.reserv:=_reserv;
key.F.direct:=_direct;
key.F.stack :=0;
key.F.polled:=0;
key.F.mapped:=_mapped;
_Merge(key);
if (FEndO>=FEndN) then Exit(True);
FSize:=FEndO-Offset;
addr :=ia(_addres,addr,FSize);
Offset:=Offset+FSize;
Size :=Size -FSize;
end;
@ -860,24 +957,29 @@ var
function _remap:Boolean;
begin
Result:=False;
err:=0;
if (key.F.direct<>0) then
begin
_UnmapDirect(key.Offset,key.Size);
err:=_UnmapDirect(key.addr,key.Size);
if (err<>0) then Exit;
end;
//new save
key.F.addr :=0;
key.F.reserv:=Byte((flags and MAP_VOID)<>0);
key.F.direct:=0;
key.IsFree :=False;
key.F.addr :=addr;
key.F.reserv:=_reserv;
key.F.direct:=_direct;
key.F.stack :=0;
key.F.polled:=0;
key.F.mapped:=_mapped;
_Merge(key);
if (FEndO>=FEndN) then Exit(True);
FSize:=FEndO-Offset;
addr :=ia(_addres,addr,FSize);
Offset:=Offset+FSize;
Size :=Size -FSize;
end;
@ -887,13 +989,21 @@ begin
if (Size=0) then Exit(EINVAL);
if (Offset<Flo) or (Offset>Fhi) then Exit(EINVAL);
if (flags and MAP_FIXED)=0 then //not fixed
if not _fixed then
begin
Result:=_FindFreeOffset(Offset,Size,Align,Offset);
if (Result<>0) then Exit;
flags:=flags or MAP_FIXED;
end;
start:=Offset;
if not _addres then addr:=0;
if (_mapped<>0) then
begin
btype:=BT_FMAP;
end else
if _isgpu(prot) then
begin
btype:=BT_GPUM;
@ -902,38 +1012,40 @@ begin
btype:=BT_PRIV;
end;
Result:=check_fixed(Offset,Size,flags);
Result:=check_fixed(Offset,Size,flags,fd);
if (Result<>0) then Exit;
AdrOut:=Offset;
repeat
key:=Default(TVirtualAdrNode);
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_LE,Offset,key) then
if _fetch then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
if key.IsFree then
begin
if (key.block=nil) then
begin
key.block:=NewAdrBlock(key.Offset,key.Size,prot,btype,-1,0);
key.block:=NewAdrBlock(key.Offset,key.Size,prot,btype,fd,addr);
if (key.block=nil) then
begin
_Merge(key); //ret
_Merge(key); //undo
Assert(False);
Exit(ENOSYS);
end;
_set_block(key.block^.Offset,key.block^.Size,key.block);
if _addres then
begin
_mmap_addr(key.block^.Offset,key.block^.Size,addr,_direct<>0);
end;
end;
if ((flags and MAP_VOID)=0) then //commited
if _commited then
begin
Result:=key.block^.Commit(@key,prot);
if (Result<>0) then
@ -947,14 +1059,15 @@ begin
end else
begin
//overwrite
if (key.F.mapped<>0) then
if (btype=BT_FMAP) or (key.F.mapped<>0) then
begin
_Merge(key); //ret
_Merge(key); //undo
Assert(False);
Exit(ENOSYS);
end;
if ((flags and MAP_VOID)=0) then //commited
if _commited then
begin
if (key.F.reserv=0) then
begin
@ -970,78 +1083,20 @@ begin
if (Result<>0) then
begin
_Merge(key); //undo
Assert(false,IntToStr(Result));
Exit(EINVAL);
end;
if _remap then Break;
//overwrite
end;
end else
if _FetchNode_m(M_BE or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
if key.IsFree then
begin
if (key.block=nil) then
if (err<>0) then
begin
key.block:=NewAdrBlock(key.Offset,key.Size,prot,btype,-1,0);
if (key.block=nil) then
begin
_Merge(key); //ret
Assert(False);
Exit(ENOSYS);
end;
_set_block(key.block^.Offset,key.block^.Size,key.block);
_Merge(key); //undo
Assert(false,IntToStr(err));
Exit(err);
end;
if ((flags and MAP_VOID)=0) then //commited
begin
Result:=key.block^.Commit(@key,prot);
if (Result<>0) then
begin
Assert(false,IntToStr(Result));
Exit(EINVAL);
end;
end;
if _map then Break;
end else
begin
//overwrite
if (key.F.mapped<>0) then
begin
_Merge(key); //ret
Assert(False);
Exit(ENOSYS);
end;
if ((flags and MAP_VOID)=0) then //commited
begin
if (key.F.reserv=0) then
begin
Result:=key.block^.Protect(@key,prot);
end else
begin
Result:=key.block^.Commit(@key,prot);
end;
end else
begin
Result:=key.block^.Reserved(@key);
end;
if (Result<>0) then
begin
Assert(false,IntToStr(Result));
Exit(EINVAL);
end;
if _remap then Break;
//overwrite
end;
@ -1051,23 +1106,20 @@ begin
end;
until false;
end;
////
////
////
////
////
////
////
if (Result=0) then
begin
AdrOut:=start;
end;
end;
/////////
Function TVirtualManager.CheckedAlloc(Offset,Size:QWORD):Integer;
Function TVirtualManager.CheckedAlloc(Offset:Pointer;Size:QWORD):Integer;
var
It:TAllcPoolNodeSet.Iterator;
key:TVirtualAdrNode;
FEndO:QWORD;
FEndO:Pointer;
begin
Result:=0;
if (Size=0) then Exit(EINVAL);
@ -1097,26 +1149,78 @@ begin
end;
end;
Function TVirtualManager.Release(Offset,Size:QWORD):Integer;
Function TVirtualManager.Release(Offset:Pointer;Size:QWORD):Integer;
var
key:TVirtualAdrNode;
FEndN,FEndO:QWORD;
FEndN,FEndO:Pointer;
FSize:QWORD;
err:Integer;
function _fetch:Boolean;
begin
Result:=False;
if _FetchNode_m(M_LE or C_FR or C_LE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
Result:=True;
end else
if _FetchNode_m(M_BE or C_FR or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
Result:=True;
end;
end;
function _map:Boolean;
var
block:PVirtualAdrBlock;
err:Integer;
begin
Result:=False;
err:=0;
if (key.F.direct<>0) then
begin
_UnmapDirect(key.Offset,key.Size);
err:=_UnmapDirect(key.addr,key.Size);
if (err<>0) then Exit;
end;
key.block^.Free(@key);
block:=key.block;
if (block^.Used=0) then
begin
if (block^.F.btype=BT_FMAP) then
begin
err:=_VirtualUnmap(Pointer(block^.Offset));
if (err<>0) then
begin
_Merge(key); //undo
Exit;
end;
end else
begin
err:=_VirtualFree(Pointer(block^.Offset));
if (err<>0) then
begin
_Merge(key); //undo
Exit;
end;
end;
_set_block(block^.Offset,block^.Size,nil);
FreeMem(block);
end;
//new save
key.IsFree :=True;
key.F.prot :=0;
@ -1127,24 +1231,6 @@ var
key.F.polled:=0;
_Merge(key);
block:=key.block;
if (block^.Used=0) then
begin
_set_block(block^.Offset,block^.Size,nil);
if (block^.F.btype=BT_FMAP) then
begin
err:=_VirtualUnmap(Pointer(block^.Offset));
Assert(err=0,IntToStr(err));
end else
begin
err:=_VirtualFree(Pointer(block^.Offset));
Assert(err=0,IntToStr(err));
end;
FreeMem(block);
end;
if (FEndO>=FEndN) then Exit(True);
FSize:=FEndO-Offset;
@ -1179,23 +1265,16 @@ begin
key.IsFree:=False;
key.Offset:=Offset;
if _FetchNode_m(M_LE or C_FR or C_LE,Offset,key) then
if _fetch then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(Offset,Size,key);
if _map then Break;
end else
if _FetchNode_m(M_BE or C_FR or C_BE,Offset,key) then
begin
FEndN:=Offset+Size;
FEndO:=key.Offset+key.Size;
_Devide(key.Offset,FEndN-key.Offset,key);
if (err<>0) then
begin
Assert(false,IntToStr(err));
Exit(EINVAL);
end;
if _map then Break;
end else
if _Find_m(M_LE,key) then
begin
@ -1230,8 +1309,8 @@ begin
begin
key:=It.Item^;
Writeln(HexStr(key.Offset,10),'..',
HexStr(key.Offset+key.Size,10),':',
Writeln(HexStr(QWORD(key.Offset),10),'..',
HexStr(QWORD(key.Offset+key.Size),10),':',
HexStr(key.Size,10),'#',
HexStr(qword(key.addr),10),'#',
_alloc_str(key.IsFree),'#');

View File

@ -257,6 +257,39 @@ begin
end;
end;
const
//eLoadOptions
LOAD_OPTIONS_DEFAULT =$0000;
LOAD_OPTIONS_LOAD_SUSPENDED =$0001;
LOAD_OPTIONS_USE_SYSTEM_LIBRARY_VERIFICATION =$0002;
LOAD_OPTIONS_SLV_MODE_WARN =$0004;
LOAD_OPTIONS_ARG_STACK_SIZE =$0008;
LOAD_OPTIONS_FULL_DEBUG_REQUIRED =$0010;
type
PSCE_APP_ENV=^TSCE_APP_ENV;
TSCE_APP_ENV=packed record
unk1:array[0..15] of Byte; //16
ustr:array[0.. 9] of char; //10
unk2:array[0..37] of Byte; //38
flags:Byte; //1 eLoadOptions
unk3:array[0.. 6] of Byte; //7
end;
//sysctl to KERN_PROC_ENV
function ps4_sceKernelGetAppInfo(pid:Integer;env:PSCE_APP_ENV):Integer; SysV_ABI_CDecl;
begin
//ignore pid
Result:=0;
if (env=nil) then
begin
_set_errno(EINVAL);
Exit(SCE_KERNEL_ERROR_EINVAL);
end;
env^:=Default(TSCE_APP_ENV);
end;
//dynlib_get_obj_member(handle,8,&ptr); module param
//dynlib_get_obj_member(handle,1,&ptr); init
//dynlib_get_obj_member(handle,2,&ptr); fini
@ -756,6 +789,7 @@ begin
lib^.set_proc($6E7671620005780D,@ps4_sceKernelGetSanitizerNewReplaceExternal);
lib^.set_proc($8E1FBC5E22B82DE1,@ps4_sceKernelIsAddressSanitizerEnabled);
lib^.set_proc($581EBA7AFBBC6EC5,@ps4_sceKernelGetCompiledSdkVersion);
lib^.set_proc($1BF318BF97AB5DA5,@ps4_sceKernelGetAppInfo);
lib^.set_proc($C33BEA4F852A297F,@ps4_sceKernelLoadStartModule);
lib^.set_proc($22EC6752E5E4E818,@ps4_sceKernelGetModuleList);
@ -1077,6 +1111,8 @@ begin
lib^.set_proc($5A4C0477737BC346,@ps4_sceKernelInstallExceptionHandler);
lib^.set_proc($8A5D379E5B8A7CC9,@ps4_sceKernelRaiseException);
//
ps4_sceKernelGetCompiledSdkVersion(@SDK_VERSION);
end;
initialization

View File

@ -1285,9 +1285,9 @@ begin
if not _test_mtype(memoryType) then Exit;
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_wrlock(PageMM.FLock); //rw
Result:=DirectManager.Alloc_search(searchStart,searchEnd,length,alignment,Byte(memoryType),physicalAddrDest^);
Result:=DirectManager.Alloc(searchStart,searchEnd,length,alignment,Byte(memoryType),physicalAddrDest^);
rwlock_unlock(PageMM.FLock);
_sig_unlock;
@ -1316,9 +1316,9 @@ begin
if not _test_mtype(memoryType) then Exit;
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_wrlock(PageMM.FLock); //rw
Result:=DirectManager.Alloc_any(length,alignment,Byte(memoryType),physicalAddrDest^);
Result:=DirectManager.Alloc(length,alignment,Byte(memoryType),physicalAddrDest^);
rwlock_unlock(PageMM.FLock);
_sig_unlock;
@ -1347,8 +1347,11 @@ begin
if not IsPowerOfTwo(alignment) then Exit;
if (fastIntLog2(alignment)>31) then Exit;
FAdrOut :=0;
FSizeOut:=0;
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_rdlock(PageMM.FLock); //r
Result:=DirectManager.CheckedAvailable(searchStart,searchEnd,alignment,FAdrOut,FSizeOut);
@ -1382,8 +1385,10 @@ begin
if not IsAlign(offset,LOGICAL_PAGE_SIZE) then Exit;
ROut:=Default(TDirectAdrNode);
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_rdlock(PageMM.FLock); //r
Result:=DirectManager.Query(offset,(flags=SCE_KERNEL_DMQ_FIND_NEXT),ROut);
@ -1415,8 +1420,10 @@ begin
start:=AlignDw(start,PHYSICAL_PAGE_SIZE);
ROut:=Default(TDirectAdrNode);
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_rdlock(PageMM.FLock); //r
Result:=DirectManager.QueryMType(start,ROut);
@ -1439,7 +1446,7 @@ begin
if not IsAlign(len ,LOGICAL_PAGE_SIZE) then Exit;
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_rdlock(PageMM.FLock); //r
Result:=DirectManager.CheckedRelease(start,len);
@ -1455,7 +1462,7 @@ begin
if not IsAlign(len ,LOGICAL_PAGE_SIZE) then Exit;
_sig_lock;
rwlock_wrlock(PageMM.FLock);
rwlock_wrlock(PageMM.FLock); //rw
Result:=DirectManager.Release(start,len);
@ -1617,29 +1624,122 @@ begin
if not IsAlign(len ,PHYSICAL_PAGE_SIZE) then Exit;
if not IsAlign(offset,PHYSICAL_PAGE_SIZE) then Exit;
if (align<PHYSICAL_PAGE_SIZE) then align:=PHYSICAL_PAGE_SIZE;
_sig_lock;
rwlock_wrlock(PageMM.FLock); //rw
if (flags and MAP_VOID)<>0 then //reserved
begin
Result:=VirtualManager.mmap(QWORD(addr),len,align,prot,flags,QWORD(res));
flags:=flags and (not MAP_SHARED);
Result:=VirtualManager.mmap(addr,len,align,prot,flags,fd,offset,res);
end else
if (flags and MAP_ANON)<>0 then //flex
begin
Result:=VirtualManager.mmap(QWORD(addr),len,align,prot,flags,QWORD(res));
Result:=VirtualManager.mmap(addr,len,align,prot,flags,fd,offset,res);
end else
if (flags and MAP_SHARED)<>0 then
begin
if (fd=-1) then Exit;
if (fd=0) then //direct (psevdo dmem fd=0)
if (fd>=0) then
begin
Assert(false);
end else
begin //map file
Assert(false);
if (fd=0) then //direct (psevdo dmem fd=0)
begin
Result:=DirectManager.CheckedMMap(offset,len);
if (Result=0) then
begin
Result:=VirtualManager.mmap(addr,len,align,prot,flags,fd,offset,res);
if (Result=0) then
begin
Result:=DirectManager.mmap_addr(offset,len,addr);
end;
end;
end else
begin //map file
Result:=VirtualManager.mmap(addr,len,align,prot,flags,fd,offset,res);
end;
end;
end;
rwlock_unlock(PageMM.FLock);
_sig_unlock;
end;
function __munmap(addr:Pointer;len:size_t):Integer;
begin
Result:=VirtualManager.Release(addr,len);
end;
function _munmap(addr:Pointer;len:size_t):Integer;
begin
_sig_lock;
rwlock_wrlock(PageMM.FLock); //rw
Result:=VirtualManager.Release(addr,len);
rwlock_unlock(PageMM.FLock);
_sig_unlock;
end;
function __release_direct(Offset,Size:QWORD):Integer;
begin
Result:=DirectManager.Release(Offset,Size);
end;
function _sceKernelMapFlexibleMemory(
virtualAddrDest:PPointer;
length:QWORD;
prot,flags:Integer;
physicalAddr:QWORD;
alignment:QWORD):Integer; SysV_ABI_CDecl;
var
addr:Pointer;
begin
Result:=SCE_KERNEL_ERROR_EINVAL;
if ((($3fff < length) and ((length and $3fff)=0)) and
(((flags and $ffbfff6f) or (prot and $ffffffc8))=0)) then
begin
addr:=virtualAddrDest^;
if (((flags and MAP_FIXED)<>0) and (addr=nil)) then
begin
if ($16fffff < SDK_VERSION) then
begin
Exit(SCE_KERNEL_ERROR_EINVAL);
end;
flags:=flags and $ffffffef;
Writeln('[WARNING] map(addr=0, flags=MAP_FIXED)');
end else
if (addr=nil) then
begin
addr:=Pointer($001000000000);
end;
Result:=__mmap(addr,length,0,prot,flags or MAP_ANON,-1,0,addr);
_set_errno(Result);
if (Result<>0) then
begin
Result:=px2sce(Result);
end else
begin
virtualAddrDest^:=addr;
Result:=0;
end;
end;
end;
////
////
function ps4_sceKernelMapDirectMemory(
virtualAddrDest:PPointer;
length:QWORD;
@ -1969,12 +2069,11 @@ begin
_sig_unlock;
end;
var
res:Pointer;
initialization
DirectManager :=TDirectManager .Create;
DirectManager .OnMemoryUnmapCb:=@__munmap;
VirtualManager:=TVirtualManager.Create($400000,$3FFFFFFFF);
VirtualManager.OnDirectUnmapCb:=@__release_direct;
PageMM.init;
end.

View File

@ -10,6 +10,9 @@ Uses
{$I sce_errno.inc}
{$I errno.inc}
var
SDK_VERSION:DWORD=0;
type
SceKernelModule=Integer;