mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-06 18:40:36 +00:00
sys_sm: Implemented sys_sm_shutdown() (#13048)
This commit is contained in:
parent
6f306121a6
commit
ab3c8268f0
@ -402,6 +402,13 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> ar
|
||||
|
||||
// TODO: set prio, flags
|
||||
|
||||
lv2_exitspawn(ppu, argv, envp, data);
|
||||
}
|
||||
|
||||
void lv2_exitspawn(ppu_thread& ppu, std::vector<std::string>& argv, std::vector<std::string>& envp, std::vector<u8>& data)
|
||||
{
|
||||
ppu.state += cpu_flag::wait;
|
||||
|
||||
Emu.CallFromMainThread([argv = std::move(argv), envp = std::move(envp), data = std::move(data)]() mutable
|
||||
{
|
||||
sys_process.success("Process finished -> %s", argv[0]);
|
||||
|
@ -101,6 +101,7 @@ extern ps3_process_info_t g_ps3_process_info;
|
||||
// Auxiliary functions
|
||||
s32 process_getpid();
|
||||
s32 process_get_sdk_version(u32 pid, s32& ver);
|
||||
void lv2_exitspawn(ppu_thread& ppu, std::vector<std::string>& argv, std::vector<std::string>& envp, std::vector<u8>& data);
|
||||
|
||||
enum CellError : u32;
|
||||
CellError process_is_spu_lock_line_reservation_address(u32 addr, u64 flags);
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/Memory/vm.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
#include "Emu/Cell/ErrorCodes.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/Cell/lv2/sys_process.h"
|
||||
|
||||
#include "sys_sm.h"
|
||||
|
||||
@ -41,9 +44,42 @@ error_code sys_sm_get_ext_event2(vm::ptr<u64> a1, vm::ptr<u64> a2, vm::ptr<u64>
|
||||
return not_an_error(CELL_EAGAIN);
|
||||
}
|
||||
|
||||
error_code sys_sm_shutdown(u16 op, vm::ptr<void> param, u64 size)
|
||||
error_code sys_sm_shutdown(ppu_thread& ppu, u16 op, vm::ptr<void> param, u64 size)
|
||||
{
|
||||
sys_sm.todo("sys_sm_shutdown(op=0x%x, param=*0x%x, size=0x%x)", op, param, size);
|
||||
ppu.state += cpu_flag::wait;
|
||||
|
||||
sys_sm.success("sys_sm_shutdown(op=0x%x, param=*0x%x, size=0x%x)", op, param, size);
|
||||
|
||||
if (!g_ps3_process_info.has_root_perm())
|
||||
{
|
||||
return CELL_ENOSYS;
|
||||
}
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case 0x100:
|
||||
case 0x1100:
|
||||
{
|
||||
sys_sm.success("Received shutdown request from application");
|
||||
_sys_process_exit(ppu, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
case 0x200:
|
||||
case 0x1200:
|
||||
{
|
||||
sys_sm.success("Received reboot request from application");
|
||||
lv2_exitspawn(ppu, Emu.argv, Emu.envp, Emu.data);
|
||||
break;
|
||||
}
|
||||
case 0x8201:
|
||||
case 0x8202:
|
||||
case 0x8204:
|
||||
{
|
||||
sys_sm.warning("Unsupported LPAR operation: 0x%x", op);
|
||||
return CELL_ENOTSUP;
|
||||
}
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
// SysCalls
|
||||
|
||||
error_code sys_sm_get_ext_event2(vm::ptr<u64> a1, vm::ptr<u64> a2, vm::ptr<u64> a3, u64 a4);
|
||||
error_code sys_sm_shutdown(u16 op, vm::ptr<void> param, u64 size);
|
||||
error_code sys_sm_shutdown(ppu_thread& ppu, u16 op, vm::ptr<void> param, u64 size);
|
||||
error_code sys_sm_get_params(vm::ptr<u8> a, vm::ptr<u8> b, vm::ptr<u32> c, vm::ptr<u64> d);
|
||||
error_code sys_sm_control_led(u8 led, u8 action);
|
||||
error_code sys_sm_ring_buzzer(u64 packet, u64 a1, u64 a2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user