2018-11-10 08:11:38 +00:00
|
|
|
/*
|
2019-04-08 02:00:49 +00:00
|
|
|
* Copyright (c) 2018-2019 Atmosphère-NX
|
2018-11-10 08:11:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <switch.h>
|
|
|
|
#include "fatal_user.hpp"
|
2018-11-10 20:56:43 +00:00
|
|
|
#include "fatal_throw.hpp"
|
2018-11-10 08:54:12 +00:00
|
|
|
#include "fatal_event_manager.hpp"
|
|
|
|
#include "fatal_task.hpp"
|
2018-11-10 08:11:38 +00:00
|
|
|
|
|
|
|
Result UserService::ThrowFatal(u32 error, PidDescriptor pid_desc) {
|
2018-11-14 11:23:28 +00:00
|
|
|
return ThrowFatalImpl(error, pid_desc.pid, FatalType_ErrorReportAndErrorScreen, nullptr);
|
2018-11-10 08:11:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result UserService::ThrowFatalWithPolicy(u32 error, PidDescriptor pid_desc, FatalType policy) {
|
2018-11-14 11:23:28 +00:00
|
|
|
return ThrowFatalImpl(error, pid_desc.pid, policy, nullptr);
|
2018-11-10 08:11:38 +00:00
|
|
|
}
|
|
|
|
|
2018-11-10 10:21:29 +00:00
|
|
|
Result UserService::ThrowFatalWithCpuContext(u32 error, PidDescriptor pid_desc, FatalType policy, InBuffer<u8> _ctx) {
|
|
|
|
if (_ctx.num_elements < sizeof(FatalCpuContext)) {
|
2018-11-14 11:23:28 +00:00
|
|
|
return ThrowFatalImpl(error, pid_desc.pid, policy, nullptr);
|
2018-11-10 10:21:29 +00:00
|
|
|
} else {
|
|
|
|
return ThrowFatalImpl(error, pid_desc.pid, policy, reinterpret_cast<FatalCpuContext *>(_ctx.buffer));
|
2018-11-10 08:11:38 +00:00
|
|
|
}
|
|
|
|
}
|