diff --git a/core/libs/prx/libkernel/CMakeLists.txt b/core/libs/prx/libkernel/CMakeLists.txt index ad1b65ea6..8d5fc019a 100644 --- a/core/libs/prx/libkernel/CMakeLists.txt +++ b/core/libs/prx/libkernel/CMakeLists.txt @@ -1,6 +1,8 @@ add_library(libkernel SHARED EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/Export.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Equeue/Equeue.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/File/src/File.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Semaphore/src/Semaphore.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DirectMemory/Export.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DirectMemory/DirectMemory.cpp ${CMAKE_CURRENT_SOURCE_DIR}/DirectMemory/MemoryPool.cpp diff --git a/core/libs/prx/libkernel/Export.cpp b/core/libs/prx/libkernel/Export.cpp index a525a556c..37f8ad266 100644 --- a/core/libs/prx/libkernel/Export.cpp +++ b/core/libs/prx/libkernel/Export.cpp @@ -5,6 +5,8 @@ #include "prx/libc/include/General.hpp" #include "DirectMemory/DirectMemory.hpp" #include "Equeue/Equeue.hpp" +#include "File/include/File.hpp" +#include "Semaphore/include/Semaphore.hpp" extern "C" { @@ -169,7 +171,6 @@ int APS5_VABI mkdir_nid_postfix(const char* path, uint16_t mode) { return 0; } - int APS5_VABI open_nid_postfix(const char* path, int flags, int mode) { (void)path; (void)flags; @@ -593,8 +594,6 @@ int APS5_VABI sceCoredumpUnregisterCoredumpHandler(void) { return 0; } - - int APS5_VABI sceKernelAioDeleteRequest(int32_t id, int32_t* ret) { (void)id; (void)ret; @@ -640,9 +639,6 @@ int APS5_VABI sceKernelAioWaitRequest(int32_t id, int32_t* state, uint32_t* usec return 0; } - - - int APS5_VABI sceKernelAvailableFlexibleMemorySize(size_t* size) { (void)size; NotImplemented_nid_no_patch(__func__); @@ -716,12 +712,6 @@ int APS5_VABI sceKernelClockGettime(KernelClockid clock_id, KernelTimespec* tp) return 0; } -int APS5_VABI sceKernelClose(int d) { - (void)d; - NotImplemented_nid_no_patch(__func__); - return 0; -} - int APS5_VABI sceKernelConfiguredFlexibleMemorySize(size_t* size) { (void)size; NotImplemented_nid_no_patch(__func__); @@ -747,8 +737,6 @@ int APS5_VABI sceKernelConvertUtcToLocaltime(int64_t utc_time, int64_t* local_ti return 0; } - - int APS5_VABI sceKernelCreateEventFlag(KernelEventFlag* ef, const char* name, uint32_t attr, uint64_t init_pattern, const void* param) { (void)ef; (void)name; @@ -759,17 +747,6 @@ int APS5_VABI sceKernelCreateEventFlag(KernelEventFlag* ef, const char* name, ui return 0; } -int APS5_VABI sceKernelCreateSema(KernelSema* sem, const char* name, uint32_t attr, int init, int max, void* opt) { - (void)sem; - (void)name; - (void)attr; - (void)init; - (void)max; - (void)opt; - NotImplemented_nid_no_patch(__func__); - return 0; -} - void APS5_VABI sceKernelDebugRaiseException(int c1, int c2) { (void)c1; (void)c2; @@ -782,8 +759,6 @@ void APS5_VABI sceKernelDebugRaiseExceptionOnReleaseMode(int c1, int c2) { NotImplemented_nid_no_patch(__func__); } - - int APS5_VABI sceKernelDeleteEventFlag(KernelEventFlag ef) { (void)ef; NotImplemented_nid_no_patch(__func__); @@ -830,7 +805,6 @@ int APS5_VABI sceKernelGetdents(int fd, char* buf, int nbytes) { return 0; } - int APS5_VABI sceKernelGetdirentries(int fd, char* buf, int nbytes, int64_t* basep) { (void)fd; (void)buf; @@ -912,7 +886,6 @@ int APS5_VABI sceKernelGetPageTableStats(int* cpu_total, int* cpu_available, int return 0; } - void* APS5_VABI sceKernelGetProcParam(void) { NotImplemented_nid_no_patch(__func__); return nullptr; @@ -984,19 +957,6 @@ KernelModule APS5_VABI sceKernelLoadStartModule(const char* module_file_name, si return {}; } -int64_t APS5_VABI sceKernelLseek(int d, int64_t offset, int whence) { - (void)d; - (void)offset; - (void)whence; - NotImplemented_nid_no_patch(__func__); - return 0; -} - - - - - - int APS5_VABI sceKernelMemoryPoolBatch(const KernelMemoryPoolBatchEntry* entries, int num_entries, int* num_entries_out, int flags) { (void)entries; (void)num_entries; @@ -1058,7 +1018,6 @@ int APS5_VABI sceKernelMkdir(const char* path, uint16_t mode) { return 0; } - int APS5_VABI sceKernelMtypeprotect(const void* addr, size_t len, int type, int prot) { (void)addr; (void)len; @@ -1068,16 +1027,6 @@ int APS5_VABI sceKernelMtypeprotect(const void* addr, size_t len, int type, int return 0; } - - -int APS5_VABI sceKernelOpen(const char* path, int flags, uint16_t mode) { - (void)path; - (void)flags; - (void)mode; - NotImplemented_nid_no_patch(__func__); - return 0; -} - int APS5_VABI sceKernelPollEventFlag(KernelEventFlag ef, uint64_t bit_pattern, uint32_t wait_mode, uint64_t* result_pat) { (void)ef; (void)bit_pattern; @@ -1087,13 +1036,6 @@ int APS5_VABI sceKernelPollEventFlag(KernelEventFlag ef, uint64_t bit_pattern, u return 0; } -int APS5_VABI sceKernelPollSema(KernelSema sem, int need) { - (void)sem; - (void)need; - NotImplemented_nid_no_patch(__func__); - return 0; -} - int64_t APS5_VABI sceKernelPread(int d, void* buf, size_t nbytes, int64_t offset) { (void)d; (void)buf; @@ -1128,20 +1070,11 @@ int APS5_VABI sceKernelRaiseException(Pthread thread, int signum) { return 0; } -int64_t APS5_VABI sceKernelRead(int d, void* buf, size_t nbytes) { - (void)d; - (void)buf; - (void)nbytes; - NotImplemented_nid_no_patch(__func__); - return 0; -} - uint64_t APS5_VABI sceKernelReadTsc(void) { NotImplemented_nid_no_patch(__func__); return 0; } - int APS5_VABI sceKernelRemoveExceptionHandler(int signum) { (void)signum; NotImplemented_nid_no_patch(__func__); @@ -1155,7 +1088,6 @@ int APS5_VABI sceKernelRename(const char* from, const char* to) { return 0; } - int APS5_VABI sceKernelRmdir(const char* path) { (void)path; NotImplemented_nid_no_patch(__func__); @@ -1222,26 +1154,12 @@ int APS5_VABI sceKernelSetVirtualRangeName(const void* addr, uint64_t len, const return 0; } -int APS5_VABI sceKernelSignalSema(KernelSema sem, int count) { - (void)sem; - (void)count; - NotImplemented_nid_no_patch(__func__); - return 0; -} - unsigned int APS5_VABI sceKernelSleep(unsigned int seconds) { (void)seconds; NotImplemented_nid_no_patch(__func__); return 0; } -int APS5_VABI sceKernelStat(const char* path, FileStat* sb) { - (void)path; - (void)sb; - NotImplemented_nid_no_patch(__func__); - return 0; -} - int APS5_VABI sceKernelStopUnloadModule(KernelModule handle, size_t args, const void* argp, uint32_t flags, const KernelUnloadModuleOpt* opt, int* res) { (void)handle; (void)args; @@ -1257,24 +1175,12 @@ void APS5_VABI sceKernelSync(void) { NotImplemented_nid_no_patch(__func__); } - - -int APS5_VABI sceKernelUnlink(const char* path) { - (void)path; - NotImplemented_nid_no_patch(__func__); - return 0; -} - - int APS5_VABI sceKernelUuidCreate(uint32_t* uuid) { (void)uuid; NotImplemented_nid_no_patch(__func__); return 0; } - - - int APS5_VABI sceKernelWaitEventFlag(KernelEventFlag ef, uint64_t bit_pattern, uint32_t wait_mode, uint64_t* result_pat, KernelUseconds* timeout) { (void)ef; (void)bit_pattern; @@ -1285,22 +1191,6 @@ int APS5_VABI sceKernelWaitEventFlag(KernelEventFlag ef, uint64_t bit_pattern, u return 0; } -int APS5_VABI sceKernelWaitSema(KernelSema sem, int need, KernelUseconds* time) { - (void)sem; - (void)need; - (void)time; - NotImplemented_nid_no_patch(__func__); - return 0; -} - -int64_t APS5_VABI sceKernelWrite(int d, const void* buf, size_t nbytes) { - (void)d; - (void)buf; - (void)nbytes; - NotImplemented_nid_no_patch(__func__); - return 0; -} - int APS5_VABI sched_get_priority_max_nid_postfix(int policy) { (void)policy; NotImplemented_nid_no_patch(__func__); diff --git a/core/libs/prx/libkernel/File/include/File.hpp b/core/libs/prx/libkernel/File/include/File.hpp new file mode 100644 index 000000000..d5772ff06 --- /dev/null +++ b/core/libs/prx/libkernel/File/include/File.hpp @@ -0,0 +1,22 @@ +#ifndef CORE_LIBS_PRX_LIBKERNEL_FILE_FILE_HPP +#define CORE_LIBS_PRX_LIBKERNEL_FILE_FILE_HPP + +#include +#include + +#include "SceTypes.hpp" +#include "prx/libc/include/general/VabiMacros.hpp" + +extern "C" { + +int APS5_VABI sceKernelClose(int d); +int APS5_VABI sceKernelLseek(int d, int64_t offset, int whence); +int APS5_VABI sceKernelOpen(const char* path, int flags, uint16_t mode); +int64_t APS5_VABI sceKernelRead(int d, void* buf, size_t nbytes); +int APS5_VABI sceKernelStat(const char* path, FileStat* sb); +int APS5_VABI sceKernelUnlink(const char* path); +int64_t APS5_VABI sceKernelWrite(int d, const void* buf, size_t nbytes); + +} + +#endif diff --git a/core/libs/prx/libkernel/File/src/File.cpp b/core/libs/prx/libkernel/File/src/File.cpp new file mode 100644 index 000000000..c8dc4be8b --- /dev/null +++ b/core/libs/prx/libkernel/File/src/File.cpp @@ -0,0 +1,51 @@ +#include "prx/libkernel/File/include/File.hpp" + +#include + +extern "C" { + +int APS5_VABI sceKernelClose(int d) { + (void)d; + throw std::runtime_error("sceKernelClose is not implemented"); +} + +int APS5_VABI sceKernelLseek(int d, int64_t offset, int whence) { + (void)d; + (void)offset; + (void)whence; + throw std::runtime_error("sceKernelLseek is not implemented"); +} + +int APS5_VABI sceKernelOpen(const char* path, int flags, uint16_t mode) { + (void)path; + (void)flags; + (void)mode; + throw std::runtime_error("sceKernelOpen is not implemented"); +} + +int64_t APS5_VABI sceKernelRead(int d, void* buf, size_t nbytes) { + (void)d; + (void)buf; + (void)nbytes; + throw std::runtime_error("sceKernelRead is not implemented"); +} + +int APS5_VABI sceKernelStat(const char* path, FileStat* sb) { + (void)path; + (void)sb; + throw std::runtime_error("sceKernelStat is not implemented"); +} + +int APS5_VABI sceKernelUnlink(const char* path) { + (void)path; + throw std::runtime_error("sceKernelUnlink is not implemented"); +} + +int64_t APS5_VABI sceKernelWrite(int d, const void* buf, size_t nbytes) { + (void)d; + (void)buf; + (void)nbytes; + throw std::runtime_error("sceKernelWrite is not implemented"); +} + +} diff --git a/core/libs/prx/libkernel/Semaphore/include/Semaphore.hpp b/core/libs/prx/libkernel/Semaphore/include/Semaphore.hpp new file mode 100644 index 000000000..530a34ec3 --- /dev/null +++ b/core/libs/prx/libkernel/Semaphore/include/Semaphore.hpp @@ -0,0 +1,18 @@ +#ifndef CORE_LIBS_PRX_LIBKERNEL_SEMAPHORE_SEMAPHORE_HPP +#define CORE_LIBS_PRX_LIBKERNEL_SEMAPHORE_SEMAPHORE_HPP + +#include + +#include "SceTypes.hpp" +#include "prx/libc/include/general/VabiMacros.hpp" + +extern "C" { + +int APS5_VABI sceKernelCreateSema(KernelSema* sem, const char* name, uint32_t attr, int init, int max, void* opt); +int APS5_VABI sceKernelPollSema(KernelSema sem, int need); +int APS5_VABI sceKernelSignalSema(KernelSema sem, int count); +int APS5_VABI sceKernelWaitSema(KernelSema sem, int need, KernelUseconds* time); + +} + +#endif diff --git a/core/libs/prx/libkernel/Semaphore/src/Semaphore.cpp b/core/libs/prx/libkernel/Semaphore/src/Semaphore.cpp new file mode 100644 index 000000000..21673c787 --- /dev/null +++ b/core/libs/prx/libkernel/Semaphore/src/Semaphore.cpp @@ -0,0 +1,36 @@ +#include "prx/libkernel/Semaphore/include/Semaphore.hpp" + +#include + +extern "C" { + +int APS5_VABI sceKernelCreateSema(KernelSema* sem, const char* name, uint32_t attr, int init, int max, void* opt) { + (void)sem; + (void)name; + (void)attr; + (void)init; + (void)max; + (void)opt; + throw std::runtime_error("sceKernelCreateSema is not implemented"); +} + +int APS5_VABI sceKernelPollSema(KernelSema sem, int need) { + (void)sem; + (void)need; + throw std::runtime_error("sceKernelPollSema is not implemented"); +} + +int APS5_VABI sceKernelSignalSema(KernelSema sem, int count) { + (void)sem; + (void)count; + throw std::runtime_error("sceKernelSignalSema is not implemented"); +} + +int APS5_VABI sceKernelWaitSema(KernelSema sem, int need, KernelUseconds* time) { + (void)sem; + (void)need; + (void)time; + throw std::runtime_error("sceKernelWaitSema is not implemented"); +} + +}