mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2025-01-03 11:11:14 +00:00
svc: populate namespace
This commit is contained in:
parent
7806766a59
commit
3a91a6b786
23 changed files with 1258 additions and 273 deletions
|
@ -101,8 +101,6 @@ namespace ams::sf::cmif {
|
||||||
static constexpr inline DomainServiceObjectDispatchTable s_CmifServiceDispatchTable{};
|
static constexpr inline DomainServiceObjectDispatchTable s_CmifServiceDispatchTable{};
|
||||||
private:
|
private:
|
||||||
virtual ServerDomainBase *GetServerDomain() = 0;
|
virtual ServerDomainBase *GetServerDomain() = 0;
|
||||||
public:
|
|
||||||
/* TODO: Implement to use domain object processor. */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MitmDomainServiceObject : public DomainServiceObject{};
|
class MitmDomainServiceObject : public DomainServiceObject{};
|
||||||
|
|
|
@ -102,7 +102,6 @@ namespace ams::sf::hipc {
|
||||||
/* Otherwise, we're either a mitm session or a non-mitm session. */
|
/* Otherwise, we're either a mitm session or a non-mitm session. */
|
||||||
if constexpr (IsMitmServer) {
|
if constexpr (IsMitmServer) {
|
||||||
/* Custom deleter ensures that nothing goes awry. */
|
/* Custom deleter ensures that nothing goes awry. */
|
||||||
/* TODO: Should this just be a custom wrapper object? */
|
|
||||||
std::shared_ptr<::Service> forward_service = std::move(ServerSession::CreateForwardService());
|
std::shared_ptr<::Service> forward_service = std::move(ServerSession::CreateForwardService());
|
||||||
|
|
||||||
/* Get mitm forward session. */
|
/* Get mitm forward session. */
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ams::creport {
|
||||||
R_DEFINE_ERROR_RESULT(UserBreak, 6);
|
R_DEFINE_ERROR_RESULT(UserBreak, 6);
|
||||||
R_DEFINE_ERROR_RESULT(DebuggerBreak, 7);
|
R_DEFINE_ERROR_RESULT(DebuggerBreak, 7);
|
||||||
R_DEFINE_ERROR_RESULT(UndefinedSystemCall, 8);
|
R_DEFINE_ERROR_RESULT(UndefinedSystemCall, 8);
|
||||||
R_DEFINE_ERROR_RESULT(SystemMemoryError, 9);
|
R_DEFINE_ERROR_RESULT(MemorySystemError, 9);
|
||||||
|
|
||||||
R_DEFINE_ERROR_RESULT(IncompleteReport, 99);
|
R_DEFINE_ERROR_RESULT(IncompleteReport, 99);
|
||||||
|
|
||||||
|
|
|
@ -19,3 +19,4 @@
|
||||||
#include "results.hpp"
|
#include "results.hpp"
|
||||||
|
|
||||||
#include "svc/svc_types.hpp"
|
#include "svc/svc_types.hpp"
|
||||||
|
#include "svc/svc_definitions.hpp"
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours/svc/svc_types_common.hpp>
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
enum DeviceName {
|
||||||
|
DeviceName_Afi = 0,
|
||||||
|
DeviceName_Avpc = 1,
|
||||||
|
DeviceName_Dc = 2,
|
||||||
|
DeviceName_Dcb = 3,
|
||||||
|
DeviceName_Hc = 4,
|
||||||
|
DeviceName_Hda = 5,
|
||||||
|
DeviceName_Isp2 = 6,
|
||||||
|
DeviceName_MsencNvenc = 7,
|
||||||
|
DeviceName_Nv = 8,
|
||||||
|
DeviceName_Nv2 = 9,
|
||||||
|
DeviceName_Ppcs = 10,
|
||||||
|
DeviceName_Sata = 11,
|
||||||
|
DeviceName_Vi = 12,
|
||||||
|
DeviceName_Vic = 13,
|
||||||
|
DeviceName_XusbHost = 14,
|
||||||
|
DeviceName_XusbDev = 15,
|
||||||
|
DeviceName_Tsec = 16,
|
||||||
|
DeviceName_Ppcs1 = 17,
|
||||||
|
DeviceName_Dc1 = 18,
|
||||||
|
DeviceName_Sdmmc1a = 19,
|
||||||
|
DeviceName_Sdmmc2a = 20,
|
||||||
|
DeviceName_Sdmmc3a = 21,
|
||||||
|
DeviceName_Sdmmc4a = 22,
|
||||||
|
DeviceName_Isp2b = 23,
|
||||||
|
DeviceName_Gpu = 24,
|
||||||
|
DeviceName_Gpub = 25,
|
||||||
|
DeviceName_Ppcs2 = 26,
|
||||||
|
DeviceName_Nvdec = 27,
|
||||||
|
DeviceName_Ape = 28,
|
||||||
|
DeviceName_Se = 29,
|
||||||
|
DeviceName_Nvjpg = 30,
|
||||||
|
DeviceName_Hc1 = 31,
|
||||||
|
DeviceName_Se1 = 32,
|
||||||
|
DeviceName_Axiap = 33,
|
||||||
|
DeviceName_Etr = 34,
|
||||||
|
DeviceName_Tsecb = 35,
|
||||||
|
DeviceName_Tsec1 = 36,
|
||||||
|
DeviceName_Tsecb1 = 37,
|
||||||
|
DeviceName_Nvdec1 = 38,
|
||||||
|
|
||||||
|
DeviceName_Count,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
61
libraries/libvapours/include/vapours/svc/svc_common.hpp
Normal file
61
libraries/libvapours/include/vapours/svc/svc_common.hpp
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "../results.hpp"
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
/* TODO: C++ style handle? */
|
||||||
|
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||||
|
using Handle = ::Handle;
|
||||||
|
#elif defined ATMOSPHERE_IS_MESOSPHERE
|
||||||
|
using Handle = u32;
|
||||||
|
#else
|
||||||
|
#error "Unknown target for svc::Handle"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ATMOSPHERE_ARCH_ARM64
|
||||||
|
|
||||||
|
|
||||||
|
namespace lp64 { /* ... */ }
|
||||||
|
namespace aarch64 { /* ... */ }
|
||||||
|
using namespace ::ams::svc::lp64;
|
||||||
|
using namespace ::ams::svc::aarch64;
|
||||||
|
|
||||||
|
/* TODO: ifdef ATMOSPHERE_ABI_LP64 */
|
||||||
|
#if 1
|
||||||
|
namespace aarch64::lp64 { /* ... */ }
|
||||||
|
using namespace ::ams::svc::aarch64::lp64;
|
||||||
|
#else
|
||||||
|
namespace aarch64::ilp32 { /* ... */ }
|
||||||
|
using namespace ::ams::svc::aarch64::ilp32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ATMOSPHERE_ARCH_ARM
|
||||||
|
|
||||||
|
namespace ilp32 { /* ... */ }
|
||||||
|
namespace aarch32 { /* ... */ }
|
||||||
|
using namespace ::ams::svc::ilp32;
|
||||||
|
using namespace ::ams::svc::aarch32;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Unknown Architecture"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
185
libraries/libvapours/include/vapours/svc/svc_definitions.hpp
Normal file
185
libraries/libvapours/include/vapours/svc/svc_definitions.hpp
Normal file
|
@ -0,0 +1,185 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "svc_common.hpp"
|
||||||
|
#include "svc_types.hpp"
|
||||||
|
|
||||||
|
#define AMS_SVC_KERN_INPUT_HANDLER(TYPE, NAME) TYPE NAME
|
||||||
|
#define AMS_SVC_KERN_OUTPUT_HANDLER(TYPE, NAME) TYPE *NAME
|
||||||
|
#define AMS_SVC_KERN_INPTR_HANDLER(TYPE, NAME) ::ams::kern::KUserPointer<const TYPE *> NAME
|
||||||
|
#define AMS_SVC_KERN_OUTPTR_HANDLER(TYPE, NAME) ::ams::kern::KUserPointer<TYPE *> NAME
|
||||||
|
|
||||||
|
#define AMS_SVC_USER_INPUT_HANDLER(TYPE, NAME) TYPE NAME
|
||||||
|
#define AMS_SVC_USER_OUTPUT_HANDLER(TYPE, NAME) TYPE *NAME
|
||||||
|
#define AMS_SVC_USER_INPTR_HANDLER(TYPE, NAME) const TYPE *NAME
|
||||||
|
#define AMS_SVC_USER_OUTPTR_HANDLER(TYPE, NAME) TYPE *NAME
|
||||||
|
|
||||||
|
#define AMS_SVC_FOREACH_DEFINITION_IMPL(HANDLER, NAMESPACE, INPUT, OUTPUT, INPTR, OUTPTR) \
|
||||||
|
HANDLER(0x01, Result, SetHeapSize, OUTPUT(::ams::svc::Address, out_address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x02, Result, SetMemoryPermission, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size), INPUT(::ams::svc::MemoryPermission, perm)) \
|
||||||
|
HANDLER(0x03, Result, SetMemoryAttribute, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size), INPUT(uint32_t, mask), INPUT(uint32_t, attr)) \
|
||||||
|
HANDLER(0x04, Result, MapMemory, INPUT(::ams::svc::Address, dst_address), INPUT(::ams::svc::Address, src_address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x05, Result, UnmapMemory, INPUT(::ams::svc::Address, dst_address), INPUT(::ams::svc::Address, src_address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x06, Result, QueryMemory, OUTPTR(::ams::svc::NAMESPACE::MemoryInfo, out_memory_info), OUTPUT(::ams::svc::PageInfo, out_page_info), INPUT(::ams::svc::Address, address)) \
|
||||||
|
HANDLER(0x07, void, ExitProcess) \
|
||||||
|
HANDLER(0x08, Result, CreateThread, OUTPUT(::ams::svc::Handle, out_handle), INPUT(::ams::svc::ThreadFunc, func), INPUT(::ams::svc::Address, arg), INPUT(::ams::svc::Address, stack_bottom), INPUT(int32_t, priority), INPUT(int32_t, core_id)) \
|
||||||
|
HANDLER(0x09, Result, StartThread, INPUT(::ams::svc::Handle, thread_handle)) \
|
||||||
|
HANDLER(0x0A, void, ExitThread) \
|
||||||
|
HANDLER(0x0B, void, SleepThread, INPUT(int64_t, ns)) \
|
||||||
|
HANDLER(0x0C, Result, GetThreadPriority, OUTPUT(int32_t, out_priority), INPUT(::ams::svc::Handle, thread_handle)) \
|
||||||
|
HANDLER(0x0D, Result, SetThreadPriority, INPUT(::ams::svc::Handle, thread_handle), INPUT(int32_t, priority)) \
|
||||||
|
HANDLER(0x0E, Result, GetThreadCoreMask, OUTPUT(int32_t, out_core_id), OUTPUT(uint64_t, out_affinity_mask), INPUT(::ams::svc::Handle, thread_handle)) \
|
||||||
|
HANDLER(0x0F, Result, SetThreadCoreMask, INPUT(::ams::svc::Handle, thread_handle), INPUT(int32_t, core_id), INPUT(uint64_t, affinity_mask)) \
|
||||||
|
HANDLER(0x10, int32_t, GetCurrentProcessorNumber) \
|
||||||
|
HANDLER(0x11, Result, SignalEvent, INPUT(::ams::svc::Handle, event_handle)) \
|
||||||
|
HANDLER(0x12, Result, ClearEvent, INPUT(::ams::svc::Handle, event_handle)) \
|
||||||
|
HANDLER(0x13, Result, MapSharedMemory, INPUT(::ams::svc::Handle, shmem_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size), INPUT(::ams::svc::MemoryPermission, map_perm)) \
|
||||||
|
HANDLER(0x14, Result, UnmapSharedMemory, INPUT(::ams::svc::Handle, shmem_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x15, Result, CreateTransferMemory, OUTPUT(::ams::svc::Handle, out_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size), INPUT(::ams::svc::MemoryPermission, map_perm)) \
|
||||||
|
HANDLER(0x16, Result, CloseHandle, INPUT(::ams::svc::Handle, handle)) \
|
||||||
|
HANDLER(0x17, Result, ResetSignal, INPUT(::ams::svc::Handle, handle)) \
|
||||||
|
HANDLER(0x18, Result, WaitSynchronization, OUTPUT(int32_t, out_index), INPTR(::ams::svc::Handle, handles), INPUT(int32_t, numHandles), INPUT(int64_t, timeout_ns)) \
|
||||||
|
HANDLER(0x19, Result, CancelSynchronization, INPUT(::ams::svc::Handle, handle)) \
|
||||||
|
HANDLER(0x1A, Result, ArbitrateLock, INPUT(::ams::svc::Handle, thread_handle), INPUT(::ams::svc::Address, address), INPUT(uint32_t, tag)) \
|
||||||
|
HANDLER(0x1B, Result, ArbitrateUnlock, INPUT(::ams::svc::Address, address)) \
|
||||||
|
HANDLER(0x1C, Result, WaitProcessWideKeyAtomic, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Address, cv_key), INPUT(uint32_t, tag), INPUT(int64_t, timeout_ns)) \
|
||||||
|
HANDLER(0x1D, void, SignalProcessWideKey, INPUT(::ams::svc::Address, cv_key), INPUT(int32_t, count)) \
|
||||||
|
HANDLER(0x1E, int64_t, GetSystemTick) \
|
||||||
|
HANDLER(0x1F, Result, ConnectToNamedPort, OUTPUT(::ams::svc::Handle, out_handle), INPTR(char, name)) \
|
||||||
|
HANDLER(0x20, Result, SendSyncRequestLight, INPUT(::ams::svc::Handle, session_handle)) \
|
||||||
|
HANDLER(0x21, Result, SendSyncRequest, INPUT(::ams::svc::Handle, session_handle)) \
|
||||||
|
HANDLER(0x22, Result, SendSyncRequestWithUserBuffer, INPUT(::ams::svc::Address, message_buffer), INPUT(::ams::svc::Size, message_buffer_size), INPUT(::ams::svc::Handle, session_handle)) \
|
||||||
|
HANDLER(0x23, Result, SendAsyncRequestWithUserBuffer, OUTPUT(::ams::svc::Handle, out_event_handle), INPUT(::ams::svc::Address, message_buffer), INPUT(::ams::svc::Size, message_buffer_size), INPUT(::ams::svc::Handle, session_handle)) \
|
||||||
|
HANDLER(0x24, Result, GetProcessId, OUTPUT(uint64_t, out_process_id), INPUT(::ams::svc::Handle, process_handle)) \
|
||||||
|
HANDLER(0x25, Result, GetThreadId, OUTPUT(uint64_t, out_thread_id), INPUT(::ams::svc::Handle, thread_handle)) \
|
||||||
|
HANDLER(0x26, void, Break, INPUT(::ams::svc::BreakReason, break_reason), INPUT(::ams::svc::Address, arg), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x27, Result, OutputDebugString, INPTR(char, debug_str), INPUT(::ams::svc::Size, len)) \
|
||||||
|
HANDLER(0x28, void, ReturnFromException, INPUT(::ams::Result, result)) \
|
||||||
|
HANDLER(0x29, Result, GetInfo, OUTPUT(uint64_t, out), INPUT(::ams::svc::InfoType, info_type), INPUT(::ams::svc::Handle, handle), INPUT(uint64_t, info_subtype)) \
|
||||||
|
HANDLER(0x2A, void, FlushEntireDataCache) \
|
||||||
|
HANDLER(0x2B, Result, FlushDataCache, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x2C, Result, MapPhysicalMemory, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x2D, Result, UnmapPhysicalMemory, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x2E, Result, GetDebugFutureThreadInfo, OUTPUT(::ams::svc::NAMESPACE::LastThreadContext, out_context), OUTPUT(uint64_t, thread_id), INPUT(::ams::svc::Handle, debug_handle), INPUT(int64_t, ns)) \
|
||||||
|
HANDLER(0x2F, Result, GetLastThreadInfo, OUTPUT(::ams::svc::NAMESPACE::LastThreadContext, out_context), OUTPUT(::ams::svc::Address, out_tls_address), OUTPUT(uint32_t, out_flags)) \
|
||||||
|
HANDLER(0x30, Result, GetResourceLimitLimitValue, OUTPUT(int64_t, out_limit_value), INPUT(::ams::svc::Handle, resource_limit_handle), INPUT(::ams::svc::LimitableResource, which)) \
|
||||||
|
HANDLER(0x31, Result, GetResourceLimitCurrentValue, OUTPUT(int64_t, out_current_value), INPUT(::ams::svc::Handle, resource_limit_handle), INPUT(::ams::svc::LimitableResource, which)) \
|
||||||
|
HANDLER(0x32, Result, SetThreadActivity, INPUT(::ams::svc::Handle, thread_handle), INPUT(::ams::svc::ThreadActivity, thread_activity)) \
|
||||||
|
HANDLER(0x33, Result, GetThreadContext3, OUTPTR(::ams::svc::ThreadContext, out_context), INPUT(::ams::svc::Handle, thread_handle)) \
|
||||||
|
HANDLER(0x34, Result, WaitForAddress, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::ArbitrationType, arb_type), INPUT(int32_t, value), INPUT(int64_t, timeout_ns)) \
|
||||||
|
HANDLER(0x35, Result, SignalToAddress, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::SignalType, signal_type), INPUT(int32_t, value), INPUT(int32_t, count)) \
|
||||||
|
HANDLER(0x36, void, SynchronizePreemptionState) \
|
||||||
|
\
|
||||||
|
HANDLER(0x3C, void, KernelDebug, INPUT(::ams::svc::KernelDebugType, kern_debug_type), INPUT(uint64_t, arg0), INPUT(uint64_t, arg1), INPUT(uint64_t, arg2)) \
|
||||||
|
HANDLER(0x3D, void, ChangeKernelTraceState, INPUT(::ams::svc::KernelTraceState, kern_trace_state)) \
|
||||||
|
\
|
||||||
|
HANDLER(0x40, Result, CreateSession, OUTPUT(::ams::svc::Handle, out_server_session_handle), OUTPUT(::ams::svc::Handle, out_client_session_handle), INPUT(bool, is_light), INPUT(::ams::svc::Address, name)) \
|
||||||
|
HANDLER(0x41, Result, AcceptSession, OUTPUT(::ams::svc::Handle, out_handle), INPUT(::ams::svc::Handle, port)) \
|
||||||
|
HANDLER(0x42, Result, ReplyAndReceiveLight, INPUT(::ams::svc::Handle, handle)) \
|
||||||
|
HANDLER(0x43, Result, ReplyAndReceive, OUTPUT(int32_t, out_index), INPTR(::ams::svc::Handle, handles), INPUT(int32_t, num_handles), INPUT(::ams::svc::Handle, reply_target), INPUT(int64_t, timeout_ns)) \
|
||||||
|
HANDLER(0x44, Result, ReplyAndReceiveWithUserBuffer, OUTPUT(int32_t, out_index), INPUT(::ams::svc::Address, message_buffer), INPUT(::ams::svc::Size, message_buffer_size), INPTR(::ams::svc::Handle, handles), INPUT(int32_t, num_handles), INPUT(::ams::svc::Handle, reply_target), INPUT(int64_t, timeout_ns)) \
|
||||||
|
HANDLER(0x45, Result, CreateEvent, OUTPUT(::ams::svc::Handle, out_write_handle), OUTPUT(::ams::svc::Handle, out_read_handle)) \
|
||||||
|
\
|
||||||
|
HANDLER(0x48, Result, MapPhysicalMemoryUnsafe, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x49, Result, UnmapPhysicalMemoryUnsafe, INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x4A, Result, SetUnsafeLimit, INPUT(::ams::svc::Size, limit)) \
|
||||||
|
HANDLER(0x4B, Result, CreateCodeMemory, OUTPUT(::ams::svc::Handle, out_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x4C, Result, ControlCodeMemory, INPUT(::ams::svc::Handle, code_memory_handle), INPUT(::ams::svc::CodeMemoryOperation, operation), INPUT(uint64_t, address), INPUT(uint64_t, size), INPUT(::ams::svc::MemoryPermission, perm)) \
|
||||||
|
HANDLER(0x4D, void, SleepSystem) \
|
||||||
|
HANDLER(0x4E, Result, ReadWriteRegister, OUTPUT(uint32_t, out_value), INPUT(::ams::svc::PhysicalAddress, address), INPUT(uint32_t, mask), INPUT(uint32_t, value)) \
|
||||||
|
HANDLER(0x4F, Result, SetProcessActivity, INPUT(::ams::svc::Handle, process_handle), INPUT(::ams::svc::ProcessActivity, process_activity)) \
|
||||||
|
HANDLER(0x50, Result, CreateSharedMemory, OUTPUT(::ams::svc::Handle, out_handle), INPUT(::ams::svc::Size, size), INPUT(::ams::svc::MemoryPermission, owner_perm), INPUT(::ams::svc::MemoryPermission, remote_perm)) \
|
||||||
|
HANDLER(0x51, Result, MapTransferMemory, INPUT(::ams::svc::Handle, trmem_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size), INPUT(::ams::svc::MemoryPermission, owner_perm)) \
|
||||||
|
HANDLER(0x52, Result, UnmapTransferMemory, INPUT(::ams::svc::Handle, trmem_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x53, Result, CreateInterruptEvent, OUTPUT(::ams::svc::Handle, out_read_handle), INPUT(int32_t, interrupt_id), INPUT(::ams::svc::InterruptType, interrupt_type)) \
|
||||||
|
HANDLER(0x54, Result, QueryPhysicalAddress, OUTPUT(::ams::svc::NAMESPACE::PhysicalMemoryInfo, out_info), INPUT(::ams::svc::Address, address)) \
|
||||||
|
HANDLER(0x55, Result, QueryIoMapping, OUTPUT(::ams::svc::Address, out_address), INPUT(::ams::svc::PhysicalAddress, physical_address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x56, Result, CreateDeviceAddressSpace, OUTPUT(::ams::svc::Handle, out_handle), INPUT(uint64_t, das_address), INPUT(uint64_t, das_size)) \
|
||||||
|
HANDLER(0x57, Result, AttachDeviceAddressSpace, INPUT(::ams::svc::DeviceName, device_name), INPUT(::ams::svc::Handle, das_handle)) \
|
||||||
|
HANDLER(0x58, Result, DetachDeviceAddressSpace, INPUT(::ams::svc::DeviceName, device_name), INPUT(::ams::svc::Handle, das_handle)) \
|
||||||
|
HANDLER(0x59, Result, MapDeviceAddressSpaceByForce, INPUT(::ams::svc::Handle, das_handle), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, process_address), INPUT(::ams::svc::Size, size), INPUT(uint64_t, device_address), INPUT(::ams::svc::MemoryPermission, device_perm)) \
|
||||||
|
HANDLER(0x5A, Result, MapDeviceAddressSpaceAligned, INPUT(::ams::svc::Handle, das_handle), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, process_address), INPUT(::ams::svc::Size, size), INPUT(uint64_t, device_address), INPUT(::ams::svc::MemoryPermission, device_perm)) \
|
||||||
|
HANDLER(0x5B, Result, MapDeviceAddressSpace, OUTPUT(::ams::svc::Size, out_mapped_size), INPUT(::ams::svc::Handle, das_handle), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, process_address), INPUT(::ams::svc::Size, size), INPUT(uint64_t, device_address), INPUT(::ams::svc::MemoryPermission, device_perm)) \
|
||||||
|
HANDLER(0x5C, Result, UnmapDeviceAddressSpace, INPUT(::ams::svc::Handle, das_handle), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, process_address), INPUT(::ams::svc::Size, size), INPUT(uint64_t, device_address)) \
|
||||||
|
HANDLER(0x5D, Result, InvalidateProcessDataCache, INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, address), INPUT(uint64_t, size)) \
|
||||||
|
HANDLER(0x5E, Result, StoreProcessDataCache, INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, address), INPUT(uint64_t, size)) \
|
||||||
|
HANDLER(0x5F, Result, FlushProcessDataCache, INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, address), INPUT(uint64_t, size)) \
|
||||||
|
HANDLER(0x60, Result, DebugActiveProcess, OUTPUT(::ams::svc::Handle, out_handle), INPUT(uint64_t, process_id)) \
|
||||||
|
HANDLER(0x61, Result, BreakDebugProcess, INPUT(::ams::svc::Handle, debug_handle)) \
|
||||||
|
HANDLER(0x62, Result, TerminateDebugProcess, INPUT(::ams::svc::Handle, debug_handle)) \
|
||||||
|
HANDLER(0x63, Result, GetDebugEvent, OUTPTR(::ams::svc::NAMESPACE::DebugEventInfo, out_info), INPUT(::ams::svc::Handle, debug_handle)) \
|
||||||
|
HANDLER(0x64, Result, ContinueDebugEvent, INPUT(::ams::svc::Handle, debug_handle), INPUT(uint32_t, flags), INPTR(uint64_t, thread_ids), INPUT(int32_t, num_thread_ids)) \
|
||||||
|
HANDLER(0x65, Result, GetProcessList, OUTPUT(int32_t, out_num_processes), OUTPTR(uint64_t, out_process_ids), INPUT(int32_t, max_out_count)) \
|
||||||
|
HANDLER(0x66, Result, GetThreadList, OUTPUT(int32_t, out_num_threads), OUTPTR(uint64_t, out_thread_ids), INPUT(int32_t, max_out_count), INPUT(::ams::svc::Handle, debug_handle)) \
|
||||||
|
HANDLER(0x67, Result, GetDebugThreadContext, OUTPTR(::ams::svc::ThreadContext, out_context), INPUT(::ams::svc::Handle, debug_handle), INPUT(uint64_t, thread_id), INPUT(uint32_t, context_flags)) \
|
||||||
|
HANDLER(0x68, Result, SetDebugThreadContext, INPUT(::ams::svc::Handle, debug_handle), INPUT(uint64_t, thread_id), INPTR(::ams::svc::ThreadContext, context), INPUT(uint32_t, context_flags)) \
|
||||||
|
HANDLER(0x69, Result, QueryDebugProcessMemory, OUTPTR(::ams::svc::NAMESPACE::MemoryInfo, out_memory_info), OUTPUT(::ams::svc::PageInfo, out_page_info), INPUT(::ams::svc::Handle, process_handle), INPUT(::ams::svc::Address, address)) \
|
||||||
|
HANDLER(0x6A, Result, ReadDebugProcessMemory, INPUT(::ams::svc::Address, buffer), INPUT(::ams::svc::Handle, debug_handle), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x6B, Result, WriteDebugProcessMemory, INPUT(::ams::svc::Handle, debug_handle), INPUT(::ams::svc::Address, buffer), INPUT(::ams::svc::Address, address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x6C, Result, SetHardwareBreakPoint, INPUT(::ams::svc::HardwareBreakPointRegisterName, name), INPUT(uint64_t, flags), INPUT(uint64_t, value)) \
|
||||||
|
HANDLER(0x6D, Result, GetDebugThreadParam, OUTPUT(uint64_t, out_64), OUTPUT(uint32_t, out_32), INPUT(::ams::svc::Handle, debug_handle), INPUT(uint64_t, thread_id), INPUT(::ams::svc::DebugThreadParam, param)) \
|
||||||
|
\
|
||||||
|
HANDLER(0x6F, Result, GetSystemInfo, OUTPUT(uint64_t, out), INPUT(::ams::svc::SystemInfoType, info_type), INPUT(::ams::svc::Handle, handle), INPUT(uint64_t, info_subtype)) \
|
||||||
|
HANDLER(0x70, Result, CreatePort, OUTPUT(::ams::svc::Handle, out_server_handle), OUTPUT(::ams::svc::Handle, out_client_handle), INPUT(int32_t, max_sessions), INPUT(bool, is_light), INPUT(::ams::svc::Address, name)) \
|
||||||
|
HANDLER(0x71, Result, ManageNamedPort, OUTPUT(::ams::svc::Handle, out_server_handle), INPTR(char, name), INPUT(int32_t, max_sessions)) \
|
||||||
|
HANDLER(0x72, Result, ConnectToPort, OUTPUT(::ams::svc::Handle, out_handle), INPUT(::ams::svc::Handle, port)) \
|
||||||
|
HANDLER(0x73, Result, SetProcessMemoryPermission, INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, address), INPUT(uint64_t, size), INPUT(::ams::svc::MemoryPermission, perm)) \
|
||||||
|
HANDLER(0x74, Result, MapProcessMemory, INPUT(::ams::svc::Address, dst_address), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, src_address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x75, Result, UnmapProcessMemory, INPUT(::ams::svc::Address, dst_address), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, src_address), INPUT(::ams::svc::Size, size)) \
|
||||||
|
HANDLER(0x76, Result, QueryProcessMemory, OUTPTR(::ams::svc::NAMESPACE::MemoryInfo, out_memory_info), OUTPUT(::ams::svc::PageInfo, out_page_info), INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, address)) \
|
||||||
|
HANDLER(0x77, Result, MapProcessCodeMemory, INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, dst_address), INPUT(uint64_t, src_address), INPUT(uint64_t, size)) \
|
||||||
|
HANDLER(0x78, Result, UnmapProcessCodeMemory, INPUT(::ams::svc::Handle, process_handle), INPUT(uint64_t, dst_address), INPUT(uint64_t, src_address), INPUT(uint64_t, size)) \
|
||||||
|
HANDLER(0x79, Result, CreateProcess, OUTPUT(::ams::svc::Handle, out_handle), INPTR(::ams::svc::NAMESPACE::CreateProcessParameter, parameters), INPTR(uint32_t, caps), INPUT(int32_t, num_caps)) \
|
||||||
|
HANDLER(0x7A, Result, StartProcess, INPUT(::ams::svc::Handle, process_handle), INPUT(int32_t, priority), INPUT(int32_t, core_id), INPUT(uint64_t, main_thread_stack_size)) \
|
||||||
|
HANDLER(0x7B, Result, TerminateProcess, INPUT(::ams::svc::Handle, process_handle)) \
|
||||||
|
HANDLER(0x7C, Result, GetProcessInfo, OUTPUT(int64_t, out_info), INPUT(::ams::svc::Handle, process_handle), INPUT(::ams::svc::ProcessInfoType, info_type)) \
|
||||||
|
HANDLER(0x7D, Result, CreateResourceLimit, OUTPUT(::ams::svc::Handle, out_handle)) \
|
||||||
|
HANDLER(0x7E, Result, SetResourceLimitLimitValue, INPUT(::ams::svc::Handle, resource_limit_handle), INPUT(::ams::svc::LimitableResource, which), INPUT(int64_t, limit_value)) \
|
||||||
|
HANDLER(0x7F, void, CallSecureMonitor, OUTPUT(::ams::svc::NAMESPACE::SecureMonitorArguments, args))
|
||||||
|
|
||||||
|
#define AMS_SVC_FOREACH_USER_DEFINITION(HANDLER, NAMESPACE) AMS_SVC_FOREACH_DEFINITION_IMPL(HANDLER, NAMESPACE, AMS_SVC_USER_INPUT_HANDLER, AMS_SVC_USER_OUTPUT_HANDLER, AMS_SVC_USER_INPTR_HANDLER, AMS_SVC_USER_OUTPTR_HANDLER)
|
||||||
|
#define AMS_SVC_FOREACH_KERN_DEFINITION(HANDLER, NAMESPACE) AMS_SVC_FOREACH_DEFINITION_IMPL(HANDLER, NAMESPACE, AMS_SVC_KERN_INPUT_HANDLER, AMS_SVC_KERN_OUTPUT_HANDLER, AMS_SVC_KERN_INPTR_HANDLER, AMS_SVC_KERN_OUTPTR_HANDLER)
|
||||||
|
|
||||||
|
#define AMS_SVC_DECLARE_FUNCTION_PROTOTYPE(ID, RETURN_TYPE, NAME, ...) \
|
||||||
|
RETURN_TYPE NAME(__VA_ARGS__);
|
||||||
|
|
||||||
|
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
namespace aarch64::lp64 {
|
||||||
|
|
||||||
|
AMS_SVC_FOREACH_USER_DEFINITION(AMS_SVC_DECLARE_FUNCTION_PROTOTYPE, lp64)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace aarch64::ilp32 {
|
||||||
|
|
||||||
|
AMS_SVC_FOREACH_USER_DEFINITION(AMS_SVC_DECLARE_FUNCTION_PROTOTYPE, ilp32)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace aarch32 {
|
||||||
|
|
||||||
|
AMS_SVC_FOREACH_USER_DEFINITION(AMS_SVC_DECLARE_FUNCTION_PROTOTYPE, ilp32)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -13,196 +13,11 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../results.hpp"
|
|
||||||
|
|
||||||
namespace ams::svc {
|
#include "svc_common.hpp"
|
||||||
|
#include "svc_types_common.hpp"
|
||||||
/* Debug event types. */
|
#include "svc_types_base.hpp"
|
||||||
enum class DebugEventType : u32 {
|
#include "svc_types_dd.hpp"
|
||||||
AttachProcess = 0,
|
#include "svc_types_dmnt.hpp"
|
||||||
AttachThread = 1,
|
#include "svc_types_priv.hpp"
|
||||||
ExitProcess = 2,
|
|
||||||
ExitThread = 3,
|
|
||||||
Exception = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoAttachProcess {
|
|
||||||
u64 program_id;
|
|
||||||
u64 process_id;
|
|
||||||
char name[0xC];
|
|
||||||
u32 flags;
|
|
||||||
u64 user_exception_context_address; /* 5.0.0+ */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoAttachThread {
|
|
||||||
u64 thread_id;
|
|
||||||
u64 tls_address;
|
|
||||||
u64 entrypoint;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ExitProcessReason : u32 {
|
|
||||||
ExitProcess = 0,
|
|
||||||
TerminateProcess = 1,
|
|
||||||
Exception = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoExitProcess {
|
|
||||||
ExitProcessReason reason;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class ExitThreadReason : u32 {
|
|
||||||
ExitThread = 0,
|
|
||||||
TerminateThread = 1,
|
|
||||||
ExitProcess = 2,
|
|
||||||
TerminateProcess = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoExitThread {
|
|
||||||
ExitThreadReason reason;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DebugExceptionType : u32 {
|
|
||||||
UndefinedInstruction = 0,
|
|
||||||
InstructionAbort = 1,
|
|
||||||
DataAbort = 2,
|
|
||||||
AlignmentFault = 3,
|
|
||||||
DebuggerAttached = 4,
|
|
||||||
BreakPoint = 5,
|
|
||||||
UserBreak = 6,
|
|
||||||
DebuggerBreak = 7,
|
|
||||||
UndefinedSystemCall = 8,
|
|
||||||
SystemMemoryError = 9,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoUndefinedInstructionException {
|
|
||||||
u32 insn;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoDataAbortException {
|
|
||||||
u64 address;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoAligntmentFaultException {
|
|
||||||
u64 address;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class BreakPointType : u32 {
|
|
||||||
BreakPoint = 0,
|
|
||||||
WatchPoint = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoBreakPointException {
|
|
||||||
BreakPointType type;
|
|
||||||
u64 address;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoUserBreakException {
|
|
||||||
u32 break_reason; /* TODO: enum? */
|
|
||||||
u64 address;
|
|
||||||
u64 size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoDebuggerBreakException {
|
|
||||||
u64 active_thread_ids[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoUndefinedSystemCallException {
|
|
||||||
u32 id;
|
|
||||||
};
|
|
||||||
|
|
||||||
union DebugInfoSpecificException {
|
|
||||||
DebugInfoUndefinedInstructionException undefined_instruction;
|
|
||||||
DebugInfoDataAbortException data_abort;
|
|
||||||
DebugInfoAligntmentFaultException alignment_fault;
|
|
||||||
DebugInfoBreakPointException break_point;
|
|
||||||
DebugInfoUserBreakException user_break;
|
|
||||||
DebugInfoDebuggerBreakException debugger_break;
|
|
||||||
DebugInfoUndefinedSystemCallException undefined_system_call;
|
|
||||||
u64 raw;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugInfoException {
|
|
||||||
DebugExceptionType type;
|
|
||||||
u64 address;
|
|
||||||
DebugInfoSpecificException specific;
|
|
||||||
};
|
|
||||||
|
|
||||||
union DebugInfo {
|
|
||||||
DebugInfoAttachProcess attach_process;
|
|
||||||
DebugInfoAttachThread attach_thread;
|
|
||||||
DebugInfoExitProcess exit_process;
|
|
||||||
DebugInfoExitThread exit_thread;
|
|
||||||
DebugInfoException exception;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DebugEventInfo {
|
|
||||||
DebugEventType type;
|
|
||||||
u32 flags;
|
|
||||||
u64 thread_id;
|
|
||||||
DebugInfo info;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(DebugEventInfo) >= 0x40, "DebugEventInfo definition!");
|
|
||||||
|
|
||||||
/* Thread State, for svcGetDebugThreadParam. */
|
|
||||||
enum class ThreadState : u32 {
|
|
||||||
Waiting = 0,
|
|
||||||
Running = 1,
|
|
||||||
Terminated = 4,
|
|
||||||
Initializing = 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ThreadContextFlag : u32 {
|
|
||||||
ThreadContextFlag_General = (1 << 0),
|
|
||||||
ThreadContextFlag_Control = (1 << 1),
|
|
||||||
ThreadContextFlag_Fpu = (1 << 2),
|
|
||||||
ThreadContextFlag_FpuControl = (1 << 3),
|
|
||||||
|
|
||||||
ThreadContextFlag_All = (ThreadContextFlag_General | ThreadContextFlag_Control | ThreadContextFlag_Fpu | ThreadContextFlag_FpuControl),
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Flags for svcCreateProcess. */
|
|
||||||
enum CreateProcessFlag : u32 {
|
|
||||||
/* Is 64 bit? */
|
|
||||||
CreateProcessFlag_Is64Bit = (1 << 0),
|
|
||||||
|
|
||||||
/* What kind of address space? */
|
|
||||||
CreateProcessFlag_AddressSpaceShift = 1,
|
|
||||||
CreateProcessFlag_AddressSpaceMask = (7 << CreateProcessFlag_AddressSpaceShift),
|
|
||||||
CreateProcessFlag_AddressSpace32Bit = (0 << CreateProcessFlag_AddressSpaceShift),
|
|
||||||
CreateProcessFlag_AddressSpace64BitDeprecated = (1 << CreateProcessFlag_AddressSpaceShift),
|
|
||||||
CreateProcessFlag_AddressSpace32BitWithoutAlias = (2 << CreateProcessFlag_AddressSpaceShift),
|
|
||||||
CreateProcessFlag_AddressSpace64Bit = (3 << CreateProcessFlag_AddressSpaceShift),
|
|
||||||
|
|
||||||
/* Should JIT debug be done on crash? */
|
|
||||||
CreateProcessFlag_EnableDebug = (1 << 4),
|
|
||||||
|
|
||||||
/* Should ASLR be enabled for the process? */
|
|
||||||
CreateProcessFlag_EnableAslr = (1 << 5),
|
|
||||||
|
|
||||||
/* Is the process an application? */
|
|
||||||
CreateProcessFlag_IsApplication = (1 << 6),
|
|
||||||
|
|
||||||
/* 4.x deprecated: Should use secure memory? */
|
|
||||||
CreateProcessFlag_DeprecatedUseSecureMemory = (1 << 7),
|
|
||||||
|
|
||||||
/* 5.x+ Pool partition type. */
|
|
||||||
CreateProcessFlag_PoolPartitionShift = 7,
|
|
||||||
CreateProcessFlag_PoolPartitionMask = (0xF << CreateProcessFlag_PoolPartitionShift),
|
|
||||||
CreateProcessFlag_PoolPartitionApplication = (0 << CreateProcessFlag_PoolPartitionShift),
|
|
||||||
CreateProcessFlag_PoolPartitionApplet = (1 << CreateProcessFlag_PoolPartitionShift),
|
|
||||||
CreateProcessFlag_PoolPartitionSystem = (2 << CreateProcessFlag_PoolPartitionShift),
|
|
||||||
CreateProcessFlag_PoolPartitionSystemNonSecure = (3 << CreateProcessFlag_PoolPartitionShift),
|
|
||||||
|
|
||||||
/* 7.x+ Should memory allocation be optimized? This requires IsApplication. */
|
|
||||||
CreateProcessFlag_OptimizeMemoryAllocation = (1 << 11),
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Type for svcCreateInterruptEvent. */
|
|
||||||
enum InterruptType : u32 {
|
|
||||||
InterruptType_Edge = 0,
|
|
||||||
InterruptType_Level = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
65
libraries/libvapours/include/vapours/svc/svc_types_base.hpp
Normal file
65
libraries/libvapours/include/vapours/svc/svc_types_base.hpp
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include "svc_types_common.hpp"
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
namespace lp64 {
|
||||||
|
|
||||||
|
struct MemoryInfo {
|
||||||
|
u64 addr;
|
||||||
|
u64 size;
|
||||||
|
MemoryState state;
|
||||||
|
MemoryAttribute attr;
|
||||||
|
MemoryPermission perm;
|
||||||
|
u32 ipc_refcount;
|
||||||
|
u32 device_refcount;
|
||||||
|
u32 padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LastThreadContext {
|
||||||
|
u64 fp;
|
||||||
|
u64 sp;
|
||||||
|
u64 lr;
|
||||||
|
u64 pc;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ilp32 {
|
||||||
|
|
||||||
|
struct MemoryInfo {
|
||||||
|
u64 addr;
|
||||||
|
u64 size;
|
||||||
|
MemoryState state;
|
||||||
|
MemoryAttribute attr;
|
||||||
|
MemoryPermission perm;
|
||||||
|
u32 ipc_refcount;
|
||||||
|
u32 device_refcount;
|
||||||
|
u32 padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LastThreadContext {
|
||||||
|
u32 fp;
|
||||||
|
u32 sp;
|
||||||
|
u32 lr;
|
||||||
|
u32 pc;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
506
libraries/libvapours/include/vapours/svc/svc_types_common.hpp
Normal file
506
libraries/libvapours/include/vapours/svc/svc_types_common.hpp
Normal file
|
@ -0,0 +1,506 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "svc_common.hpp"
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
/* Utility classes required to encode information into the type system for SVC veneers. */
|
||||||
|
class Size {
|
||||||
|
private:
|
||||||
|
size_t size;
|
||||||
|
public:
|
||||||
|
constexpr ALWAYS_INLINE Size(size_t s) : size(s) { /* ... */ }
|
||||||
|
constexpr ALWAYS_INLINE operator size_t() { return this->size; }
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Size) == sizeof(size_t));
|
||||||
|
static_assert(std::is_trivially_destructible<Size>::value);
|
||||||
|
|
||||||
|
class Address {
|
||||||
|
private:
|
||||||
|
uintptr_t uintptr;
|
||||||
|
public:
|
||||||
|
constexpr ALWAYS_INLINE Address(uintptr_t u) : uintptr(u) { /* ... */ }
|
||||||
|
constexpr ALWAYS_INLINE operator uintptr_t() { return this->uintptr; }
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Address) == sizeof(uintptr_t));
|
||||||
|
static_assert(std::is_trivially_destructible<Address>::value);
|
||||||
|
|
||||||
|
using PhysicalAddress = u64;
|
||||||
|
|
||||||
|
/* Memory types. */
|
||||||
|
enum MemoryState : u32 {
|
||||||
|
MemoryState_Free = 0x00,
|
||||||
|
MemoryState_Io = 0x01,
|
||||||
|
MemoryState_Static = 0x02,
|
||||||
|
MemoryState_Code = 0x03,
|
||||||
|
MemoryState_CodeData = 0x04,
|
||||||
|
MemoryState_Normal = 0x05,
|
||||||
|
MemoryState_Shared = 0x06,
|
||||||
|
MemoryState_Alias = 0x07,
|
||||||
|
MemoryState_AliasCode = 0x08,
|
||||||
|
MemoryState_AliasCodeData = 0x09,
|
||||||
|
MemoryState_Ipc = 0x0A,
|
||||||
|
MemoryState_Stack = 0x0B,
|
||||||
|
MemoryState_ThreadLocal = 0x0C,
|
||||||
|
MemoryState_Transfered = 0x0D,
|
||||||
|
MemoryState_SharedTransfered = 0x0E,
|
||||||
|
MemoryState_SharedCode = 0x0F,
|
||||||
|
MemoryState_Inaccessible = 0x10,
|
||||||
|
MemoryState_NonSecureIpc = 0x11,
|
||||||
|
MemoryState_NonDeviceIpc = 0x12,
|
||||||
|
MemoryState_Kernel = 0x13,
|
||||||
|
MemoryState_GeneratedCode = 0x14,
|
||||||
|
MemoryState_CodeOut = 0x15,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MemoryPermission : u32 {
|
||||||
|
MemoryPermission_None = (0 << 0),
|
||||||
|
|
||||||
|
MemoryPermission_Read = (1 << 0),
|
||||||
|
MemoryPermission_Write = (1 << 1),
|
||||||
|
MemoryPermission_Execute = (1 << 1),
|
||||||
|
|
||||||
|
MemoryPermission_ReadWrite = MemoryPermission_Read | MemoryPermission_Write,
|
||||||
|
MemoryPermission_ReadExecute = MemoryPermission_Read | MemoryPermission_Execute,
|
||||||
|
|
||||||
|
MemoryPermission_DontCare = (1 << 28), /* For SharedMemory */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MemoryAttribute : u32 {
|
||||||
|
MemoryAttribute_Locked = (1 << 0),
|
||||||
|
MemoryAttribute_IpcLocked = (1 << 1),
|
||||||
|
MemoryAttribute_DeviceShared = (1 << 2),
|
||||||
|
MemoryAttribute_Uncached = (1 << 3),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PageInfo {
|
||||||
|
u32 flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Info Types. */
|
||||||
|
enum InfoType : u32 {
|
||||||
|
InfoType_CoreMask = 0,
|
||||||
|
InfoType_PriorityMask = 1,
|
||||||
|
InfoType_AliasRegionAddress = 2,
|
||||||
|
InfoType_AliasRegionSize = 3,
|
||||||
|
InfoType_HeapRegionAddress = 4,
|
||||||
|
InfoType_HeapRegionSize = 5,
|
||||||
|
InfoType_TotalMemorySize = 6,
|
||||||
|
InfoType_UsedMemorySize = 7,
|
||||||
|
InfoType_DebuggerAttached = 8,
|
||||||
|
InfoType_ResourceLimit = 9,
|
||||||
|
InfoType_IdleTickCount = 10,
|
||||||
|
InfoType_RandomEntropy = 11,
|
||||||
|
InfoType_AslrRegionAddress = 12,
|
||||||
|
InfoType_AslrRegionSize = 13,
|
||||||
|
InfoType_StackRegionAddress = 14,
|
||||||
|
InfoType_StackRegionSize = 15,
|
||||||
|
InfoType_SystemResourceSizeTotal = 16,
|
||||||
|
InfoType_SystemResourceSizeUsed = 17,
|
||||||
|
InfoType_ProgramId = 18,
|
||||||
|
InfoType_InitialProcessIdRange = 19,
|
||||||
|
InfoType_UserExceptionContextAddress = 20,
|
||||||
|
InfoType_TotalNonSystemMemorySize = 21,
|
||||||
|
InfoType_UsedNonSystemMemorySize = 22,
|
||||||
|
InfoType_IsApplication = 23,
|
||||||
|
|
||||||
|
InfoType_ThreadTickCount = 0xF0000002,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TickCountInfo : u64 {
|
||||||
|
TickCountInfo_Core0 = 0,
|
||||||
|
TickCountInfo_Core1 = 1,
|
||||||
|
TickCountInfo_Core2 = 2,
|
||||||
|
TickCountInfo_Core3 = 3,
|
||||||
|
|
||||||
|
TickCountInfo_Total = std::numeric_limits<s64>::max(),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SystemInfoType : u32 {
|
||||||
|
SystemInfoType_TotalPhysicalMemorySize = 0,
|
||||||
|
SystemInfoType_UsedPhysicalMemorySize = 1,
|
||||||
|
SystemInfoType_InitialProcessIdRange = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum InitialProcessIdRangeInfo : u64 {
|
||||||
|
InitialProcessIdRangeInfo_Minimum = 0,
|
||||||
|
InitialProcessIdRangeInfo_Maximum = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum PhysicalMemoryInfo : u64 {
|
||||||
|
PhysicalMemoryInfo_Application = 0,
|
||||||
|
PhysicalMemoryInfo_Applet = 1,
|
||||||
|
PhysicalMemoryInfo_System = 2,
|
||||||
|
PhysicalMemoryInfo_SystemUnsafe = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LastThreadInfoFlag : u32 {
|
||||||
|
/* TODO */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LimitableResource : u32 {
|
||||||
|
LimitableResource_PhysicalMemoryMax = 0,
|
||||||
|
LimitableResource_ThreadCountMax = 1,
|
||||||
|
LimitableResource_EventCountMax = 2,
|
||||||
|
LimitableResource_TransferMemoryCountMax = 3,
|
||||||
|
LimitableResource_SessionCountMax = 4,
|
||||||
|
|
||||||
|
LimitableResource_Count,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CodeMemoryOperation : u32 {
|
||||||
|
CodeMemoryOperation_MapOwner = 0,
|
||||||
|
CodeMemoryOperation_MapSlave = 1,
|
||||||
|
CodeMemoryOperation_UnmapOwner = 2,
|
||||||
|
CodeMemoryOperation_UnmapSlave = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Synchronization types. */
|
||||||
|
enum SignalType : u32 {
|
||||||
|
SignalType_Signal = 0,
|
||||||
|
SignalType_SignalAndIfEqual = 1,
|
||||||
|
SignalType_SignalAndModifyBasedOnWaitingThreadCountIfEqual = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ArbitrationType : u32 {
|
||||||
|
ArbitrationType_WaitIfLessThan = 0,
|
||||||
|
ArbitrationType_DecrementAndWaitIfLessThan = 1,
|
||||||
|
ArbitrationType_WaitIfEqual = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum YieldType : s64 {
|
||||||
|
YieldType_WithoutCoreMigration = 0,
|
||||||
|
YieldType_WithCoreMigration = -1,
|
||||||
|
YieldType_ToAnyThread = -2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum InterruptType : u32 {
|
||||||
|
InterruptType_Edge = 0,
|
||||||
|
InterruptType_Level = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Thread types. */
|
||||||
|
using ThreadFunc = ams::svc::Address;
|
||||||
|
|
||||||
|
#ifdef ATMOSPHERE_ARCH_ARM64
|
||||||
|
|
||||||
|
struct ThreadContext {
|
||||||
|
u64 r[29];
|
||||||
|
u64 fp;
|
||||||
|
u64 lr;
|
||||||
|
u64 sp;
|
||||||
|
u64 pc;
|
||||||
|
u32 pstate;
|
||||||
|
u32 padding;
|
||||||
|
u128 v[32];
|
||||||
|
u32 fpcr;
|
||||||
|
u32 fpsr;
|
||||||
|
u64 tpidr;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(ThreadContext) == 0x320);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "Unknown Architecture for ams::svc::ThreadContext"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum ThreadSuspend : u32 {
|
||||||
|
ThreadSuspend_Debug = (1 << 0),
|
||||||
|
ThreadSuspend_User = (1 << 1),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ThreadState : u32 {
|
||||||
|
ThreadState_Waiting = 0,
|
||||||
|
ThreadState_Running = 1,
|
||||||
|
ThreadState_Terminated = 4,
|
||||||
|
ThreadState_Initializing = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ThreadContextFlag : u32 {
|
||||||
|
ThreadContextFlag_General = (1 << 0),
|
||||||
|
ThreadContextFlag_Control = (1 << 1),
|
||||||
|
ThreadContextFlag_Fpu = (1 << 2),
|
||||||
|
ThreadContextFlag_FpuControl = (1 << 3),
|
||||||
|
|
||||||
|
ThreadContextFlag_All = (ThreadContextFlag_General | ThreadContextFlag_Control | ThreadContextFlag_Fpu | ThreadContextFlag_FpuControl),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ThreadExitReason : u32 {
|
||||||
|
ThreadExitReason_ExitThread = 0,
|
||||||
|
ThreadExitReason_TerminateThread = 1,
|
||||||
|
ThreadExitReason_ExitProcess = 2,
|
||||||
|
ThreadExitReason_TerminateProcess = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ThreadActivity : u32 {
|
||||||
|
ThreadActivity_Runnable = 0,
|
||||||
|
ThreadActivity_Paused = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Process types. */
|
||||||
|
enum ProcessInfoType : u32 {
|
||||||
|
ProcessInfoType_ProcessState = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ProcessState : u32 {
|
||||||
|
ProcessState_Created = 0,
|
||||||
|
ProcessState_CreatedAttached = 1,
|
||||||
|
ProcessState_Running = 2,
|
||||||
|
ProcessState_Crashed = 3,
|
||||||
|
ProcessState_RunningAttached = 4,
|
||||||
|
ProcessState_Exiting = 5,
|
||||||
|
ProcessState_Exited = 6,
|
||||||
|
ProcessState_DebugSuspended = 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ProcessExitReason : u32 {
|
||||||
|
ProcessExitReason_ExitProcess = 0,
|
||||||
|
ProcessExitReason_TerminateProcess = 1,
|
||||||
|
ProcessExitReason_Exception = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ProcessActivity : u32 {
|
||||||
|
ProcessActivity_Runnable = 0,
|
||||||
|
ProcessActivity_Paused = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CreateProcessFlag : u32 {
|
||||||
|
/* Is 64 bit? */
|
||||||
|
CreateProcessFlag_Is64Bit = (1 << 0),
|
||||||
|
|
||||||
|
/* What kind of address space? */
|
||||||
|
CreateProcessFlag_AddressSpaceShift = 1,
|
||||||
|
CreateProcessFlag_AddressSpaceMask = (7 << CreateProcessFlag_AddressSpaceShift),
|
||||||
|
CreateProcessFlag_AddressSpace32Bit = (0 << CreateProcessFlag_AddressSpaceShift),
|
||||||
|
CreateProcessFlag_AddressSpace64BitDeprecated = (1 << CreateProcessFlag_AddressSpaceShift),
|
||||||
|
CreateProcessFlag_AddressSpace32BitWithoutAlias = (2 << CreateProcessFlag_AddressSpaceShift),
|
||||||
|
CreateProcessFlag_AddressSpace64Bit = (3 << CreateProcessFlag_AddressSpaceShift),
|
||||||
|
|
||||||
|
/* Should JIT debug be done on crash? */
|
||||||
|
CreateProcessFlag_EnableDebug = (1 << 4),
|
||||||
|
|
||||||
|
/* Should ASLR be enabled for the process? */
|
||||||
|
CreateProcessFlag_EnableAslr = (1 << 5),
|
||||||
|
|
||||||
|
/* Is the process an application? */
|
||||||
|
CreateProcessFlag_IsApplication = (1 << 6),
|
||||||
|
|
||||||
|
/* 4.x deprecated: Should use secure memory? */
|
||||||
|
CreateProcessFlag_DeprecatedUseSecureMemory = (1 << 7),
|
||||||
|
|
||||||
|
/* 5.x+ Pool partition type. */
|
||||||
|
CreateProcessFlag_PoolPartitionShift = 7,
|
||||||
|
CreateProcessFlag_PoolPartitionMask = (0xF << CreateProcessFlag_PoolPartitionShift),
|
||||||
|
CreateProcessFlag_PoolPartitionApplication = (0 << CreateProcessFlag_PoolPartitionShift),
|
||||||
|
CreateProcessFlag_PoolPartitionApplet = (1 << CreateProcessFlag_PoolPartitionShift),
|
||||||
|
CreateProcessFlag_PoolPartitionSystem = (2 << CreateProcessFlag_PoolPartitionShift),
|
||||||
|
CreateProcessFlag_PoolPartitionSystemNonSecure = (3 << CreateProcessFlag_PoolPartitionShift),
|
||||||
|
|
||||||
|
/* 7.x+ Should memory allocation be optimized? This requires IsApplication. */
|
||||||
|
CreateProcessFlag_OptimizeMemoryAllocation = (1 << 11),
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Debug types. */
|
||||||
|
enum DebugEvent : u32 {
|
||||||
|
DebugEvent_AttachProcess = 0,
|
||||||
|
DebugEvent_AttachThread = 1,
|
||||||
|
DebugEvent_ExitProcess = 2,
|
||||||
|
DebugEvent_ExitThread = 3,
|
||||||
|
DebugEvent_Exception = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DebugThreadParam : u32 {
|
||||||
|
DebugThreadParam_Priority = 0,
|
||||||
|
DebugThreadParam_State = 1,
|
||||||
|
DebugThreadParam_IdealCore = 2,
|
||||||
|
DebugThreadParam_CurrentCore = 3,
|
||||||
|
DebugThreadParam_AffinityMask = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DebugException : u32 {
|
||||||
|
DebugException_UndefinedInstruction = 0,
|
||||||
|
DebugException_InstructionAbort = 1,
|
||||||
|
DebugException_DataAbort = 2,
|
||||||
|
DebugException_AlignmentFault = 3,
|
||||||
|
DebugException_DebuggerAttached = 4,
|
||||||
|
DebugException_BreakPoint = 5,
|
||||||
|
DebugException_UserBreak = 6,
|
||||||
|
DebugException_DebuggerBreak = 7,
|
||||||
|
DebugException_UndefinedSystemCall = 8,
|
||||||
|
DebugException_MemorySystemError = 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ExceptionType : u32 {
|
||||||
|
ExceptionType_Init = 0x000,
|
||||||
|
ExceptionType_InstructionAbort = 0x100,
|
||||||
|
ExceptionType_DataAbort = 0x101,
|
||||||
|
ExceptionType_UnalignedInstruction = 0x102,
|
||||||
|
ExceptionType_UnalignedData = 0x103,
|
||||||
|
ExceptionType_UndefinedInstruction = 0x104,
|
||||||
|
ExceptionType_ExceptionInstruction = 0x105,
|
||||||
|
ExceptionType_MemorySystemError = 0x106,
|
||||||
|
ExceptionType_FpuException = 0x200,
|
||||||
|
ExceptionType_InvalidSystemCall = 0x301,
|
||||||
|
ExceptionType_SystemCallBreak = 0x302,
|
||||||
|
|
||||||
|
ExceptionType_AtmosphereStdAbort = 0xFFE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BreakReason : u32 {
|
||||||
|
/* TODO */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum KernelDebugType : u32 {
|
||||||
|
/* TODO */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum KernelTraceState : u32 {
|
||||||
|
KernelTraceState_Disabled = 0,
|
||||||
|
KernelTraceState_Enabled = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BreakPointType : u32 {
|
||||||
|
BreakPointType_HardwareInstruction = 0,
|
||||||
|
BreakPointType_HardwareData = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum HardwareBreakPointRegisterName : u32 {
|
||||||
|
HardwareBreakPointRegisterName_I0 = 0,
|
||||||
|
HardwareBreakPointRegisterName_I1 = 1,
|
||||||
|
HardwareBreakPointRegisterName_I2 = 2,
|
||||||
|
HardwareBreakPointRegisterName_I3 = 3,
|
||||||
|
HardwareBreakPointRegisterName_I4 = 4,
|
||||||
|
HardwareBreakPointRegisterName_I5 = 5,
|
||||||
|
HardwareBreakPointRegisterName_I6 = 6,
|
||||||
|
HardwareBreakPointRegisterName_I7 = 7,
|
||||||
|
HardwareBreakPointRegisterName_I8 = 8,
|
||||||
|
HardwareBreakPointRegisterName_I9 = 9,
|
||||||
|
HardwareBreakPointRegisterName_I10 = 10,
|
||||||
|
HardwareBreakPointRegisterName_I11 = 11,
|
||||||
|
HardwareBreakPointRegisterName_I12 = 12,
|
||||||
|
HardwareBreakPointRegisterName_I13 = 13,
|
||||||
|
HardwareBreakPointRegisterName_I14 = 14,
|
||||||
|
HardwareBreakPointRegisterName_I15 = 15,
|
||||||
|
HardwareBreakPointRegisterName_D0 = 16,
|
||||||
|
HardwareBreakPointRegisterName_D1 = 17,
|
||||||
|
HardwareBreakPointRegisterName_D2 = 18,
|
||||||
|
HardwareBreakPointRegisterName_D3 = 19,
|
||||||
|
HardwareBreakPointRegisterName_D4 = 20,
|
||||||
|
HardwareBreakPointRegisterName_D5 = 21,
|
||||||
|
HardwareBreakPointRegisterName_D6 = 22,
|
||||||
|
HardwareBreakPointRegisterName_D7 = 23,
|
||||||
|
HardwareBreakPointRegisterName_D8 = 24,
|
||||||
|
HardwareBreakPointRegisterName_D9 = 25,
|
||||||
|
HardwareBreakPointRegisterName_D10 = 26,
|
||||||
|
HardwareBreakPointRegisterName_D11 = 27,
|
||||||
|
HardwareBreakPointRegisterName_D12 = 28,
|
||||||
|
HardwareBreakPointRegisterName_D13 = 29,
|
||||||
|
HardwareBreakPointRegisterName_D14 = 30,
|
||||||
|
HardwareBreakPointRegisterName_D15 = 31,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Architecture specific types. */
|
||||||
|
namespace aarch64 {
|
||||||
|
|
||||||
|
struct ExceptionInfo {
|
||||||
|
u64 r[9];
|
||||||
|
u64 lr;
|
||||||
|
u64 sp;
|
||||||
|
u64 pc;
|
||||||
|
u32 pstate;
|
||||||
|
u32 afsr0;
|
||||||
|
u32 afsr1;
|
||||||
|
u32 esr;
|
||||||
|
u64 far;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(ExceptionInfo) == 0x78);
|
||||||
|
|
||||||
|
struct ProcessLocalRegion {
|
||||||
|
u64 data[(0x1C0 - sizeof(ExceptionInfo)) / sizeof(u64)];
|
||||||
|
ExceptionInfo exception_info;
|
||||||
|
u64 dying_message_region_address;
|
||||||
|
u64 dying_message_region_size;
|
||||||
|
u64 padding[6];
|
||||||
|
};
|
||||||
|
static_assert(sizeof(ProcessLocalRegion) == 0x200);
|
||||||
|
static_assert(OFFSETOF(ProcessLocalRegion, dying_message_region_address) == 0x1C0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace aarch32 {
|
||||||
|
|
||||||
|
struct ExceptionInfoStatus32 {
|
||||||
|
u32 cpsr;
|
||||||
|
u32 fsr;
|
||||||
|
u32 far;
|
||||||
|
u32 fpexc;
|
||||||
|
u32 fpinst;
|
||||||
|
u32 fpinst2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ExceptionInfoStatus64 {
|
||||||
|
u32 pstate;
|
||||||
|
u32 afsr0;
|
||||||
|
u32 esr;
|
||||||
|
u32 far;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ExceptionInfo {
|
||||||
|
u32 r[8];
|
||||||
|
u32 sp;
|
||||||
|
u32 lr;
|
||||||
|
u32 pc;
|
||||||
|
u32 flags;
|
||||||
|
union {
|
||||||
|
ExceptionInfoStatus32 status_32;
|
||||||
|
ExceptionInfoStatus64 status_64;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(ExceptionInfo) == 0x48);
|
||||||
|
|
||||||
|
struct ProcessLocalRegion {
|
||||||
|
u32 data[(0x1C0 - sizeof(ExceptionInfo)) / sizeof(u32)];
|
||||||
|
ExceptionInfo exception_info;
|
||||||
|
u64 dying_message_region_address;
|
||||||
|
u64 dying_message_region_size;
|
||||||
|
u64 padding[6];
|
||||||
|
};
|
||||||
|
static_assert(sizeof(ProcessLocalRegion) == 0x200);
|
||||||
|
static_assert(OFFSETOF(ProcessLocalRegion, dying_message_region_address) == 0x1C0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Secure monitor argument shims. */
|
||||||
|
namespace lp64 {
|
||||||
|
|
||||||
|
struct SecureMonitorArguments {
|
||||||
|
u64 r[8];
|
||||||
|
};
|
||||||
|
static_assert(sizeof(SecureMonitorArguments) == 0x40);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ilp32 {
|
||||||
|
|
||||||
|
struct SecureMonitorArguments {
|
||||||
|
u32 r[8];
|
||||||
|
};
|
||||||
|
static_assert(sizeof(SecureMonitorArguments) == 0x20);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
51
libraries/libvapours/include/vapours/svc/svc_types_dd.hpp
Normal file
51
libraries/libvapours/include/vapours/svc/svc_types_dd.hpp
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include "svc_types_common.hpp"
|
||||||
|
|
||||||
|
#ifdef ATMOSPHERE_BOARD_NINTENDO_SWITCH
|
||||||
|
|
||||||
|
#include "board/nintendo/switch/svc_device_name.hpp"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Unknown board for svc::DeviceName"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
namespace lp64 {
|
||||||
|
|
||||||
|
struct PhysicalMemoryInfo {
|
||||||
|
PhysicalAddress physical_address;
|
||||||
|
u64 virtual_address;
|
||||||
|
u64 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ilp32 {
|
||||||
|
|
||||||
|
struct PhysicalMemoryInfo {
|
||||||
|
PhysicalAddress physical_address;
|
||||||
|
u32 virtual_address;
|
||||||
|
u32 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
200
libraries/libvapours/include/vapours/svc/svc_types_dmnt.hpp
Normal file
200
libraries/libvapours/include/vapours/svc/svc_types_dmnt.hpp
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include "svc_types_common.hpp"
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
namespace lp64 {
|
||||||
|
|
||||||
|
struct DebugInfoAttachProcess {
|
||||||
|
u64 program_id;
|
||||||
|
u64 process_id;
|
||||||
|
char name[0xC];
|
||||||
|
u32 flags;
|
||||||
|
u64 user_exception_context_address; /* 5.0.0+ */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoAttachThread {
|
||||||
|
u64 thread_id;
|
||||||
|
u64 tls_address;
|
||||||
|
u64 entrypoint;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoExitProcess {
|
||||||
|
ProcessExitReason reason;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoExitThread {
|
||||||
|
ThreadExitReason reason;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoUndefinedInstructionException {
|
||||||
|
u32 insn;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoDataAbortException {
|
||||||
|
u64 address;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoAlignmentFaultException {
|
||||||
|
u64 address;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoBreakPointException {
|
||||||
|
BreakPointType type;
|
||||||
|
u64 address;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoUserBreakException {
|
||||||
|
BreakReason break_reason;
|
||||||
|
u64 address;
|
||||||
|
u64 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoDebuggerBreakException {
|
||||||
|
u64 active_thread_ids[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoUndefinedSystemCallException {
|
||||||
|
u32 id;
|
||||||
|
};
|
||||||
|
|
||||||
|
union DebugInfoSpecificException {
|
||||||
|
DebugInfoUndefinedInstructionException undefined_instruction;
|
||||||
|
DebugInfoDataAbortException data_abort;
|
||||||
|
DebugInfoAlignmentFaultException alignment_fault;
|
||||||
|
DebugInfoBreakPointException break_point;
|
||||||
|
DebugInfoUserBreakException user_break;
|
||||||
|
DebugInfoDebuggerBreakException debugger_break;
|
||||||
|
DebugInfoUndefinedSystemCallException undefined_system_call;
|
||||||
|
u64 raw;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoException {
|
||||||
|
DebugException type;
|
||||||
|
u64 address;
|
||||||
|
DebugInfoSpecificException specific;
|
||||||
|
};
|
||||||
|
|
||||||
|
union DebugInfo {
|
||||||
|
DebugInfoAttachProcess attach_process;
|
||||||
|
DebugInfoAttachThread attach_thread;
|
||||||
|
DebugInfoExitProcess exit_process;
|
||||||
|
DebugInfoExitThread exit_thread;
|
||||||
|
DebugInfoException exception;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugEventInfo {
|
||||||
|
DebugEvent type;
|
||||||
|
u32 flags;
|
||||||
|
u64 thread_id;
|
||||||
|
DebugInfo info;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(DebugEventInfo) >= 0x40);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ilp32 {
|
||||||
|
|
||||||
|
struct DebugInfoAttachProcess {
|
||||||
|
u64 program_id;
|
||||||
|
u64 process_id;
|
||||||
|
char name[0xC];
|
||||||
|
u32 flags;
|
||||||
|
u32 user_exception_context_address; /* 5.0.0+ */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoAttachThread {
|
||||||
|
u64 thread_id;
|
||||||
|
u32 tls_address;
|
||||||
|
u32 entrypoint;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoExitProcess {
|
||||||
|
ProcessExitReason reason;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoExitThread {
|
||||||
|
ThreadExitReason reason;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoUndefinedInstructionException {
|
||||||
|
u32 insn;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoDataAbortException {
|
||||||
|
u32 address;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoAlignmentFaultException {
|
||||||
|
u32 address;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoBreakPointException {
|
||||||
|
BreakPointType type;
|
||||||
|
u32 address;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoUserBreakException {
|
||||||
|
BreakReason break_reason;
|
||||||
|
u32 address;
|
||||||
|
u32 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoDebuggerBreakException {
|
||||||
|
u64 active_thread_ids[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoUndefinedSystemCallException {
|
||||||
|
u32 id;
|
||||||
|
};
|
||||||
|
|
||||||
|
union DebugInfoSpecificException {
|
||||||
|
DebugInfoUndefinedInstructionException undefined_instruction;
|
||||||
|
DebugInfoDataAbortException data_abort;
|
||||||
|
DebugInfoAlignmentFaultException alignment_fault;
|
||||||
|
DebugInfoBreakPointException break_point;
|
||||||
|
DebugInfoUserBreakException user_break;
|
||||||
|
DebugInfoDebuggerBreakException debugger_break;
|
||||||
|
DebugInfoUndefinedSystemCallException undefined_system_call;
|
||||||
|
u64 raw;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugInfoException {
|
||||||
|
DebugException type;
|
||||||
|
u32 address;
|
||||||
|
DebugInfoSpecificException specific;
|
||||||
|
};
|
||||||
|
|
||||||
|
union DebugInfo {
|
||||||
|
DebugInfoAttachProcess attach_process;
|
||||||
|
DebugInfoAttachThread attach_thread;
|
||||||
|
DebugInfoExitProcess exit_process;
|
||||||
|
DebugInfoExitThread exit_thread;
|
||||||
|
DebugInfoException exception;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DebugEventInfo {
|
||||||
|
DebugEvent type;
|
||||||
|
u32 flags;
|
||||||
|
u64 thread_id;
|
||||||
|
DebugInfo info;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
53
libraries/libvapours/include/vapours/svc/svc_types_priv.hpp
Normal file
53
libraries/libvapours/include/vapours/svc/svc_types_priv.hpp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include "svc_types_common.hpp"
|
||||||
|
|
||||||
|
namespace ams::svc {
|
||||||
|
|
||||||
|
namespace lp64 {
|
||||||
|
|
||||||
|
struct CreateProcessParameter {
|
||||||
|
char name[12];
|
||||||
|
u32 version;
|
||||||
|
u64 program_id;
|
||||||
|
u64 code_address;
|
||||||
|
u32 code_num_pages;
|
||||||
|
u32 flags;
|
||||||
|
Handle reslimit;
|
||||||
|
u32 system_resource_num_pages;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(CreateProcessParameter) == 0x30);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ilp32 {
|
||||||
|
|
||||||
|
struct CreateProcessParameter {
|
||||||
|
char name[12];
|
||||||
|
u32 version;
|
||||||
|
u64 program_id;
|
||||||
|
u64 code_address;
|
||||||
|
u32 code_num_pages;
|
||||||
|
u32 flags;
|
||||||
|
Handle reslimit;
|
||||||
|
u32 system_resource_num_pages;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(CreateProcessParameter) == 0x30);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ typedef volatile s32 vs32; ///< 32-bit volatile signed integer.
|
||||||
typedef volatile s64 vs64; ///< 64-bit volatile signed integer.
|
typedef volatile s64 vs64; ///< 64-bit volatile signed integer.
|
||||||
typedef volatile s128 vs128; ///< 128-bit volatile signed integer.
|
typedef volatile s128 vs128; ///< 128-bit volatile signed integer.
|
||||||
|
|
||||||
typedef u32 Result; ///< Function error code result type.
|
typedef u32 Result; ///< Function error code result type.
|
||||||
|
|
||||||
/// Creates a bitmask from a bit number.
|
/// Creates a bitmask from a bit number.
|
||||||
#ifndef BIT
|
#ifndef BIT
|
||||||
|
|
|
@ -125,12 +125,10 @@ namespace ams::boot {
|
||||||
std::memset(g_frame_buffer, 0x00, FrameBufferSize);
|
std::memset(g_frame_buffer, 0x00, FrameBufferSize);
|
||||||
armDCacheFlush(g_frame_buffer, FrameBufferSize);
|
armDCacheFlush(g_frame_buffer, FrameBufferSize);
|
||||||
|
|
||||||
constexpr u64 DeviceName_DC = 2;
|
|
||||||
|
|
||||||
/* Create Address Space. */
|
/* Create Address Space. */
|
||||||
R_ASSERT(svcCreateDeviceAddressSpace(&g_dc_das_hnd, 0, (1ul << 32)));
|
R_ASSERT(svcCreateDeviceAddressSpace(&g_dc_das_hnd, 0, (1ul << 32)));
|
||||||
/* Attach it to the DC. */
|
/* Attach it to the DC. */
|
||||||
R_ASSERT(svcAttachDeviceAddressSpace(DeviceName_DC, g_dc_das_hnd));
|
R_ASSERT(svcAttachDeviceAddressSpace(svc::DeviceName_Dc, g_dc_das_hnd));
|
||||||
|
|
||||||
/* Map the framebuffer for the DC as read-only. */
|
/* Map the framebuffer for the DC as read-only. */
|
||||||
R_ASSERT(svcMapDeviceAddressSpaceAligned(g_dc_das_hnd, dd::GetCurrentProcessHandle(), frame_buffer_aligned, FrameBufferSize, FrameBufferPaddr, 1));
|
R_ASSERT(svcMapDeviceAddressSpaceAligned(g_dc_das_hnd, dd::GetCurrentProcessHandle(), frame_buffer_aligned, FrameBufferSize, FrameBufferPaddr, 1));
|
||||||
|
@ -140,12 +138,11 @@ namespace ams::boot {
|
||||||
void FinalizeFrameBuffer() {
|
void FinalizeFrameBuffer() {
|
||||||
if (g_frame_buffer != nullptr) {
|
if (g_frame_buffer != nullptr) {
|
||||||
const uintptr_t frame_buffer_aligned = reinterpret_cast<uintptr_t>(g_frame_buffer);
|
const uintptr_t frame_buffer_aligned = reinterpret_cast<uintptr_t>(g_frame_buffer);
|
||||||
constexpr u64 DeviceName_DC = 2;
|
|
||||||
|
|
||||||
/* Unmap the framebuffer from the DC. */
|
/* Unmap the framebuffer from the DC. */
|
||||||
R_ASSERT(svcUnmapDeviceAddressSpace(g_dc_das_hnd, dd::GetCurrentProcessHandle(), frame_buffer_aligned, FrameBufferSize, FrameBufferPaddr));
|
R_ASSERT(svcUnmapDeviceAddressSpace(g_dc_das_hnd, dd::GetCurrentProcessHandle(), frame_buffer_aligned, FrameBufferSize, FrameBufferPaddr));
|
||||||
/* Detach address space from the DC. */
|
/* Detach address space from the DC. */
|
||||||
R_ASSERT(svcDetachDeviceAddressSpace(DeviceName_DC, g_dc_das_hnd));
|
R_ASSERT(svcDetachDeviceAddressSpace(svc::DeviceName_Dc, g_dc_das_hnd));
|
||||||
/* Close the address space. */
|
/* Close the address space. */
|
||||||
R_ASSERT(svcCloseHandle(g_dc_das_hnd));
|
R_ASSERT(svcCloseHandle(g_dc_das_hnd));
|
||||||
g_dc_das_hnd = INVALID_HANDLE;
|
g_dc_das_hnd = INVALID_HANDLE;
|
||||||
|
|
|
@ -24,6 +24,8 @@ namespace ams::creport {
|
||||||
|
|
||||||
/* Convenience definitions. */
|
/* Convenience definitions. */
|
||||||
constexpr size_t DyingMessageAddressOffset = 0x1C0;
|
constexpr size_t DyingMessageAddressOffset = 0x1C0;
|
||||||
|
static_assert(DyingMessageAddressOffset == OFFSETOF(ams::svc::aarch64::ProcessLocalRegion, dying_message_region_address));
|
||||||
|
static_assert(DyingMessageAddressOffset == OFFSETOF(ams::svc::aarch32::ProcessLocalRegion, dying_message_region_address));
|
||||||
|
|
||||||
/* Helper functions. */
|
/* Helper functions. */
|
||||||
bool TryGetCurrentTimestamp(u64 *out) {
|
bool TryGetCurrentTimestamp(u64 *out) {
|
||||||
|
@ -53,27 +55,27 @@ namespace ams::creport {
|
||||||
mkdir("sdmc:/atmosphere/fatal_reports/dumps", S_IRWXU);
|
mkdir("sdmc:/atmosphere/fatal_reports/dumps", S_IRWXU);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr const char *GetDebugExceptionTypeString(const svc::DebugExceptionType type) {
|
constexpr const char *GetDebugExceptionString(const svc::DebugException type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case svc::DebugExceptionType::UndefinedInstruction:
|
case svc::DebugException_UndefinedInstruction:
|
||||||
return "Undefined Instruction";
|
return "Undefined Instruction";
|
||||||
case svc::DebugExceptionType::InstructionAbort:
|
case svc::DebugException_InstructionAbort:
|
||||||
return "Instruction Abort";
|
return "Instruction Abort";
|
||||||
case svc::DebugExceptionType::DataAbort:
|
case svc::DebugException_DataAbort:
|
||||||
return "Data Abort";
|
return "Data Abort";
|
||||||
case svc::DebugExceptionType::AlignmentFault:
|
case svc::DebugException_AlignmentFault:
|
||||||
return "Alignment Fault";
|
return "Alignment Fault";
|
||||||
case svc::DebugExceptionType::DebuggerAttached:
|
case svc::DebugException_DebuggerAttached:
|
||||||
return "Debugger Attached";
|
return "Debugger Attached";
|
||||||
case svc::DebugExceptionType::BreakPoint:
|
case svc::DebugException_BreakPoint:
|
||||||
return "Break Point";
|
return "Break Point";
|
||||||
case svc::DebugExceptionType::UserBreak:
|
case svc::DebugException_UserBreak:
|
||||||
return "User Break";
|
return "User Break";
|
||||||
case svc::DebugExceptionType::DebuggerBreak:
|
case svc::DebugException_DebuggerBreak:
|
||||||
return "Debugger Break";
|
return "Debugger Break";
|
||||||
case svc::DebugExceptionType::UndefinedSystemCall:
|
case svc::DebugException_UndefinedSystemCall:
|
||||||
return "Undefined System Call";
|
return "Undefined System Call";
|
||||||
case svc::DebugExceptionType::SystemMemoryError:
|
case svc::DebugException_MemorySystemError:
|
||||||
return "System Memory Error";
|
return "System Memory Error";
|
||||||
default:
|
default:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
@ -147,17 +149,17 @@ namespace ams::creport {
|
||||||
svc::DebugEventInfo d;
|
svc::DebugEventInfo d;
|
||||||
while (R_SUCCEEDED(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), this->debug_handle))) {
|
while (R_SUCCEEDED(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), this->debug_handle))) {
|
||||||
switch (d.type) {
|
switch (d.type) {
|
||||||
case svc::DebugEventType::AttachProcess:
|
case svc::DebugEvent_AttachProcess:
|
||||||
this->HandleDebugEventInfoAttachProcess(d);
|
this->HandleDebugEventInfoAttachProcess(d);
|
||||||
break;
|
break;
|
||||||
case svc::DebugEventType::AttachThread:
|
case svc::DebugEvent_AttachThread:
|
||||||
this->HandleDebugEventInfoAttachThread(d);
|
this->HandleDebugEventInfoAttachThread(d);
|
||||||
break;
|
break;
|
||||||
case svc::DebugEventType::Exception:
|
case svc::DebugEvent_Exception:
|
||||||
this->HandleDebugEventInfoException(d);
|
this->HandleDebugEventInfoException(d);
|
||||||
break;
|
break;
|
||||||
case svc::DebugEventType::ExitProcess:
|
case svc::DebugEvent_ExitProcess:
|
||||||
case svc::DebugEventType::ExitThread:
|
case svc::DebugEvent_ExitThread:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,34 +210,34 @@ namespace ams::creport {
|
||||||
|
|
||||||
void CrashReport::HandleDebugEventInfoException(const svc::DebugEventInfo &d) {
|
void CrashReport::HandleDebugEventInfoException(const svc::DebugEventInfo &d) {
|
||||||
switch (d.info.exception.type) {
|
switch (d.info.exception.type) {
|
||||||
case svc::DebugExceptionType::UndefinedInstruction:
|
case svc::DebugException_UndefinedInstruction:
|
||||||
this->result = ResultUndefinedInstruction();
|
this->result = ResultUndefinedInstruction();
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::InstructionAbort:
|
case svc::DebugException_InstructionAbort:
|
||||||
this->result = ResultInstructionAbort();
|
this->result = ResultInstructionAbort();
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::DataAbort:
|
case svc::DebugException_DataAbort:
|
||||||
this->result = ResultDataAbort();
|
this->result = ResultDataAbort();
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::AlignmentFault:
|
case svc::DebugException_AlignmentFault:
|
||||||
this->result = ResultAlignmentFault();
|
this->result = ResultAlignmentFault();
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::UserBreak:
|
case svc::DebugException_UserBreak:
|
||||||
this->result = ResultUserBreak();
|
this->result = ResultUserBreak();
|
||||||
/* Try to parse out the user break result. */
|
/* Try to parse out the user break result. */
|
||||||
if (hos::GetVersion() >= hos::Version_500) {
|
if (hos::GetVersion() >= hos::Version_500) {
|
||||||
svcReadDebugProcessMemory(&this->result, this->debug_handle, d.info.exception.specific.user_break.address, sizeof(this->result));
|
svcReadDebugProcessMemory(&this->result, this->debug_handle, d.info.exception.specific.user_break.address, sizeof(this->result));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::UndefinedSystemCall:
|
case svc::DebugException_UndefinedSystemCall:
|
||||||
this->result = ResultUndefinedSystemCall();
|
this->result = ResultUndefinedSystemCall();
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::SystemMemoryError:
|
case svc::DebugException_MemorySystemError:
|
||||||
this->result = ResultSystemMemoryError();
|
this->result = ResultMemorySystemError();
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::DebuggerAttached:
|
case svc::DebugException_DebuggerAttached:
|
||||||
case svc::DebugExceptionType::BreakPoint:
|
case svc::DebugException_BreakPoint:
|
||||||
case svc::DebugExceptionType::DebuggerBreak:
|
case svc::DebugException_DebuggerBreak:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,22 +322,22 @@ namespace ams::creport {
|
||||||
|
|
||||||
/* Exception Info. */
|
/* Exception Info. */
|
||||||
fprintf(f_report, "Exception Info:\n");
|
fprintf(f_report, "Exception Info:\n");
|
||||||
fprintf(f_report, " Type: %s\n", GetDebugExceptionTypeString(this->exception_info.type));
|
fprintf(f_report, " Type: %s\n", GetDebugExceptionString(this->exception_info.type));
|
||||||
fprintf(f_report, " Address: %s\n", this->module_list.GetFormattedAddressString(this->exception_info.address));
|
fprintf(f_report, " Address: %s\n", this->module_list.GetFormattedAddressString(this->exception_info.address));
|
||||||
switch (this->exception_info.type) {
|
switch (this->exception_info.type) {
|
||||||
case svc::DebugExceptionType::UndefinedInstruction:
|
case svc::DebugException_UndefinedInstruction:
|
||||||
fprintf(f_report, " Opcode: %08x\n", this->exception_info.specific.undefined_instruction.insn);
|
fprintf(f_report, " Opcode: %08x\n", this->exception_info.specific.undefined_instruction.insn);
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::DataAbort:
|
case svc::DebugException_DataAbort:
|
||||||
case svc::DebugExceptionType::AlignmentFault:
|
case svc::DebugException_AlignmentFault:
|
||||||
if (this->exception_info.specific.raw != this->exception_info.address) {
|
if (this->exception_info.specific.raw != this->exception_info.address) {
|
||||||
fprintf(f_report, " Fault Address: %s\n", this->module_list.GetFormattedAddressString(this->exception_info.specific.raw));
|
fprintf(f_report, " Fault Address: %s\n", this->module_list.GetFormattedAddressString(this->exception_info.specific.raw));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::UndefinedSystemCall:
|
case svc::DebugException_UndefinedSystemCall:
|
||||||
fprintf(f_report, " Svc Id: 0x%02x\n", this->exception_info.specific.undefined_system_call.id);
|
fprintf(f_report, " Svc Id: 0x%02x\n", this->exception_info.specific.undefined_system_call.id);
|
||||||
break;
|
break;
|
||||||
case svc::DebugExceptionType::UserBreak:
|
case svc::DebugException_UserBreak:
|
||||||
fprintf(f_report, " Break Reason: 0x%x\n", this->exception_info.specific.user_break.break_reason);
|
fprintf(f_report, " Break Reason: 0x%x\n", this->exception_info.specific.user_break.break_reason);
|
||||||
fprintf(f_report, " Break Address: %s\n", this->module_list.GetFormattedAddressString(this->exception_info.specific.user_break.address));
|
fprintf(f_report, " Break Address: %s\n", this->module_list.GetFormattedAddressString(this->exception_info.specific.user_break.address));
|
||||||
fprintf(f_report, " Break Size: 0x%lx\n", this->exception_info.specific.user_break.size);
|
fprintf(f_report, " Break Size: 0x%lx\n", this->exception_info.specific.user_break.size);
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace ams::creport {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsUserBreak() const {
|
bool IsUserBreak() const {
|
||||||
return this->exception_info.type == svc::DebugExceptionType::UserBreak;
|
return this->exception_info.type == svc::DebugException_UserBreak;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenProcess(os::ProcessId process_id) {
|
bool OpenProcess(os::ProcessId process_id) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ namespace ams::creport {
|
||||||
}
|
}
|
||||||
|
|
||||||
const svc::ThreadState thread_state = static_cast<svc::ThreadState>(_thread_state);
|
const svc::ThreadState thread_state = static_cast<svc::ThreadState>(_thread_state);
|
||||||
if (thread_state != svc::ThreadState::Waiting && thread_state != svc::ThreadState::Running) {
|
if (thread_state != svc::ThreadState_Waiting && thread_state != svc::ThreadState_Running) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
size_t target_core = NumCores - 1;
|
size_t target_core = NumCores - 1;
|
||||||
|
|
||||||
/* Retrieve correct core for new thread event. */
|
/* Retrieve correct core for new thread event. */
|
||||||
if (dbg_event.type == svc::DebugEventType::AttachThread) {
|
if (dbg_event.type == svc::DebugEvent_AttachThread) {
|
||||||
u64 out64 = 0;
|
u64 out64 = 0;
|
||||||
u32 out32 = 0;
|
u32 out32 = 0;
|
||||||
R_ASSERT(svcGetDebugThreadParam(&out64, &out32, debug_handle, dbg_event.info.attach_thread.thread_id, DebugThreadParam_CurrentCore));
|
R_ASSERT(svcGetDebugThreadParam(&out64, &out32, debug_handle, dbg_event.info.attach_thread.thread_id, DebugThreadParam_CurrentCore));
|
||||||
|
@ -109,7 +109,7 @@ namespace ams::dmnt::cheat::impl {
|
||||||
svc::DebugEventInfo d;
|
svc::DebugEventInfo d;
|
||||||
size_t target_core = NumCores - 1;
|
size_t target_core = NumCores - 1;
|
||||||
while (R_SUCCEEDED(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), cheat_dbg_hnd))) {
|
while (R_SUCCEEDED(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), cheat_dbg_hnd))) {
|
||||||
if (d.type == svc::DebugEventType::AttachThread) {
|
if (d.type == svc::DebugEvent_AttachThread) {
|
||||||
target_core = GetTargetCore(d, cheat_dbg_hnd);
|
target_core = GetTargetCore(d, cheat_dbg_hnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace ams::fatal::srv {
|
||||||
}
|
}
|
||||||
|
|
||||||
const svc::ThreadState thread_state = static_cast<svc::ThreadState>(_thread_state);
|
const svc::ThreadState thread_state = static_cast<svc::ThreadState>(_thread_state);
|
||||||
if (thread_state != svc::ThreadState::Waiting && thread_state != svc::ThreadState::Running) {
|
if (thread_state != svc::ThreadState_Waiting && thread_state != svc::ThreadState_Running) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,17 +181,17 @@ namespace ams::fatal::srv {
|
||||||
svc::DebugEventInfo d;
|
svc::DebugEventInfo d;
|
||||||
while (R_SUCCEEDED(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), debug_handle.Get()))) {
|
while (R_SUCCEEDED(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), debug_handle.Get()))) {
|
||||||
switch (d.type) {
|
switch (d.type) {
|
||||||
case svc::DebugEventType::AttachProcess:
|
case svc::DebugEvent_AttachProcess:
|
||||||
ctx->cpu_ctx.architecture = (d.info.attach_process.flags & 1) ? CpuContext::Architecture_Aarch64 : CpuContext::Architecture_Aarch32;
|
ctx->cpu_ctx.architecture = (d.info.attach_process.flags & 1) ? CpuContext::Architecture_Aarch64 : CpuContext::Architecture_Aarch32;
|
||||||
std::memcpy(ctx->proc_name, d.info.attach_process.name, sizeof(d.info.attach_process.name));
|
std::memcpy(ctx->proc_name, d.info.attach_process.name, sizeof(d.info.attach_process.name));
|
||||||
got_attach_process = true;
|
got_attach_process = true;
|
||||||
break;
|
break;
|
||||||
case svc::DebugEventType::AttachThread:
|
case svc::DebugEvent_AttachThread:
|
||||||
thread_id_to_tls[d.info.attach_thread.thread_id] = d.info.attach_thread.tls_address;
|
thread_id_to_tls[d.info.attach_thread.thread_id] = d.info.attach_thread.tls_address;
|
||||||
break;
|
break;
|
||||||
case svc::DebugEventType::Exception:
|
case svc::DebugEvent_Exception:
|
||||||
case svc::DebugEventType::ExitProcess:
|
case svc::DebugEvent_ExitProcess:
|
||||||
case svc::DebugEventType::ExitThread:
|
case svc::DebugEvent_ExitThread:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,18 +68,6 @@ namespace ams::ldr {
|
||||||
return NsoNames[idx];
|
return NsoNames[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CreateProcessInfo {
|
|
||||||
char name[12];
|
|
||||||
u32 version;
|
|
||||||
ncm::ProgramId program_id;
|
|
||||||
u64 code_address;
|
|
||||||
u32 code_num_pages;
|
|
||||||
u32 flags;
|
|
||||||
Handle reslimit;
|
|
||||||
u32 system_resource_num_pages;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(CreateProcessInfo) == 0x30, "CreateProcessInfo definition!");
|
|
||||||
|
|
||||||
struct ProcessInfo {
|
struct ProcessInfo {
|
||||||
os::ManagedHandle process_handle;
|
os::ManagedHandle process_handle;
|
||||||
uintptr_t args_address;
|
uintptr_t args_address;
|
||||||
|
@ -310,14 +298,14 @@ namespace ams::ldr {
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetCreateProcessInfo(CreateProcessInfo *out, const Meta *meta, u32 flags, Handle reslimit_h) {
|
Result GetCreateProcessParameter(svc::CreateProcessParameter *out, const Meta *meta, u32 flags, Handle reslimit_h) {
|
||||||
/* Clear output. */
|
/* Clear output. */
|
||||||
std::memset(out, 0, sizeof(*out));
|
std::memset(out, 0, sizeof(*out));
|
||||||
|
|
||||||
/* Set name, version, program id, resource limit handle. */
|
/* Set name, version, program id, resource limit handle. */
|
||||||
std::memcpy(out->name, meta->npdm->program_name, sizeof(out->name) - 1);
|
std::memcpy(out->name, meta->npdm->program_name, sizeof(out->name) - 1);
|
||||||
out->version = meta->npdm->version;
|
out->version = meta->npdm->version;
|
||||||
out->program_id = meta->aci->program_id;
|
out->program_id = static_cast<u64>(meta->aci->program_id);
|
||||||
out->reslimit = reslimit_h;
|
out->reslimit = reslimit_h;
|
||||||
|
|
||||||
/* Set flags. */
|
/* Set flags. */
|
||||||
|
@ -345,7 +333,7 @@ namespace ams::ldr {
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DecideAddressSpaceLayout(ProcessInfo *out, CreateProcessInfo *out_cpi, const NsoHeader *nso_headers, const bool *has_nso, const args::ArgumentInfo *arg_info) {
|
Result DecideAddressSpaceLayout(ProcessInfo *out, svc::CreateProcessParameter *out_param, const NsoHeader *nso_headers, const bool *has_nso, const args::ArgumentInfo *arg_info) {
|
||||||
/* Clear output. */
|
/* Clear output. */
|
||||||
out->args_address = 0;
|
out->args_address = 0;
|
||||||
out->args_size = 0;
|
out->args_size = 0;
|
||||||
|
@ -381,7 +369,7 @@ namespace ams::ldr {
|
||||||
uintptr_t aslr_start = 0;
|
uintptr_t aslr_start = 0;
|
||||||
uintptr_t aslr_size = 0;
|
uintptr_t aslr_size = 0;
|
||||||
if (hos::GetVersion() >= hos::Version_200) {
|
if (hos::GetVersion() >= hos::Version_200) {
|
||||||
switch (out_cpi->flags & svc::CreateProcessFlag_AddressSpaceMask) {
|
switch (out_param->flags & svc::CreateProcessFlag_AddressSpaceMask) {
|
||||||
case svc::CreateProcessFlag_AddressSpace32Bit:
|
case svc::CreateProcessFlag_AddressSpace32Bit:
|
||||||
case svc::CreateProcessFlag_AddressSpace32BitWithoutAlias:
|
case svc::CreateProcessFlag_AddressSpace32BitWithoutAlias:
|
||||||
aslr_start = map::AslrBase32Bit;
|
aslr_start = map::AslrBase32Bit;
|
||||||
|
@ -399,7 +387,7 @@ namespace ams::ldr {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* On 1.0.0, only 2 address space types existed. */
|
/* On 1.0.0, only 2 address space types existed. */
|
||||||
if (out_cpi->flags & svc::CreateProcessFlag_AddressSpace64BitDeprecated) {
|
if (out_param->flags & svc::CreateProcessFlag_AddressSpace64BitDeprecated) {
|
||||||
aslr_start = map::AslrBase64BitDeprecated;
|
aslr_start = map::AslrBase64BitDeprecated;
|
||||||
aslr_size = map::AslrSize64BitDeprecated;
|
aslr_size = map::AslrSize64BitDeprecated;
|
||||||
} else {
|
} else {
|
||||||
|
@ -412,7 +400,7 @@ namespace ams::ldr {
|
||||||
/* Set Create Process output. */
|
/* Set Create Process output. */
|
||||||
uintptr_t aslr_slide = 0;
|
uintptr_t aslr_slide = 0;
|
||||||
uintptr_t free_size = (aslr_size - total_size);
|
uintptr_t free_size = (aslr_size - total_size);
|
||||||
if (out_cpi->flags & svc::CreateProcessFlag_EnableAslr) {
|
if (out_param->flags & svc::CreateProcessFlag_EnableAslr) {
|
||||||
/* Nintendo uses MT19937 (not os::GenerateRandomBytes), but we'll just use TinyMT for now. */
|
/* Nintendo uses MT19937 (not os::GenerateRandomBytes), but we'll just use TinyMT for now. */
|
||||||
aslr_slide = os::GenerateRandomU64(free_size / os::MemoryBlockUnitSize) * os::MemoryBlockUnitSize;
|
aslr_slide = os::GenerateRandomU64(free_size / os::MemoryBlockUnitSize) * os::MemoryBlockUnitSize;
|
||||||
}
|
}
|
||||||
|
@ -428,22 +416,22 @@ namespace ams::ldr {
|
||||||
out->args_address += aslr_start;
|
out->args_address += aslr_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_cpi->code_address = aslr_start;
|
out_param->code_address = aslr_start;
|
||||||
out_cpi->code_num_pages = total_size >> 12;
|
out_param->code_num_pages = total_size >> 12;
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreateProcessImpl(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const bool *has_nso, const args::ArgumentInfo *arg_info, u32 flags, Handle reslimit_h) {
|
Result CreateProcessImpl(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const bool *has_nso, const args::ArgumentInfo *arg_info, u32 flags, Handle reslimit_h) {
|
||||||
/* Get CreateProcessInfo. */
|
/* Get CreateProcessParameter. */
|
||||||
CreateProcessInfo cpi;
|
svc::CreateProcessParameter param;
|
||||||
R_TRY(GetCreateProcessInfo(&cpi, meta, flags, reslimit_h));
|
R_TRY(GetCreateProcessParameter(¶m, meta, flags, reslimit_h));
|
||||||
|
|
||||||
/* Decide on an NSO layout. */
|
/* Decide on an NSO layout. */
|
||||||
R_TRY(DecideAddressSpaceLayout(out, &cpi, nso_headers, has_nso, arg_info));
|
R_TRY(DecideAddressSpaceLayout(out, ¶m, nso_headers, has_nso, arg_info));
|
||||||
|
|
||||||
/* Actually create process. const_cast necessary because libnx doesn't declare svcCreateProcess with const u32*. */
|
/* Actually create process. const_cast necessary because libnx doesn't declare svcCreateProcess with const u32*. */
|
||||||
return svcCreateProcess(out->process_handle.GetPointer(), &cpi, reinterpret_cast<const u32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(u32));
|
return svcCreateProcess(out->process_handle.GetPointer(), ¶m, reinterpret_cast<const u32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(u32));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result LoadNsoSegment(FILE *f, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) {
|
Result LoadNsoSegment(FILE *f, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace {
|
||||||
svc::DebugEventInfo d;
|
svc::DebugEventInfo d;
|
||||||
while (true) {
|
while (true) {
|
||||||
R_ASSERT(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), debug_handle.Get()));
|
R_ASSERT(svcGetDebugEvent(reinterpret_cast<u8 *>(&d), debug_handle.Get()));
|
||||||
if (d.type == svc::DebugEventType::AttachProcess) {
|
if (d.type == svc::DebugEvent_AttachProcess) {
|
||||||
return ncm::ProgramId{d.info.attach_process.program_id};
|
return ncm::ProgramId{d.info.attach_process.program_id};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,13 +137,12 @@ namespace ams::spl::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeDeviceAddressSpace() {
|
void InitializeDeviceAddressSpace() {
|
||||||
constexpr u64 DeviceName_SE = 29;
|
|
||||||
|
|
||||||
/* Create Address Space. */
|
/* Create Address Space. */
|
||||||
R_ASSERT(svcCreateDeviceAddressSpace(&g_se_das_hnd, 0, (1ul << 32)));
|
R_ASSERT(svcCreateDeviceAddressSpace(&g_se_das_hnd, 0, (1ul << 32)));
|
||||||
|
|
||||||
/* Attach it to the SE. */
|
/* Attach it to the SE. */
|
||||||
R_ASSERT(svcAttachDeviceAddressSpace(DeviceName_SE, g_se_das_hnd));
|
R_ASSERT(svcAttachDeviceAddressSpace(svc::DeviceName_Se, g_se_das_hnd));
|
||||||
|
|
||||||
const u64 work_buffer_addr = reinterpret_cast<u64>(g_work_buffer);
|
const u64 work_buffer_addr = reinterpret_cast<u64>(g_work_buffer);
|
||||||
g_se_mapped_work_buffer_addr = WorkBufferMapBase + (work_buffer_addr % DeviceAddressSpaceAlign);
|
g_se_mapped_work_buffer_addr = WorkBufferMapBase + (work_buffer_addr % DeviceAddressSpaceAlign);
|
||||||
|
|
Loading…
Reference in a new issue