mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(libc): export std::_Fiopen as unimplemented
PPSA21564 and PPSA21567 import std::_Fiopen (NID vYWK2Pz8vGE), the only libc NID the host libc lacks. Without it the executable fails to load against the host libc when the title's own libc.prx is left out of the guest conversion, which is how the Linux runs of PPSA21564 avoid the libc.prx binding crash. The values of the open mode and the meaning of the protection argument are unknown, so the export throws when called; it was never called in a 300 s run of PPSA21567. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014A3UgWDUxE1EeHyVZm6tiN
This commit is contained in:
@@ -87,6 +87,16 @@ if(BUILD_TESTING)
|
||||
set_tests_properties(guest_execute_once PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
|
||||
endif()
|
||||
add_test_executable(guest_fiopen_tests ${LIBS_INCLUDE_DIR}/tests/GuestFiopen.cpp)
|
||||
target_include_directories(guest_fiopen_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_fiopen_tests PRIVATE libc)
|
||||
configure_windows_unwind(guest_fiopen_tests)
|
||||
add_test(NAME guest_fiopen COMMAND guest_fiopen_tests)
|
||||
set_tests_properties(guest_fiopen PROPERTIES TIMEOUT 20)
|
||||
if(WIN32)
|
||||
set_tests_properties(guest_fiopen PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
|
||||
endif()
|
||||
add_test_executable(guest_working_directory_tests ${LIBS_INCLUDE_DIR}/tests/GuestWorkingDirectory.cpp)
|
||||
target_include_directories(guest_working_directory_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_working_directory_tests PRIVATE libc)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <cxxabi.h>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
@@ -41,6 +42,14 @@ int APS5_VABI LibcInternalExtCxaThreadAtexit_nid_postfix(void (*destructor)(void
|
||||
|
||||
const std::error_category* _ZSt17iostream_categoryv_nid_postfix() { return &std::iostream_category(); }
|
||||
|
||||
std::FILE* APS5_VABI _ZSt7_FiopenPKcNSt5_IosbIiE9_OpenmodeEi_nid_postfix(const char* filename, int mode, int protection) {
|
||||
static_cast<void>(filename);
|
||||
static_cast<void>(mode);
|
||||
static_cast<void>(protection);
|
||||
NotImplemented_nid_no_patch("std::_Fiopen");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int APS5_VABI _ZSt13_Execute_onceRSt9once_flagPFiPvS1_PS1_ES1__nid_postfix(
|
||||
int* flag, int (APS5_VABI *callback)(void*, void*, void**), void* arg
|
||||
) {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "prx/libc/include/general/VabiMacros.hpp"
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
#include <string_view>
|
||||
|
||||
extern "C" std::FILE* APS5_VABI _ZSt7_FiopenPKcNSt5_IosbIiE9_OpenmodeEi_nid_postfix(const char*, int, int);
|
||||
|
||||
int main() {
|
||||
try {
|
||||
_ZSt7_FiopenPKcNSt5_IosbIiE9_OpenmodeEi_nid_postfix("unused", 1, 0);
|
||||
} catch (const std::runtime_error& error) {
|
||||
return std::string_view(error.what()) == "std::_Fiopen not implemented" ? 0 : 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -69,6 +69,7 @@ Throughout the project, every function at every stage either **does exactly what
|
||||
- [Guest arena](../../core/libs/prx/libc/src/GuestArena.cpp) (libc) - the application map area is assumed to end at 0xFC_0000_0000, as `SCE_KERNEL_APP_MAP_AREA_END_ADDR` does on the PS4. On Windows, host allocations made in the arena before libc loads stay, and a fixed guest mapping over one throws
|
||||
- [sceLibcInternalBacktraceForGame](../../core/libs/prx/libc/src/HeapDiagnostics.cpp) (libSceLibcInternal, implemented in libc) - unknown signature
|
||||
- [sceLibcInternalHeapErrorReportForGame](../../core/libs/prx/libc/src/HeapDiagnostics.cpp) (libSceLibcInternal, implemented in libc) - unknown signature
|
||||
- [std::_Fiopen](../../core/libs/prx/libc/src/CxxAbiSupport.cpp) (libc) - `_ZSt7_FiopenPKcNSt5_IosbIiE9_OpenmodeEi` (NID `vYWK2Pz8vGE`; the name comes from the public NID list): the values of the `_Openmode` argument and the meaning of the protection argument are unknown, so it throws when called. It is exported so that a title that imports it (PPSA21564 and PPSA21567 do) loads against the host libc when its own `libc.prx` is left out of the guest conversion.
|
||||
- [_sceLibcInternalThreadAtexit, _sceLibcInternalThreadDtors](../../core/libs/prx/libSceLibcInternal/Export.cpp) (libSceLibcInternal) - FreeBSD `__cxa_thread_atexit` semantics assumed; a null or non-image destructor and an allocation failure throw
|
||||
- [_sceLibcInternalForceTlsDestructor](../../core/libs/prx/libSceLibcInternal/Export.cpp) (libSceLibcInternal) - unknown return type and behaviour; a title's `libc.prx` calls it from `__cxa_finalize` with the module handle of a non-null dso
|
||||
- [__progname](../../core/libs/prx/libkernel/System/src/Process.cpp) (libkernel) - unknown data export
|
||||
|
||||
Reference in New Issue
Block a user