Skip to content

Commit

Permalink
orbis-kernel: implement vm.budgets.mlock_total
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Nov 13, 2024
1 parent 2bfdc6f commit 2f1c8e9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions orbis-kernel/src/sys/sys_sysctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SysResult kern_sysctl(Thread *thread, ptr<sint> name, uint namelen,
swap_avail = 1000,
swap_total,
kern_heap_size,
budgets,
};

enum sysctl_hw_config {
Expand Down Expand Up @@ -73,6 +74,10 @@ SysResult kern_sysctl(Thread *thread, ptr<sint> name, uint namelen,
updtfmt = 1000,
};

enum sysctl_vm_budgets_ {
mlock_total = 1000,
};

struct ProcInfo {
char data[0x448];
};
Expand Down Expand Up @@ -179,6 +184,15 @@ SysResult kern_sysctl(Thread *thread, ptr<sint> name, uint namelen,
*(uint32_t *)old = 0;
return {};
}

if (name[0] == vm && name[1] == budgets && name[2] == mlock_total) {
if (*oldlenp != 8 || new_ != nullptr || newlen != 0) {
return ErrorCode::INVAL;
}

*(uint64_t *)old = 5056ull * 1024 * 1024;
return {};
}
}

if (namelen == 4) {
Expand Down Expand Up @@ -495,6 +509,15 @@ SysResult kern_sysctl(Thread *thread, ptr<sint> name, uint namelen,

dest[count++] = machdep;
dest[count++] = sceKernelIsCavern;
} else if (searchName == "vm.budgets.mlock_total") {
if (*oldlenp < 3 * sizeof(uint32_t)) {
std::fprintf(stderr, " %s error\n", searchName.data());
return ErrorCode::INVAL;
}

dest[count++] = vm;
dest[count++] = budgets;
dest[count++] = mlock_total;
}

if (count == 0) {
Expand Down

0 comments on commit 2f1c8e9

Please sign in to comment.