diff --git a/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_call_secure_monitor_asm.s b/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_call_secure_monitor_asm.s new file mode 100644 index 000000000..dea5890b2 --- /dev/null +++ b/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_call_secure_monitor_asm.s @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * 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 . + */ + +/* ams::kern::svc::CallCallSecureMonitor64From32() */ +.section .text._ZN3ams4kern3svc29CallCallSecureMonitor64From32Ev, "ax", %progbits +.global _ZN3ams4kern3svc29CallCallSecureMonitor64From32Ev +.type _ZN3ams4kern3svc29CallCallSecureMonitor64From32Ev, %function +_ZN3ams4kern3svc29CallCallSecureMonitor64From32Ev: + /* Secure Monitor 64-from-32 ABI is not supported. */ + mov x0, xzr + mov x1, xzr + mov x2, xzr + mov x3, xzr + mov x4, xzr + mov x5, xzr + mov x6, xzr + mov x7, xzr + + ret \ No newline at end of file diff --git a/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_tables.cpp b/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_tables.cpp index 76337bb27..7f9397d6f 100644 --- a/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_tables.cpp +++ b/libraries/libmesosphere/source/arch/arm64/svc/kern_svc_tables.cpp @@ -33,6 +33,9 @@ namespace ams::kern::svc { void CallReturnFromException64(); void CallReturnFromException64From32(); + /* Declare special prototype for (unsupported) CallCallSecureMonitor64From32. */ + void CallCallSecureMonitor64From32(); + namespace { #ifndef MESOSPHERE_USE_STUBBED_SVC_TABLES @@ -75,6 +78,8 @@ namespace ams::kern::svc { table[svc::SvcId_ReturnFromException] = CallReturnFromException64From32; + table[svc::SvcId_CallSecureMonitor] = CallCallSecureMonitor64From32; + return table; }(); diff --git a/libraries/libmesosphere/source/svc/kern_svc_kernel_debug.cpp b/libraries/libmesosphere/source/svc/kern_svc_kernel_debug.cpp index ced75f3e2..8d18f46e6 100644 --- a/libraries/libmesosphere/source/svc/kern_svc_kernel_debug.cpp +++ b/libraries/libmesosphere/source/svc/kern_svc_kernel_debug.cpp @@ -21,28 +21,55 @@ namespace ams::kern::svc { namespace { + void KernelDebug(ams::svc::KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2) { + #ifdef ATMOSPHERE_BUILD_FOR_DEBUGGING + { + /* TODO: Implement Kernel Debugging. */ + } + #endif + } + void ChangeKernelTraceState(ams::svc::KernelTraceState kern_trace_state) { + #ifdef ATMOSPHERE_BUILD_FOR_DEBUGGING + { + switch (kern_trace_state) { + case ams::svc::KernelTraceState_Enabled: + { + /* TODO: MESOSPHERE_KTRACE_RESUME(); */ + } + break; + case ams::svc::KernelTraceState_Disabled: + { + /* TODO: MESOSPHERE_KTRACE_PAUSE(); */ + } + break; + default: + break; + } + } + #endif + } } /* ============================= 64 ABI ============================= */ void KernelDebug64(ams::svc::KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2) { - MESOSPHERE_PANIC("Stubbed SvcKernelDebug64 was called."); + return KernelDebug(kern_debug_type, arg0, arg1, arg2); } void ChangeKernelTraceState64(ams::svc::KernelTraceState kern_trace_state) { - MESOSPHERE_PANIC("Stubbed SvcChangeKernelTraceState64 was called."); + return ChangeKernelTraceState(kern_trace_state); } /* ============================= 64From32 ABI ============================= */ void KernelDebug64From32(ams::svc::KernelDebugType kern_debug_type, uint64_t arg0, uint64_t arg1, uint64_t arg2) { - MESOSPHERE_PANIC("Stubbed SvcKernelDebug64From32 was called."); + return KernelDebug(kern_debug_type, arg0, arg1, arg2); } void ChangeKernelTraceState64From32(ams::svc::KernelTraceState kern_trace_state) { - MESOSPHERE_PANIC("Stubbed SvcChangeKernelTraceState64From32 was called."); + return ChangeKernelTraceState(kern_trace_state); } } diff --git a/libraries/libmesosphere/source/svc/kern_svc_secure_monitor_call.cpp b/libraries/libmesosphere/source/svc/kern_svc_secure_monitor_call.cpp index 8c0034ff6..101c884b1 100644 --- a/libraries/libmesosphere/source/svc/kern_svc_secure_monitor_call.cpp +++ b/libraries/libmesosphere/source/svc/kern_svc_secure_monitor_call.cpp @@ -33,8 +33,6 @@ namespace ams::kern::svc { /* ============================= 64From32 ABI ============================= */ - void CallSecureMonitor64From32(ams::svc::ilp32::SecureMonitorArguments *args) { - MESOSPHERE_PANIC("Stubbed SvcCallSecureMonitor64From32 was called."); - } + /* CallSecureMonitor64From32 is not supported. */ }