reorganized libc package
This commit is contained in:
parent
53a8024e43
commit
28a5277e2b
|
@ -24,12 +24,12 @@ add_subdirectory("third-party")
|
||||||
#=================== EXAMPLE ===================
|
#=================== EXAMPLE ===================
|
||||||
include_directories(src)
|
include_directories(src)
|
||||||
|
|
||||||
set(LIBC_SOURCES src/Emulator/HLE/Libraries/LibC/Libc.cpp
|
set(LIBC_SOURCES src/core/hle/libraries/Libc/Libc.cpp
|
||||||
src/Emulator/HLE/Libraries/LibC/Libc.h
|
src/core/hle/libraries/Libc/Libc.h
|
||||||
src/Emulator/HLE/Libraries/LibC/printf.h
|
src/core/hle/libraries/Libc/printf.h
|
||||||
src/Emulator/HLE/Libraries/LibC/va_ctx.h
|
src/core/hle/libraries/Libc/va_ctx.h
|
||||||
src/Emulator/HLE/Libraries/LibC/libc_cxa.cpp
|
src/core/hle/libraries/Libc/libc_cxa.cpp
|
||||||
src/Emulator/HLE/Libraries/LibC/libc_cxa.h
|
src/core/hle/libraries/Libc/libc_cxa.h
|
||||||
)
|
)
|
||||||
set(USERSERVICE_SOURCES src/core/hle/libraries/libuserservice/user_service.cpp
|
set(USERSERVICE_SOURCES src/core/hle/libraries/libuserservice/user_service.cpp
|
||||||
src/core/hle/libraries/libuserservice/user_service.h
|
src/core/hle/libraries/libuserservice/user_service.h
|
||||||
|
@ -97,8 +97,10 @@ add_executable(shadps4
|
||||||
src/core/PS4/HLE/Kernel/event_queues.h
|
src/core/PS4/HLE/Kernel/event_queues.h
|
||||||
src/core/PS4/HLE/Kernel/cpu_management.cpp
|
src/core/PS4/HLE/Kernel/cpu_management.cpp
|
||||||
src/core/PS4/HLE/Kernel/cpu_management.h
|
src/core/PS4/HLE/Kernel/cpu_management.h
|
||||||
|
src/core/PS4/HLE/LibC.cpp
|
||||||
|
src/core/PS4/HLE/LibC.h
|
||||||
|
|
||||||
"src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/core/PS4/Util/aerolib.h" "src/core/PS4/Loader/SymbolsResolver.h" "src/core/PS4/Loader/SymbolsResolver.cpp" "src/core/PS4/HLE/Libs.cpp" "src/core/PS4/HLE/Libs.h" "src/core/PS4/HLE/LibC.cpp" "src/core/PS4/HLE/LibC.h" "src/core/PS4/HLE/LibKernel.cpp" "src/core/PS4/HLE/LibKernel.h" "src/core/PS4/HLE/LibSceGnmDriver.cpp" "src/core/PS4/HLE/LibSceGnmDriver.h" "src/core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/core/PS4/HLE/Kernel/ThreadManagement.h" "src/core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/core/PS4/HLE/Kernel/memory_management.cpp" "src/core/PS4/HLE/Kernel/memory_management.h" "src/core/PS4/GPU/gpu_memory.cpp" "src/core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/core/PS4/GPU/video_out_buffer.cpp" "src/core/PS4/GPU/video_out_buffer.h" "src/core/PS4/HLE/Graphics/graphics_render.cpp" "src/core/PS4/HLE/Graphics/graphics_render.h" "src/core/PS4/GPU/tile_manager.cpp" "src/core/PS4/GPU/tile_manager.h" "src/version.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/core/hle/libraries/libkernel/time_management.cpp" "src/core/hle/libraries/libkernel/time_management.h")
|
"src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/core/PS4/Util/aerolib.h" "src/core/PS4/Loader/SymbolsResolver.h" "src/core/PS4/Loader/SymbolsResolver.cpp" "src/core/PS4/HLE/Libs.cpp" "src/core/PS4/HLE/Libs.h" "src/core/PS4/HLE/LibKernel.cpp" "src/core/PS4/HLE/LibKernel.h" "src/core/PS4/HLE/LibSceGnmDriver.cpp" "src/core/PS4/HLE/LibSceGnmDriver.h" "src/core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/core/PS4/HLE/Kernel/ThreadManagement.h" "src/core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/core/PS4/HLE/Kernel/memory_management.cpp" "src/core/PS4/HLE/Kernel/memory_management.h" "src/core/PS4/GPU/gpu_memory.cpp" "src/core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.h" "src/core/PS4/HLE/Kernel/Objects/event_queue.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.cpp" "src/core/PS4/HLE/Graphics/Objects/video_out_ctx.h" "src/core/PS4/HLE/Graphics/graphics_ctx.h" "src/vulkan_util.cpp" "src/vulkan_util.h" "src/core/PS4/GPU/video_out_buffer.cpp" "src/core/PS4/GPU/video_out_buffer.h" "src/core/PS4/HLE/Graphics/graphics_render.cpp" "src/core/PS4/HLE/Graphics/graphics_render.h" "src/core/PS4/GPU/tile_manager.cpp" "src/core/PS4/GPU/tile_manager.h" "src/version.h" "src/emuTimer.cpp" "src/emuTimer.h" "src/core/hle/libraries/libkernel/time_management.cpp" "src/core/hle/libraries/libkernel/time_management.h")
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools)
|
target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY} vulkan-1 spirv-tools-opt spirv-tools)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "../Loader/Elf.h"
|
#include "../Loader/Elf.h"
|
||||||
#include "Emulator/HLE/Libraries/LibC/libc.h"
|
#include "core/hle/libraries/libc/libc.h"
|
||||||
#include "Emulator/HLE/Libraries/LibC/libc_cxa.h"
|
#include "core/hle/libraries/libc/libc_cxa.h"
|
||||||
#include "ErrorCodes.h"
|
#include "ErrorCodes.h"
|
||||||
#include "Libs.h"
|
#include "Libs.h"
|
||||||
|
|
||||||
|
@ -56,36 +56,36 @@ void PS4_SYSV_ABI qsort(void* ptr, size_t count,size_t size, int(PS4_SYSV_ABI* c
|
||||||
|
|
||||||
void LibC_Register(SymbolsResolver* sym) {
|
void LibC_Register(SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env);
|
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env);
|
||||||
LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::Cxa::__cxa_guard_acquire);
|
LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::Cxa::__cxa_guard_acquire);
|
||||||
LIB_FUNCTION("9rAeANT2tyE", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::Cxa::__cxa_guard_release);
|
LIB_FUNCTION("9rAeANT2tyE", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::Cxa::__cxa_guard_release);
|
||||||
LIB_FUNCTION("2emaaluWzUw", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::Cxa::__cxa_guard_abort);
|
LIB_FUNCTION("2emaaluWzUw", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::Cxa::__cxa_guard_abort);
|
||||||
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memcmp);
|
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::memcmp);
|
||||||
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memcpy);
|
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::memcpy);
|
||||||
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memset);
|
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::memset);
|
||||||
LIB_FUNCTION("XKRegsFpEpk", "libc", 1, "libc", 1, 1, catchReturnFromMain);
|
LIB_FUNCTION("XKRegsFpEpk", "libc", 1, "libc", 1, 1, catchReturnFromMain);
|
||||||
LIB_FUNCTION("uMei1W9uyNo", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::exit);
|
LIB_FUNCTION("uMei1W9uyNo", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::exit);
|
||||||
LIB_FUNCTION("8G2LB+A3rzg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::atexit);
|
LIB_FUNCTION("8G2LB+A3rzg", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::atexit);
|
||||||
LIB_FUNCTION("-QgqOT5u2Vk", "libc", 1, "libc", 1, 1, _Assert);
|
LIB_FUNCTION("-QgqOT5u2Vk", "libc", 1, "libc", 1, 1, _Assert);
|
||||||
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::printf);
|
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::printf);
|
||||||
LIB_FUNCTION("Q2V+iqvjgC0", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::vsnprintf);
|
LIB_FUNCTION("Q2V+iqvjgC0", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::vsnprintf);
|
||||||
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts);
|
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts);
|
||||||
LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, rand);
|
LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, rand);
|
||||||
LIB_FUNCTION("ZtjspkJQ+vw", "libc", 1, "libc", 1, 1, _Fsin);
|
LIB_FUNCTION("ZtjspkJQ+vw", "libc", 1, "libc", 1, 1, _Fsin);
|
||||||
LIB_FUNCTION("AEJdIVZTEmo", "libc", 1, "libc", 1, 1, qsort);
|
LIB_FUNCTION("AEJdIVZTEmo", "libc", 1, "libc", 1, 1, qsort);
|
||||||
LIB_FUNCTION("Ovb2dSJOAuE", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::strcmp);
|
LIB_FUNCTION("Ovb2dSJOAuE", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::strcmp);
|
||||||
LIB_FUNCTION("gQX+4GDQjpM", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::malloc);
|
LIB_FUNCTION("gQX+4GDQjpM", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::malloc);
|
||||||
LIB_FUNCTION("tIhsqj0qsFE", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::free);
|
LIB_FUNCTION("tIhsqj0qsFE", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::free);
|
||||||
LIB_FUNCTION("j4ViWNHEgww", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::strlen);
|
LIB_FUNCTION("j4ViWNHEgww", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::strlen);
|
||||||
LIB_FUNCTION("6sJWiWSRuqk", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::strncpy);
|
LIB_FUNCTION("6sJWiWSRuqk", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::strncpy);
|
||||||
LIB_FUNCTION("+P6FRGH4LfA", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::memmove);
|
LIB_FUNCTION("+P6FRGH4LfA", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::memmove);
|
||||||
LIB_FUNCTION("kiZSXIWd9vg", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::strcpy);
|
LIB_FUNCTION("kiZSXIWd9vg", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::strcpy);
|
||||||
LIB_FUNCTION("Ls4tzzhimqQ", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::strcat);
|
LIB_FUNCTION("Ls4tzzhimqQ", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::strcat);
|
||||||
LIB_FUNCTION("EH-x713A99c", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::atan2f);
|
LIB_FUNCTION("EH-x713A99c", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::atan2f);
|
||||||
LIB_FUNCTION("QI-x0SL8jhw", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::acosf);
|
LIB_FUNCTION("QI-x0SL8jhw", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::acosf);
|
||||||
LIB_FUNCTION("ZE6RNL+eLbk", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::tanf);
|
LIB_FUNCTION("ZE6RNL+eLbk", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::tanf);
|
||||||
LIB_FUNCTION("GZWjF-YIFFk", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::asinf);
|
LIB_FUNCTION("GZWjF-YIFFk", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::asinf);
|
||||||
LIB_FUNCTION("9LCjpWyQ5Zc", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::pow);
|
LIB_FUNCTION("9LCjpWyQ5Zc", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::pow);
|
||||||
LIB_FUNCTION("cCXjU72Z0Ow", "libc", 1, "libc", 1, 1, Emulator::HLE::Libraries::LibC::_Sin);
|
LIB_FUNCTION("cCXjU72Z0Ow", "libc", 1, "libc", 1, 1,Core::Libraries::LibC::_Sin);
|
||||||
|
|
||||||
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &HLE::Libs::LibC::g_need_sceLibc);
|
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &HLE::Libs::LibC::g_need_sceLibc);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace Emulator::HLE::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
PS4_SYSV_ABI int printf(VA_ARGS) {
|
PS4_SYSV_ABI int printf(VA_ARGS) {
|
||||||
VA_CTX(ctx);
|
VA_CTX(ctx);
|
||||||
|
@ -60,4 +60,4 @@ double PS4_SYSV_ABI pow(double base, double exponent) { return std::pow(base, ex
|
||||||
|
|
||||||
double PS4_SYSV_ABI _Sin(double x) { return std::sin(x); }
|
double PS4_SYSV_ABI _Sin(double x) { return std::sin(x); }
|
||||||
|
|
||||||
}; // namespace Emulator::HLE::Libraries::LibC
|
}; // namespace Core::Libraries::LibC
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
|
||||||
namespace Emulator::HLE::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
// HLE functions
|
// HLE functions
|
||||||
PS4_SYSV_ABI int printf(VA_ARGS);
|
PS4_SYSV_ABI int printf(VA_ARGS);
|
||||||
|
@ -29,4 +29,4 @@ float PS4_SYSV_ABI asinf(float num);
|
||||||
double PS4_SYSV_ABI pow(double base, double exponent);
|
double PS4_SYSV_ABI pow(double base, double exponent);
|
||||||
double PS4_SYSV_ABI _Sin(double x);
|
double PS4_SYSV_ABI _Sin(double x);
|
||||||
|
|
||||||
} // namespace Emulator::HLE::Libraries::LibC
|
} // namespace Core::Libraries::LibC
|
|
@ -1,10 +1,11 @@
|
||||||
#include "libc_cxa.h"
|
#include "libc_cxa.h"
|
||||||
#include "debug.h"
|
|
||||||
#include "Util/log.h"
|
#include "Util/log.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
// adapted from https://opensource.apple.com/source/libcppabi/libcppabi-14/src/cxa_guard.cxx.auto.html
|
// adapted from https://opensource.apple.com/source/libcppabi/libcppabi-14/src/cxa_guard.cxx.auto.html
|
||||||
|
|
||||||
namespace Emulator::HLE::Libraries::LibC::Cxa {
|
namespace Core::Libraries::LibC::Cxa {
|
||||||
constexpr bool log_file_cxa = true; // disable it to disable logging
|
constexpr bool log_file_cxa = true; // disable it to disable logging
|
||||||
|
|
||||||
// This file implements the __cxa_guard_* functions as defined at:
|
// This file implements the __cxa_guard_* functions as defined at:
|
||||||
|
@ -87,7 +88,7 @@ int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object) {
|
||||||
|
|
||||||
int result = ::pthread_mutex_lock(guard_mutex());
|
int result = ::pthread_mutex_lock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): pthread_mutex_lock failed with {}\n",result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): pthread_mutex_lock failed with {}\n", result);
|
||||||
}
|
}
|
||||||
// At this point all other threads will block in __cxa_guard_acquire()
|
// At this point all other threads will block in __cxa_guard_acquire()
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object) {
|
||||||
if (initializerHasRun(guard_object)) {
|
if (initializerHasRun(guard_object)) {
|
||||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE_IF(log_file_cxa,"__cxa_guard_acquire(): pthread_mutex_unlock failed with {}\n",result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): pthread_mutex_unlock failed with {}\n", result);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object) {
|
||||||
// But if the same thread can call __cxa_guard_acquire() on the
|
// But if the same thread can call __cxa_guard_acquire() on the
|
||||||
// *same* guard object again, we call abort();
|
// *same* guard object again, we call abort();
|
||||||
if (inUse(guard_object)) {
|
if (inUse(guard_object)) {
|
||||||
LOG_TRACE_IF(log_file_cxa,"__cxa_guard_acquire(): initializer for function local static variable called enclosing function\n");
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): initializer for function local static variable called enclosing function\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark this guard object as being in use
|
// mark this guard object as being in use
|
||||||
|
@ -127,7 +128,7 @@ void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object) {
|
||||||
// release global mutex
|
// release global mutex
|
||||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE_IF(log_file_cxa,"__cxa_guard_acquire(): pthread_mutex_unlock failed with {}\n",result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_acquire(): pthread_mutex_unlock failed with {}\n", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,11 +138,11 @@ void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object) {
|
||||||
void PS4_SYSV_ABI __cxa_guard_abort(u64* guard_object) {
|
void PS4_SYSV_ABI __cxa_guard_abort(u64* guard_object) {
|
||||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
LOG_TRACE_IF(log_file_cxa,"__cxa_guard_abort(): pthread_mutex_unlock failed with {}\n",result);
|
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_abort(): pthread_mutex_unlock failed with {}\n", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now reset state, so possible to try to initialize again
|
// now reset state, so possible to try to initialize again
|
||||||
setNotInUse(guard_object);
|
setNotInUse(guard_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Emulator::HLE::Libraries::LibC::Cxa
|
} // namespace Core::Libraries::LibC::Cxa
|
|
@ -4,8 +4,8 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
namespace Emulator::HLE::Libraries::LibC::Cxa {
|
namespace Core::Libraries::LibC::Cxa {
|
||||||
int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object);
|
int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object);
|
||||||
void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object);
|
void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object);
|
||||||
void PS4_SYSV_ABI __cxa_guard_abort(u64* guard_object);
|
void PS4_SYSV_ABI __cxa_guard_abort(u64* guard_object);
|
||||||
} // namespace Emulator::HLE::Libraries::LibC::Cxa
|
} // namespace Core::Libraries::LibC::Cxa
|
|
@ -57,9 +57,10 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "va_ctx.h"
|
#include "va_ctx.h"
|
||||||
|
|
||||||
namespace Emulator::HLE::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
// ntoa conversion buffer size, this must be big enough to hold
|
// ntoa conversion buffer size, this must be big enough to hold
|
||||||
// one converted numeric number including padded zeros (dynamically created on stack)
|
// one converted numeric number including padded zeros (dynamically created on stack)
|
||||||
// 32 byte is a good default
|
// 32 byte is a good default
|
||||||
|
@ -693,10 +694,10 @@ static int printf_ctx(VaCtx* ctx) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vsnprintf_ctx(char* s, size_t n, const char* format, VaList* arg) {
|
static int vsnprintf_ctx(char* s, size_t n, const char* format, VaList* arg) {
|
||||||
char buffer[n];
|
char buffer[n];
|
||||||
int result = _vsnprintf(_out_buffer, buffer, format, arg);
|
int result = _vsnprintf(_out_buffer, buffer, format, arg);
|
||||||
std::strcpy(s, buffer);
|
std::strcpy(s, buffer);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} // namespace Emulator::HLE::Libraries::LibC
|
} // namespace Core::Libraries::LibC
|
|
@ -26,7 +26,7 @@
|
||||||
(ctx).va_list.fp_offset = offsetof(VaRegSave, fp); \
|
(ctx).va_list.fp_offset = offsetof(VaRegSave, fp); \
|
||||||
(ctx).va_list.overflow_arg_area = &overflow_arg_area;
|
(ctx).va_list.overflow_arg_area = &overflow_arg_area;
|
||||||
|
|
||||||
namespace Emulator::HLE::Libraries::LibC {
|
namespace Core::Libraries::LibC {
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/4958384/what-is-the-format-of-the-x86-64-va-list-structure
|
// https://stackoverflow.com/questions/4958384/what-is-the-format-of-the-x86-64-va-list-structure
|
||||||
|
|
||||||
|
@ -103,4 +103,4 @@ T* vaArgPtr(VaList* l) {
|
||||||
return vaArgOverflowArgArea<T*, 1, 8>(l);
|
return vaArgOverflowArgArea<T*, 1, 8>(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Emulator::HLE::Libraries::LibC
|
} // namespace Core::Libraries::LibC
|
Loading…
Reference in New Issue