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 "ThreadManagement.h"
|
||||||
|
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#include "../ErrorCodes.h"
|
#include "../ErrorCodes.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel::ThreadManagement
|
namespace HLE::Libs::LibKernel::ThreadManagement {
|
||||||
{
|
|
||||||
|
|
||||||
thread_local PthreadInternal* g_pthread_self = nullptr;
|
thread_local PthreadInternal* g_pthread_self = nullptr;
|
||||||
PThreadCxt* g_pthread_cxt = nullptr;
|
PThreadCxt* g_pthread_cxt = nullptr;
|
||||||
|
|
||||||
|
|
||||||
void Pthread_Init_Self_MainThread() {
|
void Pthread_Init_Self_MainThread() {
|
||||||
g_pthread_self = new PthreadInternal{};
|
g_pthread_self = new PthreadInternal{};
|
||||||
scePthreadAttrInit(&g_pthread_self->attr);
|
scePthreadAttrInit(&g_pthread_self->attr);
|
||||||
|
@ -17,7 +17,6 @@ void Pthread_Init_Self_MainThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int scePthreadAttrInit(ScePthreadAttr* attr) {
|
int scePthreadAttrInit(ScePthreadAttr* attr) {
|
||||||
|
|
||||||
*attr = new PthreadAttrInternal{};
|
*attr = new PthreadAttrInternal{};
|
||||||
|
|
||||||
int result = pthread_attr_init(&(*attr)->pth_attr);
|
int result = pthread_attr_init(&(*attr)->pth_attr);
|
||||||
|
@ -41,7 +40,6 @@ int scePthreadAttrInit(ScePthreadAttr* attr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
||||||
|
|
||||||
if (attr == nullptr || *attr == nullptr) {
|
if (attr == nullptr || *attr == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -50,8 +48,7 @@ int scePthreadAttrSetdetachstate(ScePthreadAttr* attr, int detachstate) {
|
||||||
switch (detachstate) {
|
switch (detachstate) {
|
||||||
case 0: pstate = PTHREAD_CREATE_JOINABLE; break;
|
case 0: pstate = PTHREAD_CREATE_JOINABLE; break;
|
||||||
case 1: pstate = PTHREAD_CREATE_DETACHED; break;
|
case 1: pstate = PTHREAD_CREATE_DETACHED; break;
|
||||||
default:
|
default: BREAKPOINT(); // unknown state
|
||||||
BREAKPOINT(); // unknown state
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int result = pthread_attr_setdetachstate(&(*attr)->pth_attr, pstate);
|
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) {
|
int scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inheritSched) {
|
||||||
|
|
||||||
if (attr == nullptr || *attr == nullptr) {
|
if (attr == nullptr || *attr == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +82,6 @@ int scePthreadAttrSetinheritsched(ScePthreadAttr* attr, int inheritSched) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int scePthreadAttrSetschedparam(ScePthreadAttr* attr, const SceKernelSchedParam* param) {
|
int scePthreadAttrSetschedparam(ScePthreadAttr* attr, const SceKernelSchedParam* param) {
|
||||||
|
|
||||||
if (param == nullptr || attr == nullptr || *attr == nullptr) {
|
if (param == nullptr || attr == nullptr || *attr == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -109,13 +104,11 @@ int scePthreadAttrSetschedparam(ScePthreadAttr* attr, const SceKernelSchedParam*
|
||||||
}
|
}
|
||||||
|
|
||||||
int scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) {
|
int scePthreadAttrSetschedpolicy(ScePthreadAttr* attr, int policy) {
|
||||||
|
|
||||||
if (attr == nullptr || *attr == nullptr) {
|
if (attr == nullptr || *attr == nullptr) {
|
||||||
return SCE_KERNEL_ERROR_EINVAL;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (policy!= SCHED_OTHER)
|
if (policy != SCHED_OTHER) {
|
||||||
{
|
|
||||||
BREAKPOINT(); // invest if policy is other and if winpthreadlibrary support it
|
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;
|
return SCE_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}; // namespace HLE::Libs::LibKernel::ThreadManagement
|
|
@ -1,16 +1,13 @@
|
||||||
#include "MemoryManagement.h"
|
#include <debug.h>
|
||||||
|
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include <magic_enum.hpp>
|
#include <magic_enum.hpp>
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#include <debug.h>
|
|
||||||
#include "../../../../Util/Log.h"
|
#include "../../../../Util/Log.h"
|
||||||
#include "../../../../Util/Singleton.h"
|
#include "../../../../Util/Singleton.h"
|
||||||
#include "../ErrorCodes.h"
|
#include "../ErrorCodes.h"
|
||||||
#include "../Libs.h"
|
#include "../Libs.h"
|
||||||
#include "MemMngCodes.h"
|
|
||||||
#include "Objects/physical_memory.h"
|
#include "Objects/physical_memory.h"
|
||||||
|
#include "memory_management.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel::MemoryManagement {
|
namespace HLE::Libs::LibKernel::MemoryManagement {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
|
@ -12,3 +13,10 @@ enum MemoryTypes : u32 {
|
||||||
SCE_KERNEL_WC_GARLIC = 3, // write - combining mode (Garlic bus)
|
SCE_KERNEL_WC_GARLIC = 3, // write - combining mode (Garlic bus)
|
||||||
SCE_KERNEL_WB_GARLIC = 10 // write - back 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 "Libs.h"
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include "../../../Util/Log.h"
|
#include "../../../Util/Log.h"
|
||||||
#include "Kernel/MemoryManagement.h"
|
#include "Kernel/memory_management.h"
|
||||||
#include "../../../Util/Singleton.h"
|
#include "../../../Util/Singleton.h"
|
||||||
#include "Kernel/Objects/physical_memory.h"
|
#include "Kernel/Objects/physical_memory.h"
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
#include "LibSceVideoOut.h"
|
#include "LibSceVideoOut.h"
|
||||||
#include "Libs.h"
|
|
||||||
#include "../Loader/Elf.h"
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include "VideoOut/VideoOutCodes.h"
|
|
||||||
#include "UserManagement/UsrMngCodes.h"
|
|
||||||
#include "../../../Util/Log.h"
|
#include "../../../Util/Log.h"
|
||||||
|
#include "../Loader/Elf.h"
|
||||||
|
#include "Libs.h"
|
||||||
|
#include "UserManagement/UsrMngCodes.h"
|
||||||
|
#include "VideoOut/VideoOutCodes.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibSceVideoOut {
|
namespace HLE::Libs::LibSceVideoOut {
|
||||||
|
|
||||||
|
@ -32,9 +34,7 @@ namespace HLE::Libs::LibSceVideoOut {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(/* SceVideoOutBufferAttribute* attribute,*/ uint32_t pixelFormat, uint32_t tilingMode,
|
void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(/* SceVideoOutBufferAttribute* attribute,*/ uint32_t pixelFormat, uint32_t tilingMode,
|
||||||
uint32_t aspectRatio,
|
uint32_t aspectRatio, uint32_t width, uint32_t height, uint32_t pitchInPixel) {
|
||||||
uint32_t width, uint32_t height, uint32_t pitchInPixel)
|
|
||||||
{
|
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
int32_t PS4_SYSV_ABI sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/) {
|
int32_t PS4_SYSV_ABI sceVideoOutGetResolutionStatus(int32_t handle /*, SceVideoOutResolutionStatus* status*/) {
|
||||||
|
@ -42,24 +42,18 @@ namespace HLE::Libs::LibSceVideoOut {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index, const void* param) {
|
||||||
s32 PS4_SYSV_ABI sceVideoOutOpen(SceUserServiceUserId userId, s32 busType, s32 index, const void* param)
|
|
||||||
{
|
|
||||||
PRINT_DUMMY_FUNCTION_NAME();
|
PRINT_DUMMY_FUNCTION_NAME();
|
||||||
if (userId != SCE_USER_SERVICE_USER_ID_SYSTEM)
|
if (userId != SCE_USER_SERVICE_USER_ID_SYSTEM) {
|
||||||
{
|
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
if (busType != SCE_VIDEO_OUT_BUS_TYPE_MAIN)
|
if (busType != SCE_VIDEO_OUT_BUS_TYPE_MAIN) {
|
||||||
{
|
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
if (index != 0)
|
if (index != 0) {
|
||||||
{
|
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
if (param != nullptr)
|
if (param != nullptr) {
|
||||||
{
|
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
return 1; // dummy return TODO
|
return 1; // dummy return TODO
|
||||||
|
@ -68,8 +62,7 @@ namespace HLE::Libs::LibSceVideoOut {
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void LibSceVideoOut_Register(SymbolsResolver* sym)
|
void LibSceVideoOut_Register(SymbolsResolver* sym) {
|
||||||
{
|
|
||||||
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus);
|
LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutGetFlipStatus);
|
||||||
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
|
LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutSubmitFlip);
|
||||||
LIB_FUNCTION("w3BY+tAEiQY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutRegisterBuffers);
|
LIB_FUNCTION("w3BY+tAEiQY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutRegisterBuffers);
|
||||||
|
@ -81,4 +74,4 @@ namespace HLE::Libs::LibSceVideoOut {
|
||||||
LIB_FUNCTION("zgXifHT9ErY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutIsFlipPending);
|
LIB_FUNCTION("zgXifHT9ErY", "libSceVideoOut", 1, "libSceVideoOut", 0, 0, sceVideoOutIsFlipPending);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}; // namespace HLE::Libs::LibSceVideoOut
|
|
@ -1,16 +1,16 @@
|
||||||
#include "Libs.h"
|
#include "Libs.h"
|
||||||
|
|
||||||
#include "LibC.h"
|
#include "LibC.h"
|
||||||
#include "LibKernel.h"
|
#include "LibKernel.h"
|
||||||
#include "LibSceVideoOut.h"
|
|
||||||
#include "LibSceGnmDriver.h"
|
#include "LibSceGnmDriver.h"
|
||||||
|
#include "LibSceVideoOut.h"
|
||||||
|
|
||||||
namespace HLE::Libs {
|
namespace HLE::Libs {
|
||||||
|
|
||||||
void Init_HLE_Libs(SymbolsResolver *sym)
|
void Init_HLE_Libs(SymbolsResolver *sym) {
|
||||||
{
|
|
||||||
LibC::LibC_Register(sym);
|
LibC::LibC_Register(sym);
|
||||||
LibKernel::LibKernel_Register(sym);
|
LibKernel::LibKernel_Register(sym);
|
||||||
LibSceVideoOut::LibSceVideoOut_Register(sym);
|
LibSceVideoOut::LibSceVideoOut_Register(sym);
|
||||||
LibSceGnmDriver::LibSceGnmDriver_Register(sym);
|
LibSceGnmDriver::LibSceGnmDriver_Register(sym);
|
||||||
}
|
}
|
||||||
}
|
} // namespace HLE::Libs
|
Loading…
Reference in New Issue