2021-08-21 19:10:13 +01:00
|
|
|
/*
|
2021-10-04 20:59:10 +01:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2021-08-21 19:10:13 +01: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 <exosphere.hpp>
|
|
|
|
#include "fusee_exception_handler.hpp"
|
2021-09-06 04:57:04 +01:00
|
|
|
#include "fusee_fatal.hpp"
|
2021-08-21 19:10:13 +01:00
|
|
|
|
|
|
|
namespace ams::nxboot {
|
|
|
|
|
|
|
|
NORETURN void ExceptionHandlerImpl(s32 which, u32 lr, u32 svc_lr) {
|
2021-09-06 04:57:04 +01:00
|
|
|
ShowFatalError("Exception: which=%" PRId32 ", lr=%p, svc_lr=%p\n", which, reinterpret_cast<void *>(lr), reinterpret_cast<void *>(svc_lr));
|
2021-08-21 19:10:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ams::diag {
|
|
|
|
|
2022-03-10 09:15:45 +00:00
|
|
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
|
|
|
AMS_UNUSED(expr, func, line, file);
|
2021-09-06 04:57:04 +01:00
|
|
|
|
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
2022-03-10 09:15:45 +00:00
|
|
|
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
|
|
|
}
|
|
|
|
|
|
|
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
|
|
|
AMS_UNUSED(expr, func, line, file, format);
|
|
|
|
|
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
|
|
|
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
|
|
|
}
|
|
|
|
|
|
|
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const char *format, ...) {
|
|
|
|
AMS_UNUSED(expr, func, line, file, result, format);
|
|
|
|
|
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
|
|
|
nxboot::ShowFatalError("Abort called, lr=%p, result=0x%08" PRIX32 "\n", reinterpret_cast<void *>(lr), result != nullptr ? result->GetValue() : 0);
|
2021-08-21 19:10:13 +01:00
|
|
|
}
|
|
|
|
|
2022-03-10 09:15:45 +00:00
|
|
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const ::ams::os::UserExceptionInfo *exception_info, const char *format, ...) {
|
|
|
|
AMS_UNUSED(expr, func, line, file, result, exception_info, format);
|
2021-09-06 04:57:04 +01:00
|
|
|
|
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
2022-03-10 09:15:45 +00:00
|
|
|
nxboot::ShowFatalError("Abort called, lr=%p, result=0x%08" PRIX32 "\n", reinterpret_cast<void *>(lr), result != nullptr ? result->GetValue() : 0);
|
2021-08-21 19:10:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
NORETURN void AbortImpl() {
|
2021-09-06 04:57:04 +01:00
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
|
|
|
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
2021-08-21 19:10:13 +01:00
|
|
|
}
|
|
|
|
|
2022-03-10 09:15:45 +00:00
|
|
|
NORETURN void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line) {
|
|
|
|
AMS_UNUSED(type, expr, func, file, line);
|
2022-03-06 20:08:20 +00:00
|
|
|
|
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
|
|
|
nxboot::ShowFatalError("Assert called, lr=%p\n", reinterpret_cast<void *>(lr));
|
|
|
|
}
|
|
|
|
|
2022-03-10 09:15:45 +00:00
|
|
|
NORETURN void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
|
|
|
AMS_UNUSED(type, expr, func, file, line, format);
|
2022-03-06 20:08:20 +00:00
|
|
|
|
|
|
|
u32 lr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
|
|
|
nxboot::ShowFatalError("Assert called, lr=%p\n", reinterpret_cast<void *>(lr));
|
|
|
|
}
|
|
|
|
|
2021-09-06 04:57:04 +01:00
|
|
|
}
|