2023-07-13 11:56:36 +02:00
|
|
|
#include "../Loader/Elf.h"
|
|
|
|
#include "LibKernel.h"
|
|
|
|
#include "Libs.h"
|
2023-08-03 11:25:25 +02:00
|
|
|
#include <debug.h>
|
2023-08-13 15:54:56 +02:00
|
|
|
#include <Util/log.h>
|
2023-08-03 12:05:13 +02:00
|
|
|
#include "Kernel/memory_management.h"
|
2023-08-02 07:04:09 +02:00
|
|
|
#include "../../../Util/Singleton.h"
|
2023-08-02 12:51:10 +02:00
|
|
|
#include "Kernel/Objects/physical_memory.h"
|
2023-08-15 22:10:45 +02:00
|
|
|
#include "Kernel/cpu_management.h"
|
2023-08-17 09:10:13 +02:00
|
|
|
#include "Kernel/event_queues.h"
|
2023-07-13 11:56:36 +02:00
|
|
|
|
|
|
|
namespace HLE::Libs::LibKernel {
|
|
|
|
|
2023-07-17 12:53:27 +02:00
|
|
|
static u64 g_stack_chk_guard = 0xDEADBEEF54321ABC; //dummy return
|
|
|
|
|
2023-07-21 13:52:40 +02:00
|
|
|
int32_t PS4_SYSV_ABI sceKernelReleaseDirectMemory(off_t start, size_t len) {
|
2023-07-24 12:05:57 +02:00
|
|
|
BREAKPOINT();
|
2023-07-21 13:52:40 +02:00
|
|
|
return 0;
|
2023-07-13 11:56:36 +02:00
|
|
|
}
|
|
|
|
|
2023-07-14 13:29:13 +02:00
|
|
|
|
2023-07-24 12:05:57 +02:00
|
|
|
static PS4_SYSV_ABI void stack_chk_fail() { BREAKPOINT();
|
2023-07-14 13:29:13 +02:00
|
|
|
}
|
2023-09-10 11:59:21 +02:00
|
|
|
u64 PS4_SYSV_ABI sceKernelReadTsc() {
|
|
|
|
LARGE_INTEGER c;
|
|
|
|
QueryPerformanceCounter(&c);
|
|
|
|
return c.QuadPart;
|
|
|
|
}
|
2023-07-13 11:56:36 +02:00
|
|
|
void LibKernel_Register(SymbolsResolver* sym) {
|
2023-07-17 12:53:27 +02:00
|
|
|
//obj
|
|
|
|
LIB_OBJ("f7uOxY9mM1U", "libkernel", 1, "libkernel", 1, 1, &HLE::Libs::LibKernel::g_stack_chk_guard);
|
2023-07-13 11:56:36 +02:00
|
|
|
//memory
|
2023-08-03 12:16:49 +02:00
|
|
|
LIB_FUNCTION("rTXw65xmLIA", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelAllocateDirectMemory);
|
|
|
|
LIB_FUNCTION("pO96TwzOm5E", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelGetDirectMemorySize);
|
|
|
|
LIB_FUNCTION("L-Q3LEjIbgA", "libkernel", 1, "libkernel", 1, 1, MemoryManagement::sceKernelMapDirectMemory);
|
2023-07-13 11:56:36 +02:00
|
|
|
LIB_FUNCTION("MBuItvba6z8", "libkernel", 1, "libkernel", 1, 1, sceKernelReleaseDirectMemory);
|
|
|
|
//equeue
|
2023-08-17 09:10:13 +02:00
|
|
|
LIB_FUNCTION("D0OdFMjp46I", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelCreateEqueue);
|
2023-09-08 07:28:01 +02:00
|
|
|
LIB_FUNCTION("fzyMKs9kim0", "libkernel", 1, "libkernel", 1, 1, EventQueues::sceKernelWaitEqueue);
|
2023-07-14 13:29:13 +02:00
|
|
|
//misc
|
2023-08-15 22:10:45 +02:00
|
|
|
LIB_FUNCTION("WslcK1FQcGI", "libkernel", 1, "libkernel", 1, 1, CPUManagement::sceKernelIsNeoMode);
|
2023-07-14 13:29:13 +02:00
|
|
|
LIB_FUNCTION("Ou3iL1abvng", "libkernel", 1, "libkernel", 1, 1, stack_chk_fail);
|
2023-09-10 11:59:21 +02:00
|
|
|
//time
|
|
|
|
LIB_FUNCTION("-2IRUCO--PM", "libkernel", 1, "libkernel", 1, 1, sceKernelReadTsc);
|
2023-07-13 11:56:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|