feat(libc): implement heap trace info
This commit is contained in:
parent
c9cb3cae39
commit
ae2e5cba7e
|
|
@ -1,14 +1,9 @@
|
|||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include "SceTypes.hpp"
|
||||
#include "prx/libc/include/General.hpp"
|
||||
#include "prx/libc/include/HeapDiagnostics.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
void APS5_VABI sceLibcHeapGetTraceInfo_nid_postfix(Info* info) {
|
||||
(void)info;
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
LibcHeapTraceInfo_nid_no_patch(info);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <cstddef>
|
||||
#include "SceTypes.hpp"
|
||||
#include "prx/libc/include/General.hpp"
|
||||
#include "prx/libc/include/HeapDiagnostics.hpp"
|
||||
|
||||
uint32_t Need_sceLibc = 1;
|
||||
|
||||
|
|
@ -39,8 +40,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
void APS5_VABI LibcHeapGetTraceInfo_nid_postfix(LibcHeapInfo* info) {
|
||||
(void)info;
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
LibcHeapTraceInfo_nid_no_patch(info);
|
||||
}
|
||||
|
||||
int APS5_VABI LibcInternalExtCxaThreadAtexit_nid_postfix(void (*destructor)(void*), void* object, void* module_id) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef CORE_LIBS_PRX_LIBC_INCLUDE_HEAPDIAGNOSTICS_HPP
|
||||
#define CORE_LIBS_PRX_LIBC_INCLUDE_HEAPDIAGNOSTICS_HPP
|
||||
|
||||
#include "SceTypes.hpp"
|
||||
|
||||
extern "C" void LibcHeapTraceInfo_nid_no_patch(LibcHeapInfo* info);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,8 +1,33 @@
|
|||
#include "prx/libc/include/General.hpp"
|
||||
#include "prx/libc/include/HeapDiagnostics.hpp"
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace {
|
||||
|
||||
std::uint64_t mspaceAtomicIdMask = 0;
|
||||
std::array<std::uint64_t, 64> mstateTable{};
|
||||
|
||||
static_assert(sizeof(LibcHeapInfo) == 32);
|
||||
static_assert(offsetof(LibcHeapInfo, mspace_atomic_id_mask) == 16);
|
||||
static_assert(offsetof(LibcHeapInfo, mstate_table) == 24);
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
void LibcHeapTraceInfo_nid_no_patch(LibcHeapInfo* info) {
|
||||
if (info == nullptr)
|
||||
throw std::invalid_argument("heap trace info: null output");
|
||||
if (info->size != sizeof(LibcHeapInfo))
|
||||
throw std::invalid_argument("heap trace info: unsupported structure size");
|
||||
info->unknown2 = 0;
|
||||
info->mspace_atomic_id_mask = &mspaceAtomicIdMask;
|
||||
info->mstate_table = mstateTable.data();
|
||||
}
|
||||
|
||||
// unknown signature
|
||||
void APS5_VABI sceLibcInternalBacktraceForGame_nid_postfix(const char* heapName) {
|
||||
(void)heapName;
|
||||
|
|
|
|||
Loading…
Reference in New Issue