memory management refactoring
This commit is contained in:
parent
3e60a67785
commit
b7420e7daa
|
@ -1,10 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <types.h>
|
||||
|
||||
namespace HLE::Libs::LibKernel::MemoryManagement {
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize();
|
||||
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len, u64 alignment, int memoryType, s64* physAddrOut);
|
||||
|
||||
}; // namespace HLE::Libs::LibKernel::MemoryManagement
|
|
@ -1,14 +1,14 @@
|
|||
#include <debug.h>
|
||||
#include "ThreadManagement.h"
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include "../ErrorCodes.h"
|
||||
|
||||
namespace HLE::Libs::LibKernel::ThreadManagement
|
||||
{
|
||||
namespace HLE::Libs::LibKernel::ThreadManagement {
|
||||
|
||||
thread_local PthreadInternal* g_pthread_self = nullptr;
|
||||
PThreadCxt* g_pthread_cxt = nullptr;
|
||||
|
||||
|
||||
void Pthread_Init_Self_MainThread() {
|
||||
g_pthread_self = new PthreadInternal{};
|
||||
scePthreadAttrInit(&g_pthread_self->attr);
|
||||
|
@ -17,7 +17,6 @@ void Pthread_Init_Self_MainThread() {
|
|||
}
|
||||
|
||||
int scePthreadAttrInit(ScePthreadAttr* attr) {
|
||||
|
||||
*attr = new PthreadAttrInternal{};
|
||||
|
||||
int result = pthread_attr_init(&(*attr)->pth_attr);
|
||||
|
@ -41,7 +40,6 @@ int scePthreadAttrInit(ScePthreadAttr* attr) {
|
|||
}
|
||||
|
||||
int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
||||
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
@ -50,8 +48,7 @@ int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
|||
switch (detachstate) {
|
||||
case 0: pstate = PTHREAD_CREATE_JOINABLE; break;
|
||||
case 1: pstate = PTHREAD_CREATE_DETACHED; break;
|
||||
default:
|
||||
BREAKPOINT(); // unknown state
|
||||
default: BREAKPOINT(); // unknown state
|
||||
}
|
||||
|
||||
int result = pthread_attr_setdetachstate(&(*attr)->pth_attr, pstate);
|
||||
|
@ -65,7 +62,6 @@ int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
|||
}
|
||||
|
||||
int scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inheritSched) {
|
||||
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
@ -86,7 +82,6 @@ int scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inheritSched) {
|
|||
}
|
||||
|
||||
int scePthreadAttrSetschedparam(ScePthreadAttr* attr, const SceKernelSchedParam* param) {
|
||||
|
||||
if (param == nullptr || attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
@ -109,13 +104,11 @@ int scePthreadAttrSetschedparam(ScePthreadAttr* attr, const SceKernelSchedParam*
|
|||
}
|
||||
|
||||
int scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) {
|
||||
|
||||
if (attr == nullptr || *attr == nullptr) {
|
||||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
if (policy!= SCHED_OTHER)
|
||||
{
|
||||
if (policy != SCHED_OTHER) {
|
||||
BREAKPOINT(); // invest if policy is other and if winpthreadlibrary support it
|
||||
}
|
||||
|
||||
|
@ -129,4 +122,4 @@ int scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) {
|
|||
return SCE_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
};
|
||||
}; // namespace HLE::Libs::LibKernel::ThreadManagement
|
|
@ -1,16 +1,13 @@
|
|||
#include "MemoryManagement.h"
|
||||
|
||||
#include <debug.h>
|
||||
#include <bit>
|
||||
#include <magic_enum.hpp>
|
||||
#include <debug.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include "../../../../Util/Log.h"
|
||||
#include "../../../../Util/Singleton.h"
|
||||
#include "../ErrorCodes.h"
|
||||
#include "../Libs.h"
|
||||
#include "MemMngCodes.h"
|
||||
#include "Objects/physical_memory.h"
|
||||
#include "memory_management.h"
|
||||
|
||||
namespace HLE::Libs::LibKernel::MemoryManagement {
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <types.h>
|
||||
|
||||
// constants
|
||||
|
@ -11,4 +12,11 @@ enum MemoryTypes : u32 {
|
|||
SCE_KERNEL_WB_ONION = 0, // write - back mode (Onion bus)
|
||||
SCE_KERNEL_WC_GARLIC = 3, // write - combining mode (Garlic bus)
|
||||
SCE_KERNEL_WB_GARLIC = 10 // write - back mode (Garlic bus)
|
||||
};
|
||||
};
|
||||
|
||||
namespace HLE::Libs::LibKernel::MemoryManagement {
|
||||
|
||||
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize();
|
||||
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len, u64 alignment, int memoryType, s64* physAddrOut);
|
||||
|
||||
}; // namespace HLE::Libs::LibKernel::MemoryManagement
|
|
@ -3,7 +3,7 @@
|
|||
#include "Libs.h"
|
||||
#include <debug.h>
|
||||
#include "../../../Util/Log.h"
|
||||
#include "Kernel/MemoryManagement.h"
|
||||
#include "Kernel/memory_management.h"
|
||||
#include "../../../Util/Singleton.h"
|
||||
#include "Kernel/Objects/physical_memory.h"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace HLE::Libs::LibSceGnmDriver {
|
|||
|
||||
void LibSceGnmDriver_Register(SymbolsResolver* sym);
|
||||
|
||||
//functions
|
||||
// functions
|
||||
int sceGnmAddEqEvent(/* SceKernelEqueue eq, EqEventType id,*/ void* udata);
|
||||
bool sceGnmAreSubmitsAllowed();
|
||||
int /* WorkloadStatus*/ sceGnmBeginWorkload(uint64_t* workload /*, WorkloadStream stream*/);
|
||||
|
@ -14,7 +14,7 @@ void sceGnmDebugHardwareStatus(/* HardwareStatus flag*/);
|
|||
void sceGnmSetGsRingSizes(/* GsRingSizeSetup esgsRingSize, GsRingSizeSetup gsvsRingSize*/);
|
||||
int32_t sceGnmSetWaveLimitMultipliers(uint16_t targetPipeMask, uint8_t gfxRatio, const uint8_t (*pipeRatios)[7]);
|
||||
int /*MipStatsError*/ sceGnmSetupMipStatsReport(void* outputBuffer, uint32_t sizeInBytes, uint8_t intervalsBetweenReports,
|
||||
uint8_t numReportsBeforeReset /*, MipStatsResetForce mipStatsResetForce*/);
|
||||
uint8_t numReportsBeforeReset /*, MipStatsResetForce mipStatsResetForce*/);
|
||||
int sceGnmSubmitCommandBuffers(uint32_t count, void* dcb_gpu_addrs[], const uint32_t* dcb_sizes_in_bytes, void* ccb_gpu_addrs[],
|
||||
const uint32_t* ccb_sizes_in_bytes);
|
||||
int sceGnmSubmitAndFlipCommandBuffers(uint32_t count, void* dcb_gpu_addrs[], const uint32_t* dcb_sizes_in_bytes, void* ccb_gpu_addrs[],
|
||||
|
|
|
@ -1,84 +1,77 @@
|
|||
#include "LibSceVideoOut.h"
|
||||
#include "Libs.h"
|
||||
#include "../Loader/Elf.h"
|
||||
|
||||
#include <debug.h>
|
||||
#include "VideoOut/VideoOutCodes.h"
|
||||
#include "UserManagement/UsrMngCodes.h"
|
||||
|
||||
#include "../../../Util/Log.h"
|
||||
#include "../Loader/Elf.h"
|
||||
#include "Libs.h"
|
||||
#include "UserManagement/UsrMngCodes.h"
|
||||
#include "VideoOut/VideoOutCodes.h"
|
||||
|
||||
namespace HLE::Libs::LibSceVideoOut {
|
||||
|
||||
int32_t PS4_SYSV_ABI sceVideoOutGetFlipStatus(int32_t handle /*, SceVideoOutFlipStatus* status*/) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutGetFlipStatus(int32_t handle /*, SceVideoOutFlipStatus* status*/) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t PS4_SYSV_ABI sceVideoOutSubmitFlip(int32_t handle, int32_t bufferIndex, int32_t flipMode, int64_t flipArg) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutRegisterBuffers(int32_t handle, int32_t startIndex, void* const* addresses, int32_t bufferNum /*,
|
||||
int32_t PS4_SYSV_ABI sceVideoOutSubmitFlip(int32_t handle, int32_t bufferIndex, int32_t flipMode, int64_t flipArg) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutRegisterBuffers(int32_t handle, int32_t startIndex, void* const* addresses, int32_t bufferNum /*,
|
||||
const SceVideoOutBufferAttribute* attribute*/) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutAddFlipEvent(/*SceKernelEqueue eq,*/ int32_t handle, void* udata) {
|
||||
//BREAKPOINT();
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutSetFlipRate(int32_t handle, int32_t rate) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(/* SceVideoOutBufferAttribute* attribute,*/ uint32_t pixelFormat, uint32_t tilingMode,
|
||||
uint32_t aspectRatio,
|
||||
uint32_t width, uint32_t height, uint32_t pitchInPixel)
|
||||
{
|
||||
BREAKPOINT();
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutAddFlipEvent(/*SceKernelEqueue eq,*/ int32_t handle, void* udata) {
|
||||
// BREAKPOINT();
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
return 0;
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutSetFlipRate(int32_t handle, int32_t rate) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(/* SceVideoOutBufferAttribute* attribute,*/ uint32_t pixelFormat, uint32_t tilingMode,
|
||||
uint32_t aspectRatio, uint32_t width, uint32_t height, uint32_t pitchInPixel) {
|
||||
BREAKPOINT();
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index, const void* param)
|
||||
{
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
if (userId != SCE_USER_SERVICE_USER_ID_SYSTEM)
|
||||
{
|
||||
BREAKPOINT();
|
||||
}
|
||||
if (busType != SCE_VIDEO_OUT_BUS_TYPE_MAIN)
|
||||
{
|
||||
BREAKPOINT();
|
||||
}
|
||||
if (index != 0)
|
||||
{
|
||||
BREAKPOINT();
|
||||
}
|
||||
if (param != nullptr)
|
||||
{
|
||||
BREAKPOINT();
|
||||
}
|
||||
return 1;//dummy return TODO
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutIsFlipPending(int32_t handle) {
|
||||
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index, const void* param) {
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
if (userId != SCE_USER_SERVICE_USER_ID_SYSTEM) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
void LibSceVideoOut_Register(SymbolsResolver* sym)
|
||||
{
|
||||
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus);
|
||||
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
|
||||
LIB_FUNCTION("w3BY+tAEiQY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutRegisterBuffers);
|
||||
LIB_FUNCTION("HXzjK9yI30k", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutAddFlipEvent);
|
||||
LIB_FUNCTION("CBiu4mCE1DA", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSetFlipRate);
|
||||
LIB_FUNCTION("i6-sR91Wt-4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSetBufferAttribute);
|
||||
LIB_FUNCTION("6kPnj51T62Y", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetResolutionStatus);
|
||||
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutOpen);
|
||||
LIB_FUNCTION("zgXifHT9ErY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutIsFlipPending);
|
||||
}
|
||||
}
|
||||
if (busType != SCE_VIDEO_OUT_BUS_TYPE_MAIN) {
|
||||
BREAKPOINT();
|
||||
}
|
||||
if (index != 0) {
|
||||
BREAKPOINT();
|
||||
}
|
||||
if (param != nullptr) {
|
||||
BREAKPOINT();
|
||||
}
|
||||
return 1; // dummy return TODO
|
||||
}
|
||||
int32_t PS4_SYSV_ABI sceVideoOutIsFlipPending(int32_t handle) {
|
||||
BREAKPOINT();
|
||||
return 0;
|
||||
}
|
||||
void LibSceVideoOut_Register(SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus);
|
||||
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
|
||||
LIB_FUNCTION("w3BY+tAEiQY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutRegisterBuffers);
|
||||
LIB_FUNCTION("HXzjK9yI30k", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutAddFlipEvent);
|
||||
LIB_FUNCTION("CBiu4mCE1DA", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSetFlipRate);
|
||||
LIB_FUNCTION("i6-sR91Wt-4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSetBufferAttribute);
|
||||
LIB_FUNCTION("6kPnj51T62Y", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetResolutionStatus);
|
||||
LIB_FUNCTION("Up36PTk687E", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutOpen);
|
||||
LIB_FUNCTION("zgXifHT9ErY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutIsFlipPending);
|
||||
}
|
||||
|
||||
};
|
||||
}; // namespace HLE::Libs::LibSceVideoOut
|
|
@ -1,16 +1,16 @@
|
|||
#include "Libs.h"
|
||||
|
||||
#include "LibC.h"
|
||||
#include "LibKernel.h"
|
||||
#include "LibSceVideoOut.h"
|
||||
#include "LibSceGnmDriver.h"
|
||||
#include "LibSceVideoOut.h"
|
||||
|
||||
namespace HLE::Libs {
|
||||
|
||||
void Init_HLE_Libs(SymbolsResolver *sym)
|
||||
{
|
||||
LibC::LibC_Register(sym);
|
||||
LibKernel::LibKernel_Register(sym);
|
||||
LibSceVideoOut::LibSceVideoOut_Register(sym);
|
||||
LibSceGnmDriver::LibSceGnmDriver_Register(sym);
|
||||
}
|
||||
}
|
||||
void Init_HLE_Libs(SymbolsResolver *sym) {
|
||||
LibC::LibC_Register(sym);
|
||||
LibKernel::LibKernel_Register(sym);
|
||||
LibSceVideoOut::LibSceVideoOut_Register(sym);
|
||||
LibSceGnmDriver::LibSceGnmDriver_Register(sym);
|
||||
}
|
||||
} // namespace HLE::Libs
|
Loading…
Reference in New Issue