Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions core/libs/prx/libkernel/File/src/Stdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1581,9 +1581,8 @@ int APS5_VABI sceKernelFdatasync(int fd) {

int APS5_VABI sceKernelWriteThrottlingStatus(std::uint64_t* status) {
if (status == nullptr) return SceErrorFromErrno(GUEST_EINVAL);
const std::uint64_t values[4]{std::numeric_limits<std::uint32_t>::max(), 0, 0, 0};
if (!GuestCopyOut_nid_no_patch(status, values, sizeof(values))) return SceErrorFromErrno(GUEST_EFAULT);
return 0;
if (!GuestWritable_nid_no_patch(status, 4 * sizeof(*status))) return SceErrorFromErrno(GUEST_EFAULT);
return SCE_KERNEL_ERROR_ESRCH;
}

#ifdef _WIN32
Expand Down
4 changes: 2 additions & 2 deletions core/libs/tests/GuestFilesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ int main() {
Require(sceKernelStat(".", nullptr) == static_cast<int>(0x8002000eu));
Require(sceKernelDebugOutText(-1, "text") == static_cast<int>(0x80020016u));
std::uint64_t throttling[4] = {1, 2, 3, 4};
Require(sceKernelWriteThrottlingStatus(throttling) == 0);
Require(throttling[0] == 0xffffffffu && throttling[1] == 0 && throttling[2] == 0 && throttling[3] == 0);
Require(sceKernelWriteThrottlingStatus(throttling) == static_cast<int>(0x80020003u));
Require(throttling[0] == 1 && throttling[1] == 2 && throttling[2] == 3 && throttling[3] == 4);
Require(sceKernelWriteThrottlingStatus(nullptr) == static_cast<int>(0x80020016u));
Require(sceKernelWriteThrottlingStatus(reinterpret_cast<std::uint64_t*>(0x10)) == static_cast<int>(0x8002000eu));
Require(sceKernelDebugOutText(0, nullptr) == static_cast<int>(0x8002000eu));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# libkernel

## change [sceKernelWriteThrottlingStatus]

- [sceKernelWriteThrottlingStatus](../../../core/libs/prx/libkernel/File/src/Stdio.cpp) (libkernel) returns `ESRCH` (`0x80020003`) for a valid 32-byte status buffer and leaves all four qwords untouched, as a payload process on a PS5 (firmware 11.60) did. A null status pointer returns `EINVAL` (`0x80020016`), also as measured there. An unwritable non-null buffer returns `EFAULT` (`0x8002000e`) through a non-mutating guest writeability check as a host-safety fallback; console fault behaviour and title-process behaviour are unmeasured. PPSA17221 reads only the first qword on success, but on failure assumes `0x4B000001` bytes, which selects the same highest write-budget tier as the previous host-defined `UINT32_MAX` success. What the hardware status value measures and the meanings of the other qwords remain unknown.
Loading