sys_fs: yield PPU on disk access ops

This commit is contained in:
Nekotekina 2019-06-08 19:34:55 +03:00
parent e8a516529b
commit 2bc0ea37ab
3 changed files with 180 additions and 138 deletions

View file

@ -11,11 +11,9 @@
#include <mutex> #include <mutex>
LOG_CHANNEL(cellFs); LOG_CHANNEL(cellFs);
error_code cellFsGetPath(u32 fd, vm::ptr<char> out_path) error_code cellFsGetPath(ppu_thread& ppu, u32 fd, vm::ptr<char> out_path)
{ {
cellFs.trace("cellFsGetPath(fd=%d, out_path=*0x%x)", fd, out_path); cellFs.trace("cellFsGetPath(fd=%d, out_path=*0x%x)", fd, out_path);
@ -24,10 +22,10 @@ error_code cellFsGetPath(u32 fd, vm::ptr<char> out_path)
return CELL_EFAULT; return CELL_EFAULT;
} }
return sys_fs_test(6, 0, vm::var<u32>{fd}, sizeof(u32), out_path, 0x420); return sys_fs_test(ppu, 6, 0, vm::var<u32>{fd}, sizeof(u32), out_path, 0x420);
} }
error_code cellFsOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size) error_code cellFsOpen(ppu_thread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size)
{ {
cellFs.trace("cellFsOpen(path=%s, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size); cellFs.trace("cellFsOpen(path=%s, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size);
@ -37,7 +35,7 @@ error_code cellFsOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<
} }
// TODO // TODO
return sys_fs_open(path, flags, fd, flags & CELL_FS_O_CREAT ? CELL_FS_S_IRUSR | CELL_FS_S_IWUSR : 0, arg, size); return sys_fs_open(ppu, path, flags, fd, flags & CELL_FS_O_CREAT ? CELL_FS_S_IRUSR | CELL_FS_S_IWUSR : 0, arg, size);
} }
error_code cellFsOpen2() error_code cellFsOpen2()
@ -46,7 +44,7 @@ error_code cellFsOpen2()
return CELL_OK; return CELL_OK;
} }
error_code cellFsSdataOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size) error_code cellFsSdataOpen(ppu_thread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size)
{ {
cellFs.trace("cellFsSdataOpen(path=%s, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size); cellFs.trace("cellFsSdataOpen(path=%s, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size);
@ -55,31 +53,31 @@ error_code cellFsSdataOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::
return CELL_EINVAL; return CELL_EINVAL;
} }
return cellFsOpen(path, CELL_FS_O_RDONLY, fd, vm::make_var<be_t<u32>[2]>({0x180, 0x10}), 8); return cellFsOpen(ppu, path, CELL_FS_O_RDONLY, fd, vm::make_var<be_t<u32>[2]>({0x180, 0x10}), 8);
} }
error_code cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread) error_code cellFsRead(ppu_thread& ppu, u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread)
{ {
cellFs.trace("cellFsRead(fd=0x%x, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread); cellFs.trace("cellFsRead(fd=0x%x, buf=0x%x, nbytes=0x%llx, nread=0x%x)", fd, buf, nbytes, nread);
return sys_fs_read(fd, buf, nbytes, nread ? nread : vm::var<u64>{}); return sys_fs_read(ppu, fd, buf, nbytes, nread ? nread : vm::var<u64>{});
} }
error_code cellFsWrite(u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite) error_code cellFsWrite(ppu_thread& ppu, u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite)
{ {
cellFs.trace("cellFsWrite(fd=0x%x, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite); cellFs.trace("cellFsWrite(fd=0x%x, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite);
return sys_fs_write(fd, buf, nbytes, nwrite ? nwrite : vm::var<u64>{}); return sys_fs_write(ppu, fd, buf, nbytes, nwrite ? nwrite : vm::var<u64>{});
} }
error_code cellFsClose(u32 fd) error_code cellFsClose(ppu_thread& ppu, u32 fd)
{ {
cellFs.trace("cellFsClose(fd=0x%x)", fd); cellFs.trace("cellFsClose(fd=0x%x)", fd);
return sys_fs_close(fd); return sys_fs_close(ppu, fd);
} }
error_code cellFsOpendir(vm::cptr<char> path, vm::ptr<u32> fd) error_code cellFsOpendir(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u32> fd)
{ {
cellFs.trace("cellFsOpendir(path=%s, fd=*0x%x)", path, fd); cellFs.trace("cellFsOpendir(path=%s, fd=*0x%x)", path, fd);
@ -89,10 +87,10 @@ error_code cellFsOpendir(vm::cptr<char> path, vm::ptr<u32> fd)
} }
// TODO // TODO
return sys_fs_opendir(path, fd); return sys_fs_opendir(ppu, path, fd);
} }
error_code cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread) error_code cellFsReaddir(ppu_thread& ppu, u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
{ {
cellFs.trace("cellFsReaddir(fd=0x%x, dir=*0x%x, nread=*0x%x)", fd, dir, nread); cellFs.trace("cellFsReaddir(fd=0x%x, dir=*0x%x, nread=*0x%x)", fd, dir, nread);
@ -101,17 +99,17 @@ error_code cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
return CELL_EFAULT; return CELL_EFAULT;
} }
return sys_fs_readdir(fd, dir, nread); return sys_fs_readdir(ppu, fd, dir, nread);
} }
error_code cellFsClosedir(u32 fd) error_code cellFsClosedir(ppu_thread& ppu, u32 fd)
{ {
cellFs.trace("cellFsClosedir(fd=0x%x)", fd); cellFs.trace("cellFsClosedir(fd=0x%x)", fd);
return sys_fs_closedir(fd); return sys_fs_closedir(ppu, fd);
} }
error_code cellFsStat(vm::cptr<char> path, vm::ptr<CellFsStat> sb) error_code cellFsStat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat> sb)
{ {
cellFs.trace("cellFsStat(path=%s, sb=*0x%x)", path, sb); cellFs.trace("cellFsStat(path=%s, sb=*0x%x)", path, sb);
@ -121,14 +119,14 @@ error_code cellFsStat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
} }
// TODO // TODO
return sys_fs_stat(path, sb); return sys_fs_stat(ppu, path, sb);
} }
error_code cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb) error_code cellFsFstat(ppu_thread& ppu, u32 fd, vm::ptr<CellFsStat> sb)
{ {
cellFs.trace("cellFsFstat(fd=0x%x, sb=*0x%x)", fd, sb); cellFs.trace("cellFsFstat(fd=0x%x, sb=*0x%x)", fd, sb);
return sys_fs_fstat(fd, sb); return sys_fs_fstat(ppu, fd, sb);
} }
error_code cellFsLink() error_code cellFsLink()
@ -137,39 +135,39 @@ error_code cellFsLink()
return CELL_OK; return CELL_OK;
} }
error_code cellFsMkdir(vm::cptr<char> path, s32 mode) error_code cellFsMkdir(ppu_thread& ppu, vm::cptr<char> path, s32 mode)
{ {
cellFs.trace("cellFsMkdir(path=%s, mode=%#o)", path, mode); cellFs.trace("cellFsMkdir(path=%s, mode=%#o)", path, mode);
// TODO // TODO
return sys_fs_mkdir(path, mode); return sys_fs_mkdir(ppu, path, mode);
} }
error_code cellFsRename(vm::cptr<char> from, vm::cptr<char> to) error_code cellFsRename(ppu_thread& ppu, vm::cptr<char> from, vm::cptr<char> to)
{ {
cellFs.trace("cellFsRename(from=%s, to=%s)", from, to); cellFs.trace("cellFsRename(from=%s, to=%s)", from, to);
// TODO // TODO
return sys_fs_rename(from, to); return sys_fs_rename(ppu, from, to);
} }
error_code cellFsRmdir(vm::cptr<char> path) error_code cellFsRmdir(ppu_thread& ppu, vm::cptr<char> path)
{ {
cellFs.trace("cellFsRmdir(path=%s)", path); cellFs.trace("cellFsRmdir(path=%s)", path);
// TODO // TODO
return sys_fs_rmdir(path); return sys_fs_rmdir(ppu, path);
} }
error_code cellFsUnlink(vm::cptr<char> path) error_code cellFsUnlink(ppu_thread& ppu, vm::cptr<char> path)
{ {
cellFs.trace("cellFsUnlink(path=%s)", path); cellFs.trace("cellFsUnlink(path=%s)", path);
// TODO // TODO
return sys_fs_unlink(path); return sys_fs_unlink(ppu, path);
} }
error_code cellFsUtime(vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep) error_code cellFsUtime(ppu_thread& ppu, vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep)
{ {
cellFs.trace("cellFsUtime(path=%s, timep=*0x%x)", path, timep); cellFs.trace("cellFsUtime(path=%s, timep=*0x%x)", path, timep);
@ -179,7 +177,7 @@ error_code cellFsUtime(vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep)
} }
// TODO // TODO
return sys_fs_utime(path, timep); return sys_fs_utime(ppu, path, timep);
} }
error_code cellFsAccess() error_code cellFsAccess()
@ -194,7 +192,7 @@ error_code cellFsFcntl()
return CELL_OK; return CELL_OK;
} }
error_code cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<u64> pos) error_code cellFsLseek(ppu_thread& ppu, u32 fd, s64 offset, u32 whence, vm::ptr<u64> pos)
{ {
cellFs.trace("cellFsLseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos); cellFs.trace("cellFsLseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos);
@ -203,7 +201,7 @@ error_code cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<u64> pos)
return CELL_EFAULT; return CELL_EFAULT;
} }
return sys_fs_lseek(fd, offset, whence, pos); return sys_fs_lseek(ppu, fd, offset, whence, pos);
} }
error_code cellFsFdatasync(ppu_thread& ppu, u32 fd) error_code cellFsFdatasync(ppu_thread& ppu, u32 fd)
@ -220,7 +218,7 @@ error_code cellFsFsync(ppu_thread& ppu, u32 fd)
return sys_fs_fsync(ppu, fd); return sys_fs_fsync(ppu, fd);
} }
error_code cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size) error_code cellFsFGetBlockSize(ppu_thread& ppu, u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
cellFs.trace("cellFsFGetBlockSize(fd=0x%x, sector_size=*0x%x, block_size=*0x%x)", fd, sector_size, block_size); cellFs.trace("cellFsFGetBlockSize(fd=0x%x, sector_size=*0x%x, block_size=*0x%x)", fd, sector_size, block_size);
@ -229,7 +227,7 @@ error_code cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> bl
return CELL_EFAULT; return CELL_EFAULT;
} }
return sys_fs_fget_block_size(fd, sector_size, block_size, vm::var<u64>{}, vm::var<s32>{}); return sys_fs_fget_block_size(ppu, fd, sector_size, block_size, vm::var<u64>{}, vm::var<s32>{});
} }
error_code cellFsFGetBlockSize2() error_code cellFsFGetBlockSize2()
@ -238,7 +236,7 @@ error_code cellFsFGetBlockSize2()
return CELL_OK; return CELL_OK;
} }
error_code cellFsGetBlockSize(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size) error_code cellFsGetBlockSize(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
cellFs.trace("cellFsGetBlockSize(path=%s, sector_size=*0x%x, block_size=*0x%x)", path, sector_size, block_size); cellFs.trace("cellFsGetBlockSize(path=%s, sector_size=*0x%x, block_size=*0x%x)", path, sector_size, block_size);
@ -248,7 +246,7 @@ error_code cellFsGetBlockSize(vm::cptr<char> path, vm::ptr<u64> sector_size, vm:
} }
// TODO // TODO
return sys_fs_get_block_size(path, sector_size, block_size, vm::var<u64>{}); return sys_fs_get_block_size(ppu, path, sector_size, block_size, vm::var<u64>{});
} }
error_code cellFsGetBlockSize2() error_code cellFsGetBlockSize2()
@ -305,19 +303,19 @@ error_code cellFsLsnRead2()
return CELL_OK; return CELL_OK;
} }
error_code cellFsTruncate(vm::cptr<char> path, u64 size) error_code cellFsTruncate(ppu_thread& ppu, vm::cptr<char> path, u64 size)
{ {
cellFs.trace("cellFsTruncate(path=%s, size=0x%llx)", path, size); cellFs.trace("cellFsTruncate(path=%s, size=0x%llx)", path, size);
// TODO // TODO
return sys_fs_truncate(path, size); return sys_fs_truncate(ppu, path, size);
} }
error_code cellFsFtruncate(u32 fd, u64 size) error_code cellFsFtruncate(ppu_thread& ppu, u32 fd, u64 size)
{ {
cellFs.trace("cellFsFtruncate(fd=0x%x, size=0x%llx)", fd, size); cellFs.trace("cellFsFtruncate(fd=0x%x, size=0x%llx)", fd, size);
return sys_fs_ftruncate(fd, size); return sys_fs_ftruncate(ppu, fd, size);
} }
error_code cellFsSymbolicLink() error_code cellFsSymbolicLink()
@ -326,12 +324,12 @@ error_code cellFsSymbolicLink()
return CELL_OK; return CELL_OK;
} }
error_code cellFsChmod(vm::cptr<char> path, s32 mode) error_code cellFsChmod(ppu_thread& ppu, vm::cptr<char> path, s32 mode)
{ {
cellFs.trace("cellFsChmod(path=%s, mode=%#o)", path, mode); cellFs.trace("cellFsChmod(path=%s, mode=%#o)", path, mode);
// TODO // TODO
return sys_fs_chmod(path, mode); return sys_fs_chmod(ppu, path, mode);
} }
error_code cellFsChown() error_code cellFsChown()
@ -340,7 +338,7 @@ error_code cellFsChown()
return CELL_OK; return CELL_OK;
} }
error_code cellFsGetFreeSize(vm::cptr<char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count) error_code cellFsGetFreeSize(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count)
{ {
cellFs.todo("cellFsGetFreeSize(path=%s, block_size=*0x%x, block_count=*0x%x)", path, block_size, block_count); cellFs.todo("cellFsGetFreeSize(path=%s, block_size=*0x%x, block_count=*0x%x)", path, block_size, block_count);
@ -384,7 +382,7 @@ error_code cellFsTruncate2()
return CELL_OK; return CELL_OK;
} }
error_code cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count) error_code cellFsGetDirectoryEntries(ppu_thread& ppu, u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32 entries_size, vm::ptr<u32> data_count)
{ {
cellFs.trace("cellFsGetDirectoryEntries(fd=%d, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count); cellFs.trace("cellFsGetDirectoryEntries(fd=%d, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count);
@ -408,7 +406,7 @@ error_code cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entri
op->arg.ptr = entries; op->arg.ptr = entries;
op->arg.max = entries_size / sizeof(CellFsDirectoryEntry); op->arg.max = entries_size / sizeof(CellFsDirectoryEntry);
const s32 rc = sys_fs_fcntl(fd, 0xe0000012, op.ptr(&lv2_file_op_dir::arg), 0x10); const s32 rc = sys_fs_fcntl(ppu, fd, 0xe0000012, op.ptr(&lv2_file_op_dir::arg), 0x10);
*data_count = op->arg._size; *data_count = op->arg._size;
@ -420,7 +418,7 @@ error_code cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entri
return not_an_error(rc); return not_an_error(rc);
} }
error_code cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size, vm::ptr<u64> nread) error_code cellFsReadWithOffset(ppu_thread& ppu, u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size, vm::ptr<u64> nread)
{ {
cellFs.trace("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, buffer_size=0x%llx, nread=*0x%x)", fd, offset, buf, buffer_size, nread); cellFs.trace("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, buffer_size=0x%llx, nread=*0x%x)", fd, offset, buf, buffer_size, nread);
@ -440,7 +438,7 @@ error_code cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr<void> buf, u64 buffe
arg->offset = offset; arg->offset = offset;
arg->size = buffer_size; arg->size = buffer_size;
const s32 rc = sys_fs_fcntl(fd, 0x8000000a, arg, arg.size()); const s32 rc = sys_fs_fcntl(ppu, fd, 0x8000000a, arg, arg.size());
// Write size read // Write size read
if (nread) if (nread)
@ -456,7 +454,7 @@ error_code cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr<void> buf, u64 buffe
return not_an_error(rc); return not_an_error(rc);
} }
error_code cellFsWriteWithOffset(u32 fd, u64 offset, vm::cptr<void> buf, u64 data_size, vm::ptr<u64> nwrite) error_code cellFsWriteWithOffset(ppu_thread& ppu, u32 fd, u64 offset, vm::cptr<void> buf, u64 data_size, vm::ptr<u64> nwrite)
{ {
cellFs.trace("cellFsWriteWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, data_size=0x%llx, nwrite=*0x%x)", fd, offset, buf, data_size, nwrite); cellFs.trace("cellFsWriteWithOffset(fd=%d, offset=0x%llx, buf=*0x%x, data_size=0x%llx, nwrite=*0x%x)", fd, offset, buf, data_size, nwrite);
@ -482,7 +480,7 @@ error_code cellFsWriteWithOffset(u32 fd, u64 offset, vm::cptr<void> buf, u64 dat
arg->offset = offset; arg->offset = offset;
arg->size = data_size; arg->size = data_size;
const s32 rc = sys_fs_fcntl(fd, 0x8000000b, arg, arg.size()); const s32 rc = sys_fs_fcntl(ppu, fd, 0x8000000b, arg, arg.size());
// Write size written // Write size written
if (nwrite) if (nwrite)
@ -498,7 +496,7 @@ error_code cellFsWriteWithOffset(u32 fd, u64 offset, vm::cptr<void> buf, u64 dat
return not_an_error(rc); return not_an_error(rc);
} }
error_code cellFsSdataOpenByFd(u32 mself_fd, s32 flags, vm::ptr<u32> sdata_fd, u64 offset, vm::cptr<void> arg, u64 size) error_code cellFsSdataOpenByFd(ppu_thread& ppu, u32 mself_fd, s32 flags, vm::ptr<u32> sdata_fd, u64 offset, vm::cptr<void> arg, u64 size)
{ {
cellFs.trace("cellFsSdataOpenByFd(mself_fd=0x%x, flags=%#o, sdata_fd=*0x%x, offset=0x%llx, arg=*0x%x, size=0x%llx)", mself_fd, flags, sdata_fd, offset, arg, size); cellFs.trace("cellFsSdataOpenByFd(mself_fd=0x%x, flags=%#o, sdata_fd=*0x%x, offset=0x%llx, arg=*0x%x, size=0x%llx)", mself_fd, flags, sdata_fd, offset, arg, size);
@ -530,7 +528,7 @@ error_code cellFsSdataOpenByFd(u32 mself_fd, s32 flags, vm::ptr<u32> sdata_fd, u
ctrl->arg_ptr = arg.addr(); ctrl->arg_ptr = arg.addr();
ctrl->arg_size = u32(size); ctrl->arg_size = u32(size);
if (const s32 rc = sys_fs_fcntl(mself_fd, 0x80000009, ctrl, 0x40)) if (const s32 rc = sys_fs_fcntl(ppu, mself_fd, 0x80000009, ctrl, 0x40))
{ {
return not_an_error(rc); return not_an_error(rc);
} }
@ -601,7 +599,7 @@ error_code cellFsAllocateFileAreaByFdWithInitialData()
return CELL_OK; return CELL_OK;
} }
error_code cellFsAllocateFileAreaWithoutZeroFill(vm::cptr<char> path, u64 size) error_code cellFsAllocateFileAreaWithoutZeroFill(ppu_thread& ppu, vm::cptr<char> path, u64 size)
{ {
cellFs.trace("cellFsAllocateFileAreaWithoutZeroFill(path=%s, size=0x%llx)", path, size); cellFs.trace("cellFsAllocateFileAreaWithoutZeroFill(path=%s, size=0x%llx)", path, size);
@ -620,7 +618,7 @@ error_code cellFsAllocateFileAreaWithoutZeroFill(vm::cptr<char> path, u64 size)
ctrl->out_code = CELL_ENOSYS; ctrl->out_code = CELL_ENOSYS;
// TODO // TODO
if (s32 rc = sys_fs_fcntl(-1, 0xe0000017, ctrl, ctrl->size)) if (s32 rc = sys_fs_fcntl(ppu, -1, 0xe0000017, ctrl, ctrl->size))
{ {
return not_an_error(rc); return not_an_error(rc);
} }

View file

@ -10,8 +10,6 @@
#include "Emu/IdManager.h" #include "Emu/IdManager.h"
#include "Utilities/StrUtil.h" #include "Utilities/StrUtil.h"
LOG_CHANNEL(sys_fs); LOG_CHANNEL(sys_fs);
struct lv2_fs_mount_point struct lv2_fs_mount_point
@ -156,7 +154,7 @@ fs::file lv2_file::make_view(const std::shared_ptr<lv2_file>& _file, u64 offset)
return result; return result;
} }
error_code sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> buf, u32 buf_size) error_code sys_fs_test(ppu_thread& ppu, u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> buf, u32 buf_size)
{ {
sys_fs.trace("sys_fs_test(arg1=0x%x, arg2=0x%x, arg3=*0x%x, arg4=0x%x, buf=*0x%x, buf_size=0x%x)", arg1, arg2, arg3, arg4, buf, buf_size); sys_fs.trace("sys_fs_test(arg1=0x%x, arg2=0x%x, arg3=*0x%x, arg4=0x%x, buf=*0x%x, buf_size=0x%x)", arg1, arg2, arg3, arg4, buf, buf_size);
@ -189,8 +187,10 @@ error_code sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size) error_code sys_fs_open(ppu_thread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_open(path=%s, flags=%#o, fd=*0x%x, mode=%#o, arg=*0x%x, size=0x%llx)", path, flags, fd, mode, arg, size); sys_fs.warning("sys_fs_open(path=%s, flags=%#o, fd=*0x%x, mode=%#o, arg=*0x%x, size=0x%llx)", path, flags, fd, mode, arg, size);
if (!path) if (!path)
@ -379,8 +379,10 @@ error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode
return {CELL_EMFILE, path}; return {CELL_EMFILE, path};
} }
error_code sys_fs_read(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread) error_code sys_fs_read(ppu_thread& ppu, u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread)
{ {
lv2_obj::sleep(ppu);
sys_fs.trace("sys_fs_read(fd=%d, buf=*0x%x, nbytes=0x%llx, nread=*0x%x)", fd, buf, nbytes, nread); sys_fs.trace("sys_fs_read(fd=%d, buf=*0x%x, nbytes=0x%llx, nread=*0x%x)", fd, buf, nbytes, nread);
if (!buf) if (!buf)
@ -402,8 +404,10 @@ error_code sys_fs_read(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_write(u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite) error_code sys_fs_write(ppu_thread& ppu, u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite)
{ {
lv2_obj::sleep(ppu);
sys_fs.trace("sys_fs_write(fd=%d, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite); sys_fs.trace("sys_fs_write(fd=%d, buf=*0x%x, nbytes=0x%llx, nwrite=*0x%x)", fd, buf, nbytes, nwrite);
const auto file = idm::get<lv2_fs_object, lv2_file>(fd); const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
@ -425,8 +429,10 @@ error_code sys_fs_write(u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwr
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_close(u32 fd) error_code sys_fs_close(ppu_thread& ppu, u32 fd)
{ {
lv2_obj::sleep(ppu);
sys_fs.trace("sys_fs_close(fd=%d)", fd); sys_fs.trace("sys_fs_close(fd=%d)", fd);
const auto file = idm::withdraw<lv2_fs_object, lv2_file>(fd, [](lv2_file& file) -> CellError const auto file = idm::withdraw<lv2_fs_object, lv2_file>(fd, [](lv2_file& file) -> CellError
@ -452,8 +458,10 @@ error_code sys_fs_close(u32 fd)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd) error_code sys_fs_opendir(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u32> fd)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_opendir(path=%s, fd=*0x%x)", path, fd); sys_fs.warning("sys_fs_opendir(path=%s, fd=*0x%x)", path, fd);
if (!path) if (!path)
@ -560,8 +568,10 @@ error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd)
return CELL_EMFILE; return CELL_EMFILE;
} }
error_code sys_fs_readdir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread) error_code sys_fs_readdir(ppu_thread& ppu, u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_readdir(fd=%d, dir=*0x%x, nread=*0x%x)", fd, dir, nread); sys_fs.warning("sys_fs_readdir(fd=%d, dir=*0x%x, nread=*0x%x)", fd, dir, nread);
const auto directory = idm::get<lv2_fs_object, lv2_dir>(fd); const auto directory = idm::get<lv2_fs_object, lv2_dir>(fd);
@ -586,8 +596,10 @@ error_code sys_fs_readdir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_closedir(u32 fd) error_code sys_fs_closedir(ppu_thread& ppu, u32 fd)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_closedir(fd=%d)", fd); sys_fs.warning("sys_fs_closedir(fd=%d)", fd);
const auto directory = idm::get<lv2_fs_object, lv2_dir>(fd); const auto directory = idm::get<lv2_fs_object, lv2_dir>(fd);
@ -602,8 +614,10 @@ error_code sys_fs_closedir(u32 fd)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb) error_code sys_fs_stat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat> sb)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_stat(path=%s, sb=*0x%x)", path, sb); sys_fs.warning("sys_fs_stat(path=%s, sb=*0x%x)", path, sb);
if (!path) if (!path)
@ -681,8 +695,10 @@ error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_fstat(u32 fd, vm::ptr<CellFsStat> sb) error_code sys_fs_fstat(ppu_thread& ppu, u32 fd, vm::ptr<CellFsStat> sb)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_fstat(fd=%d, sb=*0x%x)", fd, sb); sys_fs.warning("sys_fs_fstat(fd=%d, sb=*0x%x)", fd, sb);
const auto file = idm::get<lv2_fs_object, lv2_file>(fd); const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
@ -708,15 +724,17 @@ error_code sys_fs_fstat(u32 fd, vm::ptr<CellFsStat> sb)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_link(vm::cptr<char> from, vm::cptr<char> to) error_code sys_fs_link(ppu_thread& ppu, vm::cptr<char> from, vm::cptr<char> to)
{ {
sys_fs.todo("sys_fs_link(from=%s, to=%s)", from, to); sys_fs.todo("sys_fs_link(from=%s, to=%s)", from, to);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_mkdir(vm::cptr<char> path, s32 mode) error_code sys_fs_mkdir(ppu_thread& ppu, vm::cptr<char> path, s32 mode)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_mkdir(path=%s, mode=%#o)", path, mode); sys_fs.warning("sys_fs_mkdir(path=%s, mode=%#o)", path, mode);
if (!path) if (!path)
@ -754,8 +772,10 @@ error_code sys_fs_mkdir(vm::cptr<char> path, s32 mode)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_rename(vm::cptr<char> from, vm::cptr<char> to) error_code sys_fs_rename(ppu_thread& ppu, vm::cptr<char> from, vm::cptr<char> to)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_rename(from=%s, to=%s)", from, to); sys_fs.warning("sys_fs_rename(from=%s, to=%s)", from, to);
const std::string_view vfrom = from.get_ptr(); const std::string_view vfrom = from.get_ptr();
@ -790,8 +810,10 @@ error_code sys_fs_rename(vm::cptr<char> from, vm::cptr<char> to)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_rmdir(vm::cptr<char> path) error_code sys_fs_rmdir(ppu_thread& ppu, vm::cptr<char> path)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_rmdir(path=%s)", path); sys_fs.warning("sys_fs_rmdir(path=%s)", path);
if (!path) if (!path)
@ -829,8 +851,10 @@ error_code sys_fs_rmdir(vm::cptr<char> path)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_unlink(vm::cptr<char> path) error_code sys_fs_unlink(ppu_thread& ppu, vm::cptr<char> path)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_unlink(path=%s)", path); sys_fs.warning("sys_fs_unlink(path=%s)", path);
if (!path) if (!path)
@ -872,14 +896,14 @@ error_code sys_fs_unlink(vm::cptr<char> path)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_access(vm::cptr<char> path, s32 mode) error_code sys_fs_access(ppu_thread& ppu, vm::cptr<char> path, s32 mode)
{ {
sys_fs.todo("sys_fs_access(path=%s, mode=%#o)", path, mode); sys_fs.todo("sys_fs_access(path=%s, mode=%#o)", path, mode);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size) error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
{ {
sys_fs.trace("sys_fs_fcntl(fd=%d, op=0x%x, arg=*0x%x, size=0x%x)", fd, op, _arg, _size); sys_fs.trace("sys_fs_fcntl(fd=%d, op=0x%x, arg=*0x%x, size=0x%x)", fd, op, _arg, _size);
@ -903,6 +927,8 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
case 0x8000000a: // cellFsReadWithOffset case 0x8000000a: // cellFsReadWithOffset
case 0x8000000b: // cellFsWriteWithOffset case 0x8000000b: // cellFsWriteWithOffset
{ {
lv2_obj::sleep(ppu);
const auto arg = vm::static_ptr_cast<lv2_file_op_rw>(_arg); const auto arg = vm::static_ptr_cast<lv2_file_op_rw>(_arg);
if (_size < arg.size()) if (_size < arg.size())
@ -949,6 +975,8 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
case 0x80000009: // cellFsSdataOpenByFd case 0x80000009: // cellFsSdataOpenByFd
{ {
lv2_obj::sleep(ppu);
const auto arg = vm::static_ptr_cast<lv2_file_op_09>(_arg); const auto arg = vm::static_ptr_cast<lv2_file_op_09>(_arg);
if (_size < arg.size()) if (_size < arg.size())
@ -985,6 +1013,8 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
case 0xc0000002: // cellFsGetFreeSize (TODO) case 0xc0000002: // cellFsGetFreeSize (TODO)
{ {
lv2_obj::sleep(ppu);
const auto arg = vm::static_ptr_cast<lv2_file_c0000002>(_arg); const auto arg = vm::static_ptr_cast<lv2_file_c0000002>(_arg);
const std::string_view vpath = arg->path.get_ptr(); const std::string_view vpath = arg->path.get_ptr();
@ -1147,6 +1177,8 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
case 0xe0000012: // cellFsGetDirectoryEntries case 0xe0000012: // cellFsGetDirectoryEntries
{ {
lv2_obj::sleep(ppu);
const auto arg = vm::static_ptr_cast<lv2_file_op_dir::dir_info>(_arg); const auto arg = vm::static_ptr_cast<lv2_file_op_dir::dir_info>(_arg);
if (_size < arg.size()) if (_size < arg.size())
@ -1209,7 +1241,7 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
return CELL_EINVAL; return CELL_EINVAL;
} }
arg->out_code = sys_fs_truncate(arg->file_path, arg->file_size); arg->out_code = sys_fs_truncate(ppu, arg->file_path, arg->file_size);
return CELL_OK; return CELL_OK;
} }
@ -1258,8 +1290,10 @@ error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> _arg, u32 _size)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos) error_code sys_fs_lseek(ppu_thread& ppu, u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos)
{ {
lv2_obj::sleep(ppu);
sys_fs.trace("sys_fs_lseek(fd=%d, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos); sys_fs.trace("sys_fs_lseek(fd=%d, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos);
if (whence >= 3) if (whence >= 3)
@ -1295,6 +1329,8 @@ error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos)
error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd) error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd)
{ {
lv2_obj::sleep(ppu);
sys_fs.trace("sys_fs_fdadasync(fd=%d)", fd); sys_fs.trace("sys_fs_fdadasync(fd=%d)", fd);
const auto file = idm::get<lv2_fs_object, lv2_file>(fd); const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
@ -1304,13 +1340,14 @@ error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd)
return CELL_EBADF; return CELL_EBADF;
} }
lv2_obj::sleep(ppu);
file->file.sync(); file->file.sync();
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_fsync(ppu_thread& ppu, u32 fd) error_code sys_fs_fsync(ppu_thread& ppu, u32 fd)
{ {
lv2_obj::sleep(ppu);
sys_fs.trace("sys_fs_fsync(fd=%d)", fd); sys_fs.trace("sys_fs_fsync(fd=%d)", fd);
const auto file = idm::get<lv2_fs_object, lv2_file>(fd); const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
@ -1320,12 +1357,11 @@ error_code sys_fs_fsync(ppu_thread& ppu, u32 fd)
return CELL_EBADF; return CELL_EBADF;
} }
lv2_obj::sleep(ppu);
file->file.sync(); file->file.sync();
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4, vm::ptr<s32> arg5) error_code sys_fs_fget_block_size(ppu_thread& ppu, u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4, vm::ptr<s32> arg5)
{ {
sys_fs.warning("sys_fs_fget_block_size(fd=%d, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", fd, sector_size, block_size, arg4, arg5); sys_fs.warning("sys_fs_fget_block_size(fd=%d, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", fd, sector_size, block_size, arg4, arg5);
@ -1345,7 +1381,7 @@ error_code sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64>
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_get_block_size(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4) error_code sys_fs_get_block_size(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4)
{ {
sys_fs.warning("sys_fs_get_block_size(path=%s, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", path, sector_size, block_size, arg4); sys_fs.warning("sys_fs_get_block_size(path=%s, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", path, sector_size, block_size, arg4);
@ -1357,8 +1393,10 @@ error_code sys_fs_get_block_size(vm::cptr<char> path, vm::ptr<u64> sector_size,
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_truncate(vm::cptr<char> path, u64 size) error_code sys_fs_truncate(ppu_thread& ppu, vm::cptr<char> path, u64 size)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_truncate(path=%s, size=0x%llx)", path, size); sys_fs.warning("sys_fs_truncate(path=%s, size=0x%llx)", path, size);
if (!path) if (!path)
@ -1394,8 +1432,10 @@ error_code sys_fs_truncate(vm::cptr<char> path, u64 size)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_ftruncate(u32 fd, u64 size) error_code sys_fs_ftruncate(ppu_thread& ppu, u32 fd, u64 size)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_ftruncate(fd=%d, size=0x%llx)", fd, size); sys_fs.warning("sys_fs_ftruncate(fd=%d, size=0x%llx)", fd, size);
const auto file = idm::get<lv2_fs_object, lv2_file>(fd); const auto file = idm::get<lv2_fs_object, lv2_file>(fd);
@ -1435,29 +1475,31 @@ error_code sys_fs_ftruncate(u32 fd, u64 size)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_symbolic_link(vm::cptr<char> target, vm::cptr<char> linkpath) error_code sys_fs_symbolic_link(ppu_thread& ppu, vm::cptr<char> target, vm::cptr<char> linkpath)
{ {
sys_fs.todo("sys_fs_symbolic_link(target=%s, linkpath=%s)", target, linkpath); sys_fs.todo("sys_fs_symbolic_link(target=%s, linkpath=%s)", target, linkpath);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_chmod(vm::cptr<char> path, s32 mode) error_code sys_fs_chmod(ppu_thread& ppu, vm::cptr<char> path, s32 mode)
{ {
sys_fs.todo("sys_fs_chmod(path=%s, mode=%#o)", path, mode); sys_fs.todo("sys_fs_chmod(path=%s, mode=%#o)", path, mode);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_chown(vm::cptr<char> path, s32 uid, s32 gid) error_code sys_fs_chown(ppu_thread& ppu, vm::cptr<char> path, s32 uid, s32 gid)
{ {
sys_fs.todo("sys_fs_chown(path=%s, uid=%d, gid=%d)", path, uid, gid); sys_fs.todo("sys_fs_chown(path=%s, uid=%d, gid=%d)", path, uid, gid);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_disk_free(vm::cptr<char> path, vm::ptr<u64> total_free, vm::ptr<u64> avail_free) error_code sys_fs_disk_free(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u64> total_free, vm::ptr<u64> avail_free)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_disk_free(path=%s total_free=*0x%x avail_free=*0x%x)", path, total_free, avail_free); sys_fs.warning("sys_fs_disk_free(path=%s total_free=*0x%x avail_free=*0x%x)", path, total_free, avail_free);
if (!path) if (!path)
@ -1497,8 +1539,10 @@ error_code sys_fs_disk_free(vm::cptr<char> path, vm::ptr<u64> total_free, vm::pt
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_utime(vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep) error_code sys_fs_utime(ppu_thread& ppu, vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep)
{ {
lv2_obj::sleep(ppu);
sys_fs.warning("sys_fs_utime(path=%s, timep=*0x%x)", path, timep); sys_fs.warning("sys_fs_utime(path=%s, timep=*0x%x)", path, timep);
sys_fs.warning("** actime=%u, modtime=%u", timep->actime, timep->modtime); sys_fs.warning("** actime=%u, modtime=%u", timep->actime, timep->modtime);
@ -1535,21 +1579,21 @@ error_code sys_fs_utime(vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_acl_read(vm::cptr<char> path, vm::ptr<void> ptr) error_code sys_fs_acl_read(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<void> ptr)
{ {
sys_fs.todo("sys_fs_acl_read(path=%s, ptr=*0x%x)", path, ptr); sys_fs.todo("sys_fs_acl_read(path=%s, ptr=*0x%x)", path, ptr);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_acl_write(vm::cptr<char> path, vm::ptr<void> ptr) error_code sys_fs_acl_write(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<void> ptr)
{ {
sys_fs.todo("sys_fs_acl_write(path=%s, ptr=*0x%x)", path, ptr); sys_fs.todo("sys_fs_acl_write(path=%s, ptr=*0x%x)", path, ptr);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lsn_get_cda_size(u32 fd, vm::ptr<u64> ptr) error_code sys_fs_lsn_get_cda_size(ppu_thread& ppu, u32 fd, vm::ptr<u64> ptr)
{ {
sys_fs.warning("sys_fs_lsn_get_cda_size(fd=%d, ptr=*0x%x)", fd, ptr); sys_fs.warning("sys_fs_lsn_get_cda_size(fd=%d, ptr=*0x%x)", fd, ptr);
@ -1565,14 +1609,14 @@ error_code sys_fs_lsn_get_cda_size(u32 fd, vm::ptr<u64> ptr)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lsn_get_cda(u32 fd, vm::ptr<void> arg2, u64 arg3, vm::ptr<u64> arg4) error_code sys_fs_lsn_get_cda(ppu_thread& ppu, u32 fd, vm::ptr<void> arg2, u64 arg3, vm::ptr<u64> arg4)
{ {
sys_fs.todo("sys_fs_lsn_get_cda(fd=%d, arg2=*0x%x, arg3=0x%x, arg4=*0x%x)", fd, arg2, arg3, arg4); sys_fs.todo("sys_fs_lsn_get_cda(fd=%d, arg2=*0x%x, arg3=0x%x, arg4=*0x%x)", fd, arg2, arg3, arg4);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lsn_lock(u32 fd) error_code sys_fs_lsn_lock(ppu_thread& ppu, u32 fd)
{ {
sys_fs.trace("sys_fs_lsn_lock(fd=%d)", fd); sys_fs.trace("sys_fs_lsn_lock(fd=%d)", fd);
@ -1592,7 +1636,7 @@ error_code sys_fs_lsn_lock(u32 fd)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lsn_unlock(u32 fd) error_code sys_fs_lsn_unlock(ppu_thread& ppu, u32 fd)
{ {
sys_fs.trace("sys_fs_lsn_unlock(fd=%d)", fd); sys_fs.trace("sys_fs_lsn_unlock(fd=%d)", fd);
@ -1612,35 +1656,35 @@ error_code sys_fs_lsn_unlock(u32 fd)
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lsn_read(u32 fd, vm::cptr<void> ptr, u64 size) error_code sys_fs_lsn_read(ppu_thread& ppu, u32 fd, vm::cptr<void> ptr, u64 size)
{ {
sys_fs.todo("sys_fs_lsn_read(fd=%d, ptr=*0x%x, size=0x%x)", fd, ptr, size); sys_fs.todo("sys_fs_lsn_read(fd=%d, ptr=*0x%x, size=0x%x)", fd, ptr, size);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_lsn_write(u32 fd, vm::cptr<void> ptr, u64 size) error_code sys_fs_lsn_write(ppu_thread& ppu, u32 fd, vm::cptr<void> ptr, u64 size)
{ {
sys_fs.todo("sys_fs_lsn_write(fd=%d, ptr=*0x%x, size=0x%x)", fd, ptr, size); sys_fs.todo("sys_fs_lsn_write(fd=%d, ptr=*0x%x, size=0x%x)", fd, ptr, size);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_mapped_allocate(u32 fd, u64 size, vm::pptr<void> out_ptr) error_code sys_fs_mapped_allocate(ppu_thread& ppu, u32 fd, u64 size, vm::pptr<void> out_ptr)
{ {
sys_fs.todo("sys_fs_mapped_allocate(fd=%d, arg2=0x%x, out_ptr=**0x%x)", fd, size, out_ptr); sys_fs.todo("sys_fs_mapped_allocate(fd=%d, arg2=0x%x, out_ptr=**0x%x)", fd, size, out_ptr);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_mapped_free(u32 fd, vm::ptr<void> ptr) error_code sys_fs_mapped_free(ppu_thread& ppu, u32 fd, vm::ptr<void> ptr)
{ {
sys_fs.todo("sys_fs_mapped_free(fd=%d, ptr=0x%#x)", fd, ptr); sys_fs.todo("sys_fs_mapped_free(fd=%d, ptr=0x%#x)", fd, ptr);
return CELL_OK; return CELL_OK;
} }
error_code sys_fs_truncate2(u32 fd, u64 size) error_code sys_fs_truncate2(ppu_thread& ppu, u32 fd, u64 size)
{ {
sys_fs.todo("sys_fs_truncate2(fd=%d, size=0x%x)", fd, size); sys_fs.todo("sys_fs_truncate2(fd=%d, size=0x%x)", fd, size);

View file

@ -356,43 +356,43 @@ CHECK_SIZE(lv2_file_e0000017, 0x28);
// Syscalls // Syscalls
error_code sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> buf, u32 buf_size); error_code sys_fs_test(ppu_thread& ppu, u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> buf, u32 buf_size);
error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size); error_code sys_fs_open(ppu_thread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size);
error_code sys_fs_read(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread); error_code sys_fs_read(ppu_thread& ppu, u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread);
error_code sys_fs_write(u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite); error_code sys_fs_write(ppu_thread& ppu, u32 fd, vm::cptr<void> buf, u64 nbytes, vm::ptr<u64> nwrite);
error_code sys_fs_close(u32 fd); error_code sys_fs_close(ppu_thread& ppu, u32 fd);
error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd); error_code sys_fs_opendir(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u32> fd);
error_code sys_fs_readdir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread); error_code sys_fs_readdir(ppu_thread& ppu, u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread);
error_code sys_fs_closedir(u32 fd); error_code sys_fs_closedir(ppu_thread& ppu, u32 fd);
error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb); error_code sys_fs_stat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat> sb);
error_code sys_fs_fstat(u32 fd, vm::ptr<CellFsStat> sb); error_code sys_fs_fstat(ppu_thread& ppu, u32 fd, vm::ptr<CellFsStat> sb);
error_code sys_fs_link(vm::cptr<char> from, vm::cptr<char> to); error_code sys_fs_link(ppu_thread& ppu, vm::cptr<char> from, vm::cptr<char> to);
error_code sys_fs_mkdir(vm::cptr<char> path, s32 mode); error_code sys_fs_mkdir(ppu_thread& ppu, vm::cptr<char> path, s32 mode);
error_code sys_fs_rename(vm::cptr<char> from, vm::cptr<char> to); error_code sys_fs_rename(ppu_thread& ppu, vm::cptr<char> from, vm::cptr<char> to);
error_code sys_fs_rmdir(vm::cptr<char> path); error_code sys_fs_rmdir(ppu_thread& ppu, vm::cptr<char> path);
error_code sys_fs_unlink(vm::cptr<char> path); error_code sys_fs_unlink(ppu_thread& ppu, vm::cptr<char> path);
error_code sys_fs_access(vm::cptr<char> path, s32 mode); error_code sys_fs_access(ppu_thread& ppu, vm::cptr<char> path, s32 mode);
error_code sys_fs_fcntl(u32 fd, u32 op, vm::ptr<void> arg, u32 size); error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> arg, u32 size);
error_code sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos); error_code sys_fs_lseek(ppu_thread& ppu, u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos);
error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd); error_code sys_fs_fdatasync(ppu_thread& ppu, u32 fd);
error_code sys_fs_fsync(ppu_thread& ppu, u32 fd); error_code sys_fs_fsync(ppu_thread& ppu, u32 fd);
error_code sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4, vm::ptr<s32> arg5); error_code sys_fs_fget_block_size(ppu_thread& ppu, u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4, vm::ptr<s32> arg5);
error_code sys_fs_get_block_size(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4); error_code sys_fs_get_block_size(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4);
error_code sys_fs_truncate(vm::cptr<char> path, u64 size); error_code sys_fs_truncate(ppu_thread& ppu, vm::cptr<char> path, u64 size);
error_code sys_fs_ftruncate(u32 fd, u64 size); error_code sys_fs_ftruncate(ppu_thread& ppu, u32 fd, u64 size);
error_code sys_fs_symbolic_link(vm::cptr<char> target, vm::cptr<char> linkpath); error_code sys_fs_symbolic_link(ppu_thread& ppu, vm::cptr<char> target, vm::cptr<char> linkpath);
error_code sys_fs_chmod(vm::cptr<char> path, s32 mode); error_code sys_fs_chmod(ppu_thread& ppu, vm::cptr<char> path, s32 mode);
error_code sys_fs_chown(vm::cptr<char> path, s32 uid, s32 gid); error_code sys_fs_chown(ppu_thread& ppu, vm::cptr<char> path, s32 uid, s32 gid);
error_code sys_fs_disk_free(vm::cptr<char> path, vm::ptr<u64> total_free, vm::ptr<u64> avail_free); error_code sys_fs_disk_free(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u64> total_free, vm::ptr<u64> avail_free);
error_code sys_fs_utime(vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep); error_code sys_fs_utime(ppu_thread& ppu, vm::cptr<char> path, vm::cptr<CellFsUtimbuf> timep);
error_code sys_fs_acl_read(vm::cptr<char> path, vm::ptr<void>); error_code sys_fs_acl_read(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<void>);
error_code sys_fs_acl_write(vm::cptr<char> path, vm::ptr<void>); error_code sys_fs_acl_write(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<void>);
error_code sys_fs_lsn_get_cda_size(u32 fd, vm::ptr<u64> ptr); error_code sys_fs_lsn_get_cda_size(ppu_thread& ppu, u32 fd, vm::ptr<u64> ptr);
error_code sys_fs_lsn_get_cda(u32 fd, vm::ptr<void>, u64, vm::ptr<u64>); error_code sys_fs_lsn_get_cda(ppu_thread& ppu, u32 fd, vm::ptr<void>, u64, vm::ptr<u64>);
error_code sys_fs_lsn_lock(u32 fd); error_code sys_fs_lsn_lock(ppu_thread& ppu, u32 fd);
error_code sys_fs_lsn_unlock(u32 fd); error_code sys_fs_lsn_unlock(ppu_thread& ppu, u32 fd);
error_code sys_fs_lsn_read(u32 fd, vm::cptr<void>, u64); error_code sys_fs_lsn_read(ppu_thread& ppu, u32 fd, vm::cptr<void>, u64);
error_code sys_fs_lsn_write(u32 fd, vm::cptr<void>, u64); error_code sys_fs_lsn_write(ppu_thread& ppu, u32 fd, vm::cptr<void>, u64);
error_code sys_fs_mapped_allocate(u32 fd, u64, vm::pptr<void> out_ptr); error_code sys_fs_mapped_allocate(ppu_thread& ppu, u32 fd, u64, vm::pptr<void> out_ptr);
error_code sys_fs_mapped_free(u32 fd, vm::ptr<void> ptr); error_code sys_fs_mapped_free(ppu_thread& ppu, u32 fd, vm::ptr<void> ptr);
error_code sys_fs_truncate2(u32 fd, u64 size); error_code sys_fs_truncate2(ppu_thread& ppu, u32 fd, u64 size);