mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-09 21:51:45 +00:00
fatal: misc cleanup, verified to reboot on hardware
This commit is contained in:
parent
6f240b1665
commit
1228cd6903
6 changed files with 17 additions and 11 deletions
|
@ -14,7 +14,7 @@
|
|||
"filesystem_access": {
|
||||
"permissions": "0x0000000000100000"
|
||||
},
|
||||
"service_access": ["bpc", "erpt:c", "fsp-srv", "gpio", "i2c", "lbl", "lm", "nvdrv:s", "pcv", "pl:u", "pm:info", "psm", "set", "set:sys", "spsm", "vi:m", "vi:s"],
|
||||
"service_access": ["bpc", "bpc:c", "erpt:c", "fsp-srv", "gpio", "i2c", "lbl", "lm", "nvdrv:s", "pcv", "pl:u", "pm:info", "psm", "set", "set:sys", "spsm", "vi:m", "vi:s"],
|
||||
"service_host": ["fatal:p", "fatal:u"],
|
||||
"kernel_capabilities": [{
|
||||
"type": "kernel_flags",
|
||||
|
@ -75,7 +75,8 @@
|
|||
"svcReplyAndReceiveLight": "0x42",
|
||||
"svcReplyAndReceive": "0x43",
|
||||
"svcReplyAndReceiveWithUserBuffer": "0x44",
|
||||
"svcCreateEvent": "0x45"
|
||||
"svcCreateEvent": "0x45",
|
||||
"svcReadWriteRegister": "0x4E"
|
||||
}
|
||||
}, {
|
||||
"type": "min_kernel_version",
|
||||
|
|
|
@ -24,7 +24,7 @@ class FatalEventManager {
|
|||
|
||||
HosMutex lock;
|
||||
size_t events_gotten = 0;
|
||||
Event events[3];
|
||||
Event events[NumFatalEvents];
|
||||
public:
|
||||
FatalEventManager();
|
||||
Result GetEvent(Handle *out);
|
||||
|
|
|
@ -34,6 +34,9 @@ static void RunTaskThreadFunc(void *arg) {
|
|||
if (R_FAILED(rc)) {
|
||||
/* TODO: Log task failure, somehow? */
|
||||
}
|
||||
|
||||
/* Finish. */
|
||||
svcExitThread();
|
||||
}
|
||||
|
||||
static void RunTask(IFatalTask *task) {
|
||||
|
|
|
@ -25,4 +25,6 @@ Result ErrorReportTask::Run() {
|
|||
|
||||
/* Signal we're done with our job. */
|
||||
eventFire(this->erpt_event);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -58,7 +58,7 @@ Result UserService::ThrowFatalImpl(u32 error, u64 pid, FatalType policy, FatalCp
|
|||
/* Create events. */
|
||||
Event erpt_event;
|
||||
Event battery_event;
|
||||
if (R_FAILED(eventCreate(&erpt_event, true)) || R_FAILED(eventCreate(&battery_event, true))) {
|
||||
if (R_FAILED(eventCreate(&erpt_event, false)) || R_FAILED(eventCreate(&battery_event, false))) {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
|
@ -85,11 +85,11 @@ Result UserService::ThrowFatalWithPolicy(u32 error, PidDescriptor pid_desc, Fata
|
|||
return ThrowFatalImpl(error, pid_desc.pid, policy, &ctx);
|
||||
}
|
||||
|
||||
Result UserService::ThrowFatalWithCpuContext(u32 error, PidDescriptor pid_desc, FatalType policy, InBuffer<FatalCpuContext> _ctx) {
|
||||
/* Require exactly one context passed in. */
|
||||
if (_ctx.num_elements != 1) {
|
||||
return 0xF601;
|
||||
Result UserService::ThrowFatalWithCpuContext(u32 error, PidDescriptor pid_desc, FatalType policy, InBuffer<u8> _ctx) {
|
||||
if (_ctx.num_elements < sizeof(FatalCpuContext)) {
|
||||
FatalCpuContext ctx = {0};
|
||||
return ThrowFatalImpl(error, pid_desc.pid, policy, &ctx);
|
||||
} else {
|
||||
return ThrowFatalImpl(error, pid_desc.pid, policy, reinterpret_cast<FatalCpuContext *>(_ctx.buffer));
|
||||
}
|
||||
|
||||
return ThrowFatalImpl(error, pid_desc.pid, policy, _ctx.buffer);
|
||||
}
|
|
@ -33,7 +33,7 @@ class UserService final : public IServiceObject {
|
|||
/* Actual commands. */
|
||||
Result ThrowFatal(u32 error, PidDescriptor pid_desc);
|
||||
Result ThrowFatalWithPolicy(u32 error, PidDescriptor pid_desc, FatalType policy);
|
||||
Result ThrowFatalWithCpuContext(u32 error, PidDescriptor pid_desc, FatalType policy, InBuffer<FatalCpuContext> _ctx);
|
||||
Result ThrowFatalWithCpuContext(u32 error, PidDescriptor pid_desc, FatalType policy, InBuffer<u8> _ctx);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<User_Cmd_ThrowFatal, &UserService::ThrowFatal>(),
|
||||
|
|
Loading…
Reference in a new issue