Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSH: implement sys_fs_mount() and sys_fs_unmount() #12880

Merged
merged 1 commit into from Oct 28, 2022
Merged

VSH: implement sys_fs_mount() and sys_fs_unmount() #12880

merged 1 commit into from Oct 28, 2022

Conversation

brian218
Copy link
Contributor

@brian218 brian218 commented Oct 24, 2022

Implemented sys_fs_mount() and sys_fs_unmount() for VSH.
Solve:

SYS: 'sys_fs_stat' failed with 0x8001003a : CELL_ENOTMOUNTED, “/dev_hdd1/crash_report/kernel/ps3crash-kernel.dat.tmp”
SYS: 'sys_fs_disk_free' failed with 0x80010002 : CELL_EINVAL, “/dev_hdd1”
SYS: 'sys_fs_open' failed with 0x8001003a : CELL_ENOTMOUNTED, “/dev_hdd1”
SYS: 'sys_fs_unlink' failed with 0x8001003a : CELL_ENOTMOUNTED, “/dev_hdd1/PS3UPDATE/ps3version.txt”
SYS: 'sys_fs_rmdir' failed with 0x8001003a : CELL_ENOTMOUNTED, “/dev_hdd1/PS3UPDATE”

Also corrected some existing typos of dev_flash things in System.cpp by the way.

@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

Is there actual proof of it being mounted at boot with VSH? maybe it calls a syscall to mount manually?

@brian218
Copy link
Contributor Author

Is there actual proof of it being mounted at boot with VSH? maybe it calls a syscall to mount manually?

Yes, from the log I can see the VSH attempted to mount dev_hdd1 in the same way as dev_hdd0 (by sys_fs_mount()):

sys_fs TODO: sys_fs_mount(dev_name=“CELL_FS_IOS:PATA1_HDD_DRIVE”, file_system=“CELL_FS_UFS”, path=“/dev_hdd0”, unk1=0x0, prot=0x0, unk3=0x0, str1=“”, str_len=0)
sys_fs TODO: sys_fs_mount(dev_name=“CELL_FS_IOS:PATA1_HDD_DRIVE”, file_system=“CELL_FS_FAT”, path=“/dev_hdd1”, unk1=0x0, prot=0x0, unk3=0x0, str1=“”, str_len=0)

But I don't think dev_hdd1 was even going to be mounted in RPCS3, since sys_fs_mount() does nothing other than just logging a todo, and dev_hdd1 would never be mounted by System.cpp (see line 281 in this PR; the value of the variable "hdd1" was never actually set somewhere else).

@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

Well, you can implement without checking of anything other than path.

@brian218
Copy link
Contributor Author

Well, you can implement without checking of anything other than path.

Sorry, but I didn't get your point.

@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

You can hook the syscall when it tries to mount hdd1 to vfs::mount, I suggest creating a directory in dev_hdd1/caches/ that will be unique to VSH and cleared every mount.

@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

Probably even without caring about mounting of other mount points for now.

@brian218 brian218 marked this pull request as draft October 24, 2022 14:33
rpcs3/Emu/System.cpp Outdated Show resolved Hide resolved
@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

The code needed in the syscall is not so different from what you just wrote. It's a bad idea hacking it in Emulator::Init.

@brian218
Copy link
Contributor Author

Both sys_fs_mount() and sys_fs_unmount() are implemented now.

@brian218 brian218 changed the title VSH: Fix a series of errors associated with dev_hdd1 VSH: implement sys_fs_mount() and sys_fs_unmount() Oct 24, 2022
rpcs3/Emu/Cell/lv2/sys_fs.cpp Show resolved Hide resolved
rpcs3/Emu/Cell/lv2/sys_fs.cpp Outdated Show resolved Hide resolved
@brian218 brian218 marked this pull request as ready for review October 24, 2022 17:37
@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

I suggest creating a directory in /dev_hdd1/caches/ that will be unique to VSH and cleared every mount.

I forgot, this is very important otherwise VSH would access HDD1 images of games and can erase or modify them.

@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

You see, rpcs3/dev_hdd1/ is not actually the PS3 directory but a parent of co-existing instances of it for different games or applications. The reasoning behind it is that intact HDD1 state results in better performance but its state is not compatible with different games. real PS3 simply clears it when switching application.

@brian218
Copy link
Contributor Author

I suggest creating a directory in /dev_hdd1/caches/ that will be unique to VSH and cleared every mount.

I forgot, this is very important otherwise VSH would access HDD1 images of games and can erase or modify them.

You mean it should mount /dev_hdd1/caches/ instead?

@brian218
Copy link
Contributor Author

You see, rpcs3/dev_hdd1/ is not actually the PS3 directory but a parent of co-existing instances of it for different games or applications. The reasoning behind it is that intact HDD1 state results in better performance but its state is not compatible with different games. real PS3 simply clears it when switching application.

I wonder why RPCS3 doesn't do the same thing as the real PS3 does (clear dev_hdd1).

@elad335
Copy link
Contributor

elad335 commented Oct 24, 2022

Mount /dev_hdd1/caches/vsh.

@brian218
Copy link
Contributor Author

Mount /dev_hdd1/caches/vsh.

Done.

rpcs3/Emu/VFS.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Cell/lv2/sys_fs.cpp Outdated Show resolved Hide resolved
rpcs3/Emu/Cell/lv2/sys_fs.cpp Outdated Show resolved Hide resolved
@Megamouse Megamouse merged commit 61a371b into RPCS3:master Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants