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

sys_sm_shutdown() log minor fixup #12836

Merged
merged 2 commits into from
Oct 21, 2022
Merged

sys_sm_shutdown() log minor fixup #12836

merged 2 commits into from
Oct 21, 2022

Conversation

brian218
Copy link
Contributor

@brian218 brian218 commented Oct 18, 2022

sys_sm_shutdown() log minor fixup

@elad335
Copy link
Contributor

elad335 commented Oct 19, 2022

This is a root syscall, games can't call it.

}
if (action == 0x200)
{
Emu.Restart();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very naive, this is a system reboot - not an application reboot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PS3 Dev Wiki site, it says:
int sys_sm_shutdown(uint16_t op, const void * lpar_parameter, uint64_t parameter_size )

0x1100/0x100 = turn off,
0x1200 = Lv2 Hard Reboot, 
0x200 = Lv2 Soft Reboot,
0x8201 = load lpar id 1
0x8202 = load lpar id 2
0x8204 = load lpar id 3 (PS2_NETEMU)

so I think 0x100 and 0x200 are for graceful shutdown (Emu.GracefulShutdown()) and graceful reboot respectively, and 0x1100 and 0x1200 are for hard shutdown (Emu.Kill()) and hard reboot respectively.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that a reboot is not equivalent to Emu.Restart().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Is there any equivalent of a system reboot in RPCS3?

Copy link
Contributor

@elad335 elad335 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an implementation of a reboot doesn't make much sense outside of VSH because of the HLE nature of this emulator and thus it should be handled only for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I can see GracefulShutdown(false, false); is also called by Restart() when !IsStopped() in System.cpp.
I wonder if there is any more suitable implementation for this syscall.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since RPCS3 doesn't use something like system shutdown and system reboot, would it be fine to use game stop and game restart as an alternative?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, VSH uses it to reboot itself (after rebuilding the database):

{PPU[0x1000000] Thread (main_thread) [sysconf_plugin: 0x01715fe8]} sys_sm TODO: sys_sm_shutdown(op=0x200, param=*0x0, size=0x0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elad335 Would it be fine to simply redirect the shutdown request to sys_process_exit()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay.

@brian218
Copy link
Contributor Author

Well, leave the syscall as-is until there is more ideal implementation.

@brian218 brian218 changed the title Partially implemented sys_sm_shutdown() sys_sm_shutdown() log minor fixup Oct 19, 2022
@Megamouse Megamouse merged commit 789e42e into RPCS3:master Oct 21, 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.

3 participants