mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-04 15:50:10 +01:00
[orbis-kernel] chroot bugfixes
reduce log spam increase count of gcm buffers
This commit is contained in:
parent
1f001101a4
commit
e9dfaf2573
|
|
@ -101,7 +101,7 @@ struct BridgeHeader {
|
|||
std::uint32_t bufferCount;
|
||||
CmdMemoryProt memoryAreas[128];
|
||||
CmdCommandBuffer commandBuffers[32];
|
||||
CmdBuffer buffers[8];
|
||||
CmdBuffer buffers[10];
|
||||
// orbis::shared_mutex cacheCommandMtx;
|
||||
// orbis::shared_cv cacheCommandCv;
|
||||
std::atomic<std::uint64_t> cacheCommands[4];
|
||||
|
|
|
|||
|
|
@ -659,7 +659,8 @@ SysResult sys_opmc_set_ctr(Thread *thread /* TODO */);
|
|||
SysResult sys_opmc_get_ctr(Thread *thread /* TODO */);
|
||||
SysResult sys_budget_create(Thread *thread /* TODO */);
|
||||
SysResult sys_budget_delete(Thread *thread /* TODO */);
|
||||
SysResult sys_budget_get(Thread *thread /* TODO */);
|
||||
SysResult sys_budget_get(Thread *thread, sint id, ptr<void> a,
|
||||
ptr<uint32_t> count);
|
||||
SysResult sys_budget_set(Thread *thread, slong budget);
|
||||
SysResult sys_virtual_query(Thread *thread, ptr<void> addr, uint64_t unk,
|
||||
ptr<void> info, size_t infosz);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ struct Process final {
|
|||
kstring cwd;
|
||||
kstring root = "/";
|
||||
sint memoryContainer{1};
|
||||
sint budgetId{1};
|
||||
bool isInSandbox = false;
|
||||
|
||||
std::uint64_t nextTlsSlot = 1;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ orbis::SysResult orbis::sys_fcntl(Thread *thread, sint fd, sint cmd,
|
|||
return {};
|
||||
}
|
||||
orbis::SysResult orbis::sys_close(Thread *thread, sint fd) {
|
||||
ORBIS_LOG_NOTICE(__FUNCTION__, fd);
|
||||
// ORBIS_LOG_NOTICE(__FUNCTION__, fd);
|
||||
if (thread->tproc->fileDescriptors.close(fd)) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -629,8 +629,9 @@ orbis::SysResult orbis::sys_budget_create(Thread *thread /* TODO */) {
|
|||
orbis::SysResult orbis::sys_budget_delete(Thread *thread /* TODO */) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
orbis::SysResult orbis::sys_budget_get(Thread *thread /* TODO */) {
|
||||
return ErrorCode::NOSYS;
|
||||
orbis::SysResult orbis::sys_budget_get(Thread *thread, sint id, ptr<void> a,
|
||||
ptr<uint32_t> count) {
|
||||
return {};
|
||||
}
|
||||
orbis::SysResult orbis::sys_budget_set(Thread *thread, slong budget) {
|
||||
ORBIS_LOG_TODO(__FUNCTION__, budget);
|
||||
|
|
@ -1013,11 +1014,11 @@ orbis::sys_dynlib_get_info_ex(Thread *thread, SceKernelModule handle,
|
|||
return uwrite(destModuleInfoEx, result);
|
||||
}
|
||||
orbis::SysResult orbis::sys_budget_getid(Thread *thread) {
|
||||
thread->retval[0] = 1;
|
||||
thread->retval[0] = thread->tproc->budgetId;
|
||||
return {};
|
||||
}
|
||||
orbis::SysResult orbis::sys_budget_get_ptype(Thread *thread, sint budgetId) {
|
||||
thread->retval[0] = 1;
|
||||
thread->retval[0] = budgetId;
|
||||
return {};
|
||||
}
|
||||
orbis::SysResult
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
|
|||
|
||||
enum sysctl_machdep_liverpool { telemetry = 1000, icc_max };
|
||||
|
||||
struct ProcInfo {
|
||||
char data[0x448];
|
||||
};
|
||||
|
||||
// for (unsigned int i = 0; i < namelen; ++i) {
|
||||
// std::fprintf(stderr, " name[%u] = %u\n", i, name[i]);
|
||||
// }
|
||||
|
|
@ -83,12 +87,8 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
|
|||
|
||||
if (name[0] == kern && name[1] == 14 && name[2] == 8) {
|
||||
// KERN_PROC_PROC
|
||||
|
||||
struct ProcInfo {
|
||||
char data[0x448];
|
||||
};
|
||||
|
||||
*oldlenp = 0;
|
||||
std::memset(old, 0, sizeof(ProcInfo));
|
||||
*oldlenp = sizeof(ProcInfo);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +120,12 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
|
|||
}
|
||||
|
||||
if (namelen == 4) {
|
||||
if (name[0] == kern && name[1] == 14 && name[2] == 1) {
|
||||
std::memset(old, 0, sizeof(ProcInfo));
|
||||
*oldlenp = sizeof(ProcInfo);
|
||||
return {};
|
||||
}
|
||||
|
||||
if (name[0] == 1 && name[1] == 14 && name[2] == 35) {
|
||||
// AppInfo get/set
|
||||
|
||||
|
|
@ -129,7 +135,8 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
|
|||
if (process->pid != name[3] && name[3] != -1) {
|
||||
process = g_context.findProcessById(name[3]);
|
||||
if (process == nullptr) {
|
||||
ORBIS_LOG_ERROR("appinfo process not found", name[3], thread->tproc->pid);
|
||||
ORBIS_LOG_ERROR("appinfo process not found", name[3],
|
||||
thread->tproc->pid);
|
||||
return ErrorCode::SRCH;
|
||||
}
|
||||
}
|
||||
|
|
@ -164,8 +171,8 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
|
|||
auto &appInfo = process->appInfo;
|
||||
ORBIS_LOG_ERROR("set AppInfo", appInfo.appId, appInfo.unk0,
|
||||
appInfo.unk1, appInfo.appType, appInfo.titleId,
|
||||
appInfo.unk2, appInfo.unk3, appInfo.unk5, appInfo.unk6,
|
||||
appInfo.unk7, appInfo.unk8);
|
||||
appInfo.unk2, appInfo.unk3, appInfo.unk5,
|
||||
appInfo.unk6, appInfo.unk7, appInfo.unk8);
|
||||
|
||||
// HACK
|
||||
if (appInfo.appId == 0 && appInfo.unk4 == 0) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ orbis::SysResult orbis::sys_open(Thread *thread, ptr<char> path, sint flags,
|
|||
|
||||
auto fd = thread->tproc->fileDescriptors.insert(file);
|
||||
thread->retval[0] = fd;
|
||||
ORBIS_LOG_NOTICE(__FUNCTION__, path, flags, mode, fd);
|
||||
// ORBIS_LOG_NOTICE(__FUNCTION__, path, flags, mode, fd);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ orbis::SysResult orbis::sys_lpathconf(Thread *thread, ptr<char> path,
|
|||
}
|
||||
orbis::SysResult orbis::sys_readlink(Thread *thread, ptr<char> path,
|
||||
ptr<char> buf, size_t count) {
|
||||
return ErrorCode::NOSYS;
|
||||
return ErrorCode::INVAL;
|
||||
}
|
||||
orbis::SysResult orbis::sys_readlinkat(Thread *thread, sint fd, ptr<char> path,
|
||||
ptr<char> buf, size_t bufsize) {
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ static orbis::ErrorCode dce_ioctl(orbis::File *file, std::uint64_t request,
|
|||
|
||||
if (args->index >= std::size(rx::bridge.header->buffers)) {
|
||||
// TODO
|
||||
ORBIS_LOG_FATAL("dce: out of buffers!");
|
||||
ORBIS_LOG_FATAL("dce: out of buffers!", args->index);
|
||||
return orbis::ErrorCode::NOMEM;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,12 @@ static orbis::ErrorCode dipsw_ioctl(orbis::File *file, std::uint64_t request,
|
|||
return {};
|
||||
}
|
||||
|
||||
if (request == 0xc0088803) {
|
||||
// TODO
|
||||
*reinterpret_cast<std::uint32_t *>(argp) = 0;
|
||||
return{};
|
||||
}
|
||||
|
||||
ORBIS_LOG_FATAL("Unhandled dipsw ioctl", request);
|
||||
thread->where();
|
||||
//__builtin_trap();
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ static orbis::ErrorCode gc_ioctl(orbis::File *file, std::uint64_t request,
|
|||
default:
|
||||
ORBIS_LOG_FATAL("Unhandled gc ioctl", request);
|
||||
std::fflush(stdout);
|
||||
__builtin_trap();
|
||||
// __builtin_trap();
|
||||
break;
|
||||
}
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -808,6 +808,8 @@ int main(int argc, const char *argv[]) {
|
|||
0xF0000000FFFF4000,
|
||||
},
|
||||
};
|
||||
initProcess->budgetId = 0;
|
||||
initProcess->isInSandbox = false;
|
||||
} else {
|
||||
initProcess->authInfo = {
|
||||
.unk0 = 0x3100000000000001,
|
||||
|
|
@ -826,6 +828,8 @@ int main(int argc, const char *argv[]) {
|
|||
0xF0000000FFFF4000,
|
||||
},
|
||||
};
|
||||
initProcess->budgetId = 1;
|
||||
initProcess->isInSandbox = true;
|
||||
}
|
||||
|
||||
auto [baseId, mainThread] = initProcess->threadsMap.emplace();
|
||||
|
|
|
|||
|
|
@ -303,8 +303,7 @@ orbis::SysResult shm_open(orbis::Thread *thread, const char *path,
|
|||
orbis::sint flags, orbis::sint mode,
|
||||
orbis::Ref<orbis::File> *file) {
|
||||
auto dev = static_cast<IoDevice *>(orbis::g_context.shmDevice.get());
|
||||
return dev->open(file, getAbsolutePath(path, thread).c_str(), flags, mode,
|
||||
thread);
|
||||
return dev->open(file, path, flags, mode, thread);
|
||||
}
|
||||
orbis::SysResult unlink(orbis::Thread *thread, orbis::ptr<const char> path) {
|
||||
return rx::vfs::unlink(getAbsolutePath(path, thread), thread);
|
||||
|
|
@ -606,7 +605,7 @@ orbis::SysResult nmount(orbis::Thread *thread, orbis::ptr<orbis::IoVec> iovp,
|
|||
orbis::uint iovcnt, orbis::sint flags) {
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, iovp, iovcnt, flags);
|
||||
|
||||
std::string fstype;
|
||||
std::string_view fstype;
|
||||
std::string fspath;
|
||||
std::string target;
|
||||
|
||||
|
|
@ -620,7 +619,7 @@ orbis::SysResult nmount(orbis::Thread *thread, orbis::ptr<orbis::IoVec> iovp,
|
|||
std::string_view value((char *)b.base, b.len - 1);
|
||||
|
||||
if (key == "fstype") {
|
||||
fstype = getAbsolutePath(std::string(value), thread);
|
||||
fstype = value;
|
||||
} else if (key == "fspath") {
|
||||
fspath = getAbsolutePath(std::string(value), thread);
|
||||
} else if (key == "target") {
|
||||
|
|
@ -789,28 +788,38 @@ SysResult execve(Thread *thread, ptr<char> fname, ptr<ptr<char>> argv,
|
|||
}
|
||||
}
|
||||
|
||||
std::string path = getAbsolutePath(fname, thread);
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, path);
|
||||
|
||||
{
|
||||
orbis::Ref<File> file;
|
||||
auto result = rx::vfs::open(getAbsolutePath(fname, thread),
|
||||
kOpenFlagReadOnly, 0, &file, thread);
|
||||
auto result = rx::vfs::open(path, kOpenFlagReadOnly, 0, &file, thread);
|
||||
if (result.isError()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
std::string path = fname;
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, __LINE__);
|
||||
|
||||
rx::vm::reset();
|
||||
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, __LINE__);
|
||||
|
||||
thread->tproc->nextTlsSlot = 1;
|
||||
for (auto [id, mod] : thread->tproc->modulesMap) {
|
||||
thread->tproc->modulesMap.close(id);
|
||||
}
|
||||
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, __LINE__);
|
||||
|
||||
auto executableModule = rx::linker::loadModuleFile(path, thread);
|
||||
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, __LINE__);
|
||||
|
||||
executableModule->id = thread->tproc->modulesMap.insert(executableModule);
|
||||
thread->tproc->processParam = executableModule->processParam;
|
||||
thread->tproc->processParamSize = executableModule->processParamSize;
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, __LINE__);
|
||||
|
||||
auto name = path;
|
||||
if (auto slashP = name.rfind('/'); slashP != std::string::npos) {
|
||||
|
|
@ -821,11 +830,15 @@ SysResult execve(Thread *thread, ptr<char> fname, ptr<ptr<char>> argv,
|
|||
name.resize(15);
|
||||
}
|
||||
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, __LINE__);
|
||||
|
||||
pthread_setname_np(pthread_self(), name.c_str());
|
||||
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, "done");
|
||||
std::thread([&] {
|
||||
rx::thread::setupSignalStack();
|
||||
rx::thread::setupThisThread();
|
||||
ORBIS_LOG_ERROR(__FUNCTION__, "exec");
|
||||
ps4Exec(thread, executableModule, _argv, _envv);
|
||||
}).join();
|
||||
std::abort();
|
||||
|
|
|
|||
Loading…
Reference in a new issue