partial implementation of _write function , which is used as debug ouput from lle libc

This commit is contained in:
georgemoralis 2024-03-31 13:33:38 +03:00
parent 8fa5874fb1
commit 0525481a9b
6 changed files with 41 additions and 6 deletions

View File

@ -112,6 +112,8 @@ set(LIBRARIES src/core/libraries/library_common.h
src/core/libraries/libscenet.h
src/core/libraries/libscenetctl.cpp
src/core/libraries/libscenetctl.h
src/core/libraries/libsceposix.cpp
src/core/libraries/libsceposix.h
src/core/libraries/libscesavedata.cpp
src/core/libraries/libscesavedata.h
src/core/libraries/libscessl.cpp

View File

@ -8,12 +8,14 @@
#include "core/hle/libraries/libpad/pad.h"
#include "core/hle/libraries/libs.h"
#include "core/hle/libraries/libscegnmdriver/libscegnmdriver.h"
#include "src/core/libraries/libkernel.h"
#include "src/core/libraries/libsceaudioout.h"
#include "src/core/libraries/libscecommondialog.h"
#include "src/core/libraries/libscehttp.h"
#include "src/core/libraries/libscemsgdialog.h"
#include "src/core/libraries/libscenet.h"
#include "src/core/libraries/libscenetctl.h"
#include "src/core/libraries/libsceposix.h"
#include "src/core/libraries/libscesavedata.h"
#include "src/core/libraries/libscessl.h"
#include "src/core/libraries/libscesysmodule.h"
@ -43,6 +45,8 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
Libraries::SaveData::RegisterlibSceSaveData(sym);
Libraries::Ssl::RegisterlibSceSsl(sym);
Libraries::SysModule::RegisterlibSceSysmodule(sym);
Libraries::Kernel::Registerlibkernel(sym);
Libraries::Posix::Registerlibsceposix(sym);
}
} // namespace OldLibraries

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include <common/assert.h>
#include "common/logging/log.h"
#include "error_codes.h"
#include "libkernel.h"
@ -458,8 +459,13 @@ int PS4_SYSV_ABI _wait4() {
return ORBIS_OK;
}
int PS4_SYSV_ABI _write() {
LOG_ERROR(Kernel, "(STUBBED) called");
s64 PS4_SYSV_ABI _write(int d, const void* buf, std::size_t nbytes) {
if (d <= 2) { // stdin,stdout,stderr
LOG_INFO(Kernel, "{}", (const char*)buf);
return nbytes;
}
LOG_ERROR(Kernel, "(STUBBED) called d = {} nbytes = {} ", d, nbytes);
UNREACHABLE(); // normal write , is it a posix call??
return ORBIS_OK;
}
@ -5348,9 +5354,9 @@ void Registerlibkernel(Core::Loader::SymbolsResolver* sym){
LIB_FUNCTION("6xVpy0Fdq+I", "libkernel", 1, "libkernel", 1, 1, _sigprocmask);
LIB_FUNCTION("9zpLsLESzTs", "libkernel", 1, "libkernel", 1, 1, _sigsuspend);
LIB_FUNCTION("04AjkP0jO9U", "libkernel", 1, "libkernel", 1, 1, _umtx_op);
LIB_FUNCTION("RFlsu7nfopM", "libkernel", 1, "libkernel", 1, 1, _wait4);
LIB_FUNCTION("RFlsu7nfopM", "libkernel", 1, "libkernel", 1, 1, _wait4);*/
LIB_FUNCTION("FxVZqBAA7ks", "libkernel", 1, "libkernel", 1, 1, _write);
LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, _writev);
/* LIB_FUNCTION("YSHRBRLn2pI", "libkernel", 1, "libkernel", 1, 1, _writev);
LIB_FUNCTION("3e+4Iv7IJ8U", "libkernel", 1, "libkernel", 1, 1, accept);
LIB_FUNCTION("8vE6Z6VEYyk", "libkernel", 1, "libkernel", 1, 1, access);
LIB_FUNCTION("3SVaehJvYFk", "libkernel", 1, "libkernel", 1, 1, amd64_set_fsbase);

View File

@ -97,7 +97,7 @@ int PS4_SYSV_ABI _sigprocmask();
int PS4_SYSV_ABI _sigsuspend();
int PS4_SYSV_ABI _umtx_op();
int PS4_SYSV_ABI _wait4();
int PS4_SYSV_ABI _write();
s64 PS4_SYSV_ABI _write(int d, const void* buf, std::size_t nbytes);
int PS4_SYSV_ABI _writev();
int PS4_SYSV_ABI accept();
int PS4_SYSV_ABI access();

View File

@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// Generated By moduleGenerator
#include "common/logging/log.h"
#include "error_codes.h"
#include "libsceposix.h"
namespace Libraries::Posix {
void Registerlibsceposix(Core::Loader::SymbolsResolver* sym) {}
} // namespace Libraries::Posix

View File

@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "library_common.h"
namespace Libraries::Posix {
void Registerlibsceposix(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Posix