some memory functions (videoout_basic now reaches sceKernelAllocateDirectMemory which is WIP)
This commit is contained in:
parent
5b0e627dc0
commit
441471370e
|
@ -34,7 +34,7 @@ add_executable(shadps4
|
||||||
src/Core/Memory.h
|
src/Core/Memory.h
|
||||||
src/Core/PS4/Linker.cpp
|
src/Core/PS4/Linker.cpp
|
||||||
src/Core/PS4/Linker.h
|
src/Core/PS4/Linker.h
|
||||||
"src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Util/StringUtil.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/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceVideoOut.cpp" "src/Core/PS4/HLE/LibSceVideoOut.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/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Util/StringUtil.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/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceVideoOut.cpp" "src/Core/PS4/HLE/LibSceVideoOut.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/MemoryManagement.cpp" "src/Core/PS4/HLE/Kernel/MemoryManagement.h" "src/Core/PS4/HLE/Kernel/MemMngCodes.h")
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
target_link_libraries(shadps4 PUBLIC fmt spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY})
|
target_link_libraries(shadps4 PUBLIC fmt spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY})
|
||||||
|
|
|
@ -3,3 +3,4 @@ constexpr int SCE_OK = 0;
|
||||||
|
|
||||||
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000c;//Insufficient memory
|
constexpr int SCE_KERNEL_ERROR_ENOMEM = 0x8002000c;//Insufficient memory
|
||||||
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016;//null or invalid states
|
constexpr int SCE_KERNEL_ERROR_EINVAL = 0x80020016;//null or invalid states
|
||||||
|
constexpr int SCE_KERNEL_ERROR_EAGAIN = 0x80020023;// Memory cannot be allocated
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#pragma once
|
||||||
|
#include "../../../../types.h"
|
||||||
|
|
||||||
|
// constants
|
||||||
|
|
||||||
|
constexpr u64 SCE_KERNEL_MAIN_DMEM_SIZE = (5637144576); // ~ 6GB
|
||||||
|
|
||||||
|
//memory types
|
||||||
|
constexpr int SCE_KERNEL_WB_ONION = 0; // write - back mode (Onion bus)
|
||||||
|
constexpr int SCE_KERNEL_WC_GARLIC = 3; // write - combining mode (Garlic bus)
|
||||||
|
constexpr int SCE_KERNEL_WB_GARLIC = 10; // write - back mode (Garlic bus)
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include "MemoryManagement.h"
|
||||||
|
#include "../../../../Debug.h"
|
||||||
|
#include "MemMngCodes.h"
|
||||||
|
#include <bit>
|
||||||
|
|
||||||
|
namespace HLE::Libs::LibKernel::MemoryManagement {
|
||||||
|
|
||||||
|
bool isPowerOfTwo(u64 n) { return std::popcount(n) == 1; }
|
||||||
|
|
||||||
|
bool is16KBmultiply(u64 n) { return ((n % (static_cast<u64>(16) * 1024) == 0)); }
|
||||||
|
|
||||||
|
u64 PS4_SYSV_ABI sceKernelGetDirectMemorySize() { return SCE_KERNEL_MAIN_DMEM_SIZE; }
|
||||||
|
|
||||||
|
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u64 len, u64 alignment, int memoryType,s64* physAddrOut){
|
||||||
|
BREAKPOINT();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace HLE::Libs::LibKernel::MemoryManagement
|
|
@ -0,0 +1,10 @@
|
||||||
|
#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);
|
||||||
|
|
||||||
|
};
|
|
@ -3,20 +3,12 @@
|
||||||
#include "Libs.h"
|
#include "Libs.h"
|
||||||
#include "../../../Debug.h"
|
#include "../../../Debug.h"
|
||||||
#include "../../../Util/Log.h"
|
#include "../../../Util/Log.h"
|
||||||
|
#include "Kernel/MemoryManagement.h"
|
||||||
|
|
||||||
namespace HLE::Libs::LibKernel {
|
namespace HLE::Libs::LibKernel {
|
||||||
|
|
||||||
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; //dummy return
|
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; //dummy return
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(off_t searchStart, off_t searchEnd, size_t len, size_t alignment, int memoryType,
|
|
||||||
off_t* physAddrOut) {
|
|
||||||
BREAKPOINT();
|
|
||||||
return 0; // OK
|
|
||||||
}
|
|
||||||
size_t PS4_SYSV_ABI sceKernelGetDirectMemorySize() {
|
|
||||||
BREAKPOINT();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int32_t PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment) {
|
int32_t PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment) {
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -49,8 +41,8 @@ namespace HLE::Libs::LibKernel {
|
||||||
//obj
|
//obj
|
||||||
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &HLE::Libs::LibKernel::g_stack_chk_guard);
|
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &HLE::Libs::LibKernel::g_stack_chk_guard);
|
||||||
//memory
|
//memory
|
||||||
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, sceKernelAllocateDirectMemory);
|
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, HLE::Libs::LibKernel::MemoryManagement::sceKernelAllocateDirectMemory);
|
||||||
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, sceKernelGetDirectMemorySize);
|
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, HLE::Libs::LibKernel::MemoryManagement::sceKernelGetDirectMemorySize);
|
||||||
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory);
|
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, sceKernelMapDirectMemory);
|
||||||
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
|
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
|
||||||
//equeue
|
//equeue
|
||||||
|
|
|
@ -5,8 +5,6 @@ namespace HLE::Libs::LibKernel {
|
||||||
void LibKernel_Register(SymbolsResolver* sym);
|
void LibKernel_Register(SymbolsResolver* sym);
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
int PS4_SYSV_ABI sceKernelAllocateDirectMemory(off_t searchStart, off_t searchEnd, size_t len, size_t alignment, int memoryType, off_t* physAddrOut);
|
|
||||||
size_t PS4_SYSV_ABI sceKernelGetDirectMemorySize();
|
|
||||||
int PS4_SYSV_ABI sceKernelCreateEqueue(/* SceKernelEqueue* eq*/ int eq, const char* name);
|
int PS4_SYSV_ABI sceKernelCreateEqueue(/* SceKernelEqueue* eq*/ int eq, const char* name);
|
||||||
int32_t PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment);
|
int32_t PS4_SYSV_ABI sceKernelMapDirectMemory(void** addr, size_t len, int prot, int flags, off_t directMemoryStart, size_t alignment);
|
||||||
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len);
|
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len);
|
||||||
|
|
Loading…
Reference in New Issue