[orbis-kernel] do not use linker for exec

implement hdd device stub
implement /dev/console rw
remove dup2 hack
fix altstack after execve
This commit is contained in:
DH 2023-11-02 16:26:58 +03:00
parent 3464f50eb9
commit 3cb4baed51
11 changed files with 289 additions and 130 deletions

View file

@ -6,16 +6,12 @@ orbis::SysResult orbis::sys_getdtablesize(Thread *thread) {
return ErrorCode::NOSYS;
}
orbis::SysResult orbis::sys_dup2(Thread *thread, uint from, uint to) {
if (to == 1 || to == 2) { // HACK: ignore setup /dev/console to stdout/stderr
return {};
}
std::lock_guard lock(thread->tproc->fileDescriptors.mutex);
auto file = thread->tproc->fileDescriptors.get(from);
if (file == nullptr) {
return ErrorCode::BADF;
}
thread->tproc->fileDescriptors.close(to);
thread->tproc->fileDescriptors.insert(to, file);
return {};

View file

@ -60,6 +60,14 @@ orbis::SysResult orbis::sys_mtypeprotect(Thread *thread /* TODO */) {
orbis::SysResult orbis::sys_regmgr_call(Thread *thread, uint32_t op,
uint32_t id, ptr<void> result,
ptr<void> value, uint64_t type) {
ORBIS_LOG_ERROR(__FUNCTION__, op, id, type);
thread->where();
if (op == 2) {
if (id == 0x2010000) {
return uwrite((ptr<uint>)value, 0u);
}
}
if (op == 25) {
struct nonsys_int {
union {

View file

@ -8,8 +8,6 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
size_t newlen) {
enum sysctl_ctl { unspec, kern, vm, vfs, net, debug, hw, machdep, user };
// machdep.tsc_freq
enum sysctl_kern {
usrstack = 33,
kern_14 = 14,
@ -154,11 +152,14 @@ orbis::SysResult orbis::sys___sysctl(Thread *thread, ptr<sint> name,
auto result = uread(thread->tproc->appInfo, (ptr<AppInfo>)new_);
if (result == ErrorCode{}) {
auto appInfo = thread->tproc->appInfo;
auto &appInfo = thread->tproc->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);
// HACK
appInfo.unk4 = orbis::slong(0x80000000'00000000);
}
return result;