diff --git a/libstratosphere/include/stratosphere/dd/dd_device_address_space_api.hpp b/libstratosphere/include/stratosphere/dd/dd_device_address_space_api.hpp index 58f53bfc..814c66c0 100644 --- a/libstratosphere/include/stratosphere/dd/dd_device_address_space_api.hpp +++ b/libstratosphere/include/stratosphere/dd/dd_device_address_space_api.hpp @@ -25,9 +25,9 @@ namespace ams::dd { Result CreateDeviceAddressSpace(DeviceAddressSpaceType *das, u64 size); void DestroyDeviceAddressSpace(DeviceAddressSpaceType *das); - void AttachDeviceAddressSpaceHandle(DeviceAddressSpaceType *das, Handle handle, bool managed); + void AttachDeviceAddressSpaceHandle(DeviceAddressSpaceType *das, DeviceAddressSpaceHandle handle, bool managed); - Handle GetDeviceAddressSpaceHandle(DeviceAddressSpaceType *das); + DeviceAddressSpaceHandle GetDeviceAddressSpaceHandle(DeviceAddressSpaceType *das); Result MapDeviceAddressSpaceAligned(DeviceAddressSpaceType *das, ProcessHandle process_handle, u64 process_address, size_t size, DeviceVirtualAddress device_address, MemoryPermission device_perm); Result MapDeviceAddressSpaceNotAligned(DeviceAddressSpaceType *das, ProcessHandle process_handle, u64 process_address, size_t size, DeviceVirtualAddress device_address, MemoryPermission device_perm); diff --git a/libstratosphere/include/stratosphere/dd/dd_device_address_space_common.hpp b/libstratosphere/include/stratosphere/dd/dd_device_address_space_common.hpp index ec174b99..6b322671 100644 --- a/libstratosphere/include/stratosphere/dd/dd_device_address_space_common.hpp +++ b/libstratosphere/include/stratosphere/dd/dd_device_address_space_common.hpp @@ -20,6 +20,7 @@ namespace ams::dd { using DeviceName = ::ams::svc::DeviceName; + using enum ::ams::svc::DeviceName; constexpr inline u64 DeviceAddressSpaceMemoryRegionAlignment = 4_KB; diff --git a/libstratosphere/include/stratosphere/dd/dd_device_address_space_types.hpp b/libstratosphere/include/stratosphere/dd/dd_device_address_space_types.hpp index fe5e5d8e..40887f18 100644 --- a/libstratosphere/include/stratosphere/dd/dd_device_address_space_types.hpp +++ b/libstratosphere/include/stratosphere/dd/dd_device_address_space_types.hpp @@ -21,7 +21,7 @@ namespace ams::dd { using DeviceVirtualAddress = u64; - using DeviceAddressSpaceHandle = ::Handle; + using DeviceAddressSpaceHandle = os::NativeHandle; struct DeviceAddressSpaceType { enum State { diff --git a/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp b/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp index 6bf6efc1..dd5d34b9 100644 --- a/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp +++ b/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp @@ -20,7 +20,7 @@ namespace ams::ldr::pm { /* Process Manager API. */ - Result CreateProcess(Handle *out, PinId pin_id, u32 flags, Handle reslimit); + Result CreateProcess(os::NativeHandle *out, PinId pin_id, u32 flags, os::NativeHandle reslimit); Result GetProgramInfo(ProgramInfo *out, const ncm::ProgramLocation &loc); Result PinProgram(PinId *out, const ncm::ProgramLocation &loc); Result UnpinProgram(PinId pin_id); diff --git a/libstratosphere/include/stratosphere/map/map_types.hpp b/libstratosphere/include/stratosphere/map/map_types.hpp index 214dfee9..9dc92788 100644 --- a/libstratosphere/include/stratosphere/map/map_types.hpp +++ b/libstratosphere/include/stratosphere/map/map_types.hpp @@ -73,7 +73,7 @@ namespace ams::map { class MappedCodeMemory { private: - Handle process_handle; + os::NativeHandle process_handle; Result result; uintptr_t dst_address; uintptr_t src_address; @@ -83,7 +83,7 @@ namespace ams::map { /* ... */ } - MappedCodeMemory(Handle p_h, uintptr_t dst, uintptr_t src, size_t sz) : process_handle(p_h), dst_address(dst), src_address(src), size(sz) { + MappedCodeMemory(os::NativeHandle p_h, uintptr_t dst, uintptr_t src, size_t sz) : process_handle(p_h), dst_address(dst), src_address(src), size(sz) { this->result = svc::MapProcessCodeMemory(this->process_handle, this->dst_address, this->src_address, this->size); } diff --git a/libstratosphere/include/stratosphere/osdbg/osdbg_thread_api.hpp b/libstratosphere/include/stratosphere/osdbg/osdbg_thread_api.hpp index 5224bf81..316107b7 100644 --- a/libstratosphere/include/stratosphere/osdbg/osdbg_thread_api.hpp +++ b/libstratosphere/include/stratosphere/osdbg/osdbg_thread_api.hpp @@ -21,7 +21,7 @@ namespace ams::osdbg { struct ThreadInfo; - Result InitializeThreadInfo(ThreadInfo *thread_info, svc::Handle debug_handle, const svc::DebugInfoCreateProcess *create_process, const svc::DebugInfoCreateThread *create_thread); + Result InitializeThreadInfo(ThreadInfo *thread_info, os::NativeHandle debug_handle, const svc::DebugInfoCreateProcess *create_process, const svc::DebugInfoCreateThread *create_thread); Result UpdateThreadInfo(ThreadInfo *thread_info); Result GetThreadName(char *dst, const ThreadInfo *thread_info); diff --git a/libstratosphere/include/stratosphere/osdbg/osdbg_thread_types.hpp b/libstratosphere/include/stratosphere/osdbg/osdbg_thread_types.hpp index 3da8c806..c4ac6f02 100644 --- a/libstratosphere/include/stratosphere/osdbg/osdbg_thread_types.hpp +++ b/libstratosphere/include/stratosphere/osdbg/osdbg_thread_types.hpp @@ -40,7 +40,7 @@ namespace ams::osdbg { uintptr_t _function; uintptr_t _name_pointer; impl::ThreadTypeCommon *_thread_type; - svc::Handle _debug_handle; + os::NativeHandle _debug_handle; ThreadTypeType _thread_type_type; svc::DebugInfoCreateProcess _debug_info_create_process; svc::DebugInfoCreateThread _debug_info_create_thread; diff --git a/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp b/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp index 3f6c9d9b..7161174c 100644 --- a/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp +++ b/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp @@ -31,7 +31,7 @@ namespace ams::sf::cmif { class ServerMessageProcessor; struct HandlesToClose { - Handle handles[8]; + os::NativeHandle handles[8]; size_t num_handles; }; diff --git a/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp b/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp index 352589f1..5ed4b95e 100644 --- a/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp +++ b/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp @@ -55,7 +55,7 @@ namespace ams::sf::hipc { NON_MOVEABLE(Server); private: cmif::ServiceObjectHolder static_object; - ::Handle port_handle; + os::NativeHandle port_handle; sm::ServiceName service_name; int index; bool service_managed; @@ -95,7 +95,7 @@ namespace ams::sf::hipc { Result ProcessForMitmServer(os::MultiWaitHolderType *holder); Result ProcessForSession(os::MultiWaitHolderType *holder); - void RegisterServerImpl(Server *server, Handle port_handle, bool is_mitm_server) { + void RegisterServerImpl(Server *server, os::NativeHandle port_handle, bool is_mitm_server) { server->port_handle = port_handle; hipc::AttachMultiWaitHolderForAccept(server, port_handle); @@ -111,7 +111,7 @@ namespace ams::sf::hipc { os::LinkMultiWaitHolder(std::addressof(this->multi_wait), server); } - void RegisterServerImpl(int index, cmif::ServiceObjectHolder &&static_holder, Handle port_handle, bool is_mitm_server) { + void RegisterServerImpl(int index, cmif::ServiceObjectHolder &&static_holder, os::NativeHandle port_handle, bool is_mitm_server) { /* Allocate server memory. */ auto *server = this->AllocateServer(); AMS_ABORT_UNLESS(server != nullptr); @@ -128,7 +128,7 @@ namespace ams::sf::hipc { Result RegisterServerImpl(int index, cmif::ServiceObjectHolder &&static_holder, sm::ServiceName service_name, size_t max_sessions) { /* Register service. */ - Handle port_handle; + os::NativeHandle port_handle; R_TRY(sm::RegisterService(&port_handle, service_name, max_sessions, false)); /* Allocate server memory. */ @@ -151,7 +151,7 @@ namespace ams::sf::hipc { template Result RegisterMitmServerImpl(int index, cmif::ServiceObjectHolder &&static_holder, sm::ServiceName service_name) { /* Install mitm service. */ - Handle port_handle; + os::NativeHandle port_handle; R_TRY(this->InstallMitmServerImpl(&port_handle, service_name, &Interface::ShouldMitm)); /* Allocate server memory. */ @@ -171,7 +171,7 @@ namespace ams::sf::hipc { return ResultSuccess(); } - Result InstallMitmServerImpl(Handle *out_port_handle, sm::ServiceName service_name, MitmQueryFunction query_func); + Result InstallMitmServerImpl(os::NativeHandle *out_port_handle, sm::ServiceName service_name, MitmQueryFunction query_func); protected: virtual Server *AllocateServer() = 0; virtual void DestroyServer(Server *server) = 0; @@ -205,7 +205,7 @@ namespace ams::sf::hipc { } template - void RegisterObjectForServer(SharedPointer static_object, Handle port_handle) { + void RegisterObjectForServer(SharedPointer static_object, os::NativeHandle port_handle) { this->RegisterServerImpl(0, cmif::ServiceObjectHolder(std::move(static_object)), port_handle, false); } @@ -214,7 +214,7 @@ namespace ams::sf::hipc { return this->RegisterServerImpl(0, cmif::ServiceObjectHolder(std::move(static_object)), service_name, max_sessions); } - void RegisterServer(int port_index, Handle port_handle) { + void RegisterServer(int port_index, os::NativeHandle port_handle) { this->RegisterServerImpl(port_index, cmif::ServiceObjectHolder(), port_handle, false); } diff --git a/libstratosphere/include/stratosphere/sm/sm_api.hpp b/libstratosphere/include/stratosphere/sm/sm_api.hpp index f2202b22..eac646c7 100644 --- a/libstratosphere/include/stratosphere/sm/sm_api.hpp +++ b/libstratosphere/include/stratosphere/sm/sm_api.hpp @@ -26,7 +26,7 @@ namespace ams::sm { /* Ordinary SM API. */ Result GetService(Service *out, ServiceName name); - Result RegisterService(Handle *out, ServiceName name, size_t max_sessions, bool is_light); + Result RegisterService(os::NativeHandle *out, ServiceName name, size_t max_sessions, bool is_light); Result UnregisterService(ServiceName name); /* Atmosphere extensions. */ diff --git a/libstratosphere/include/stratosphere/sm/sm_mitm_api.hpp b/libstratosphere/include/stratosphere/sm/sm_mitm_api.hpp index 20163c00..22b07cfd 100644 --- a/libstratosphere/include/stratosphere/sm/sm_mitm_api.hpp +++ b/libstratosphere/include/stratosphere/sm/sm_mitm_api.hpp @@ -21,7 +21,7 @@ namespace ams::sm::mitm { /* Mitm API. */ - Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name); + Result InstallMitm(os::NativeHandle *out_port, os::NativeHandle *out_query, ServiceName name); Result UninstallMitm(ServiceName name); Result DeclareFutureMitm(ServiceName name); Result ClearFutureMitm(ServiceName name); diff --git a/libstratosphere/include/stratosphere/tipc/tipc_object_holder.hpp b/libstratosphere/include/stratosphere/tipc/tipc_object_holder.hpp index 45ffd0a6..9e3ebdb9 100644 --- a/libstratosphere/include/stratosphere/tipc/tipc_object_holder.hpp +++ b/libstratosphere/include/stratosphere/tipc/tipc_object_holder.hpp @@ -28,12 +28,12 @@ namespace ams::tipc { ObjectType_Session = 2, }; private: - svc::Handle m_handle; + os::NativeHandle m_handle; ObjectType m_type; bool m_managed; tipc::ServiceObjectBase *m_object; private: - void InitializeImpl(ObjectType type, svc::Handle handle, bool managed, tipc::ServiceObjectBase *object) { + void InitializeImpl(ObjectType type, os::NativeHandle handle, bool managed, tipc::ServiceObjectBase *object) { /* Validate that the object isn't already constructed. */ AMS_ASSERT(m_type == ObjectType_Invalid); @@ -44,16 +44,16 @@ namespace ams::tipc { m_object = object; } public: - constexpr inline ObjectHolder() : m_handle(svc::InvalidHandle), m_type(ObjectType_Invalid), m_managed(false), m_object(nullptr) { /* ... */ } + constexpr inline ObjectHolder() : m_handle(os::InvalidNativeHandle), m_type(ObjectType_Invalid), m_managed(false), m_object(nullptr) { /* ... */ } - void InitializeAsPort(svc::Handle handle) { + void InitializeAsPort(os::NativeHandle handle) { /* NOTE: Nintendo sets ports as managed, but this will cause a nullptr-deref if one is ever closed. */ /* This is theoretically a non-issue, as ports can't be closed, but we will set ours as unmanaged, */ /* just in case. */ this->InitializeImpl(ObjectType_Port, handle, false, nullptr); } - void InitializeAsSession(svc::Handle handle, bool managed, tipc::ServiceObjectBase *object) { + void InitializeAsSession(os::NativeHandle handle, bool managed, tipc::ServiceObjectBase *object) { this->InitializeImpl(ObjectType_Session, handle, managed, object); } @@ -69,13 +69,13 @@ namespace ams::tipc { } /* Reset all fields. */ - m_handle = svc::InvalidHandle; + m_handle = os::InvalidNativeHandle; m_type = ObjectType_Invalid; m_managed = false; m_object = nullptr; } - constexpr svc::Handle GetHandle() const { + constexpr os::NativeHandle GetHandle() const { return m_handle; } diff --git a/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp b/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp index 350c519e..221e09a6 100644 --- a/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp +++ b/libstratosphere/include/stratosphere/tipc/tipc_object_manager.hpp @@ -37,7 +37,7 @@ namespace ams::tipc { Entry *m_entries_end{}; os::MultiWaitType *m_multi_wait{}; private: - Entry *FindEntry(svc::Handle handle) { + Entry *FindEntry(os::NativeHandle handle) { for (Entry *cur = m_entries_start; cur != m_entries_end; ++cur) { if (GetReference(cur->object).GetHandle() == handle) { return cur; @@ -76,7 +76,7 @@ namespace ams::tipc { std::scoped_lock lk(m_mutex); /* Find an empty entry. */ - auto *entry = this->FindEntry(svc::InvalidHandle); + auto *entry = this->FindEntry(os::InvalidNativeHandle); AMS_ABORT_UNLESS(entry != nullptr); /* Set the entry's object. */ @@ -87,7 +87,7 @@ namespace ams::tipc { os::LinkMultiWaitHolder(m_multi_wait, std::addressof(entry->multi_wait_holder)); } - void CloseObject(svc::Handle handle) { + void CloseObject(os::NativeHandle handle) { /* Lock ourselves. */ std::scoped_lock lk(m_mutex); @@ -103,14 +103,14 @@ namespace ams::tipc { GetReference(entry->object).Destroy(); } - Result ReplyAndReceive(os::MultiWaitHolderType **out_holder, ObjectHolder *out_object, svc::Handle reply_target, os::MultiWaitType *multi_wait) { + Result ReplyAndReceive(os::MultiWaitHolderType **out_holder, ObjectHolder *out_object, os::NativeHandle reply_target, os::MultiWaitType *multi_wait) { /* Declare signaled holder for processing ahead of time. */ os::MultiWaitHolderType *signaled_holder; /* Reply and receive until we get a newly signaled target. */ Result result = os::SdkReplyAndReceive(out_holder, reply_target, multi_wait); for (signaled_holder = *out_holder; signaled_holder == nullptr; signaled_holder = *out_holder) { - result = os::SdkReplyAndReceive(out_holder, svc::InvalidHandle, multi_wait); + result = os::SdkReplyAndReceive(out_holder, os::InvalidNativeHandle, multi_wait); } /* Find the entry matching the signaled holder. */ @@ -125,7 +125,7 @@ namespace ams::tipc { } } - Result Reply(svc::Handle reply_target) { + Result Reply(os::NativeHandle reply_target) { /* Perform the reply. */ s32 dummy; R_TRY_CATCH(svc::ReplyAndReceive(std::addressof(dummy), nullptr, 0, reply_target, 0)) { diff --git a/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp b/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp index c67c1340..6f5f897b 100644 --- a/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp +++ b/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp @@ -141,7 +141,7 @@ namespace ams::tipc { m_object_manager = manager; } - void RegisterPort(s32 index, svc::Handle port_handle) { + void RegisterPort(s32 index, os::NativeHandle port_handle) { /* Set our port number. */ this->m_port_number = index; @@ -168,11 +168,11 @@ namespace ams::tipc { return m_object_manager->Reply(object.GetHandle()); } - Result ReplyAndReceive(os::MultiWaitHolderType **out_holder, ObjectHolder *out_object, svc::Handle reply_target) { + Result ReplyAndReceive(os::MultiWaitHolderType **out_holder, ObjectHolder *out_object, os::NativeHandle reply_target) { return m_object_manager->ReplyAndReceive(out_holder, out_object, reply_target, std::addressof(m_multi_wait)); } - void AddSession(svc::Handle session_handle, tipc::ServiceObjectBase *service_object) { + void AddSession(os::NativeHandle session_handle, tipc::ServiceObjectBase *service_object) { /* Create an object holder for the session. */ tipc::ObjectHolder object; @@ -195,7 +195,7 @@ namespace ams::tipc { case MessageType_AddSession: { /* Get the handle from where it's packed into the message type. */ - const svc::Handle session_handle = static_cast(message_type >> BITSIZEOF(u32)); + const os::NativeHandle session_handle = static_cast(message_type >> BITSIZEOF(u32)); /* Allocate a service object for the port. */ auto *service_object = m_server_manager->AllocateObject(static_cast(message_data)); @@ -292,7 +292,7 @@ namespace ams::tipc { os::SendMessageQueue(std::addressof(m_message_queue), ConvertKeyToMessage(key)); } - void TriggerAddSession(svc::Handle session_handle, size_t port_index) { + void TriggerAddSession(os::NativeHandle session_handle, size_t port_index) { /* Acquire exclusive server manager access. */ std::scoped_lock lk(m_server_manager->GetMutex()); @@ -409,14 +409,14 @@ namespace ams::tipc { } template - void RegisterPort(svc::Handle port_handle) { + void RegisterPort(os::NativeHandle port_handle) { this->GetPortManager().RegisterPort(static_cast(Ix), port_handle); } template void RegisterPort(sm::ServiceName service_name, size_t max_sessions) { /* Register service. */ - svc::Handle port_handle = svc::InvalidHandle; + os::NativeHandle port_handle; R_ABORT_UNLESS(sm::RegisterService(std::addressof(port_handle), service_name, max_sessions, false)); /* Register the port handle. */ @@ -463,13 +463,13 @@ namespace ams::tipc { }(std::make_index_sequence()); } - Result AddSession(svc::Handle *out, tipc::ServiceObjectBase *object) { + Result AddSession(os::NativeHandle *out, tipc::ServiceObjectBase *object) { /* Acquire exclusive access to ourselves. */ std::scoped_lock lk(m_mutex); /* Create a handle for the session. */ svc::Handle session_handle; - R_TRY(svc::CreateSession(std::addressof(session_handle), out, false, 0)); + R_TRY(svc::CreateSession(std::addressof(session_handle), static_cast(out), false, 0)); /* Select the best port manager. */ PortManagerBase *best_manager = nullptr; @@ -514,7 +514,7 @@ namespace ams::tipc { std::memset(svc::ipc::GetMessageBuffer(), 0, svc::ipc::MessageBufferSize); /* Process requests forever. */ - svc::Handle reply_target = svc::InvalidHandle; + os::NativeHandle reply_target = os::InvalidNativeHandle; while (true) { /* Reply to our pending request, and receive a new one. */ os::MultiWaitHolderType *signaled_holder = nullptr; @@ -525,7 +525,7 @@ namespace ams::tipc { port_manager.CloseSession(signaled_object); /* We have nothing to reply to. */ - reply_target = svc::InvalidHandle; + reply_target = os::InvalidNativeHandle; continue; } } R_END_TRY_CATCH; @@ -542,7 +542,7 @@ namespace ams::tipc { } /* We have nothing to reply to. */ - reply_target = svc::InvalidHandle; + reply_target = os::InvalidNativeHandle; } break; case ObjectHolder::ObjectType_Session: @@ -557,7 +557,7 @@ namespace ams::tipc { port_manager.ProcessRegisterRetry(signaled_object); /* We have nothing to reply to. */ - reply_target = svc::InvalidHandle; + reply_target = os::InvalidNativeHandle; } else { /* We're done processing, so we should reply. */ reply_target = signaled_object.GetHandle(); @@ -571,7 +571,7 @@ namespace ams::tipc { port_manager.CloseSessionIfNecessary(signaled_object, !tipc::ResultSessionClosed::Includes(process_result)); /* We have nothing to reply to. */ - reply_target = svc::InvalidHandle; + reply_target = os::InvalidNativeHandle; } } break; @@ -582,12 +582,12 @@ namespace ams::tipc { port_manager.ProcessMessages(); /* We have nothing to reply to. */ - reply_target = svc::InvalidHandle; + reply_target = os::InvalidNativeHandle; } } } - void TriggerAddSession(svc::Handle session_handle, size_t port_index) { + void TriggerAddSession(os::NativeHandle session_handle, size_t port_index) { /* Acquire exclusive access to ourselves. */ std::scoped_lock lk(m_mutex); diff --git a/libstratosphere/source/dd/dd_device_address_space.cpp b/libstratosphere/source/dd/dd_device_address_space.cpp index ac25e13d..49c0ecba 100644 --- a/libstratosphere/source/dd/dd_device_address_space.cpp +++ b/libstratosphere/source/dd/dd_device_address_space.cpp @@ -59,16 +59,16 @@ namespace ams::dd { das->state = DeviceAddressSpaceType::State_NotInitialized; } - void AttachDeviceAddressSpaceHandle(DeviceAddressSpaceType *das, Handle handle, bool managed) { + void AttachDeviceAddressSpaceHandle(DeviceAddressSpaceType *das, DeviceAddressSpaceHandle handle, bool managed) { /* Check pre-conditions. */ - AMS_ASSERT(handle != svc::InvalidHandle); + AMS_ASSERT(handle != os::InvalidNativeHandle); das->device_handle = handle; das->is_handle_managed = managed; das->state = DeviceAddressSpaceType::State_Initialized; } - Handle GetDeviceAddressSpaceHandle(DeviceAddressSpaceType *das) { + DeviceAddressSpaceHandle GetDeviceAddressSpaceHandle(DeviceAddressSpaceType *das) { /* Check pre-conditions. */ AMS_ASSERT(das->state == DeviceAddressSpaceType::State_Initialized); diff --git a/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp b/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp index 9443994a..07f89cba 100644 --- a/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp +++ b/libstratosphere/source/htc/server/htc_htcmisc_impl.cpp @@ -108,7 +108,7 @@ namespace ams::htc::server { return ResultSuccess(); } - Result HtcmiscImpl::RunOnHostBegin(u32 *out_task_id, Handle *out_event, const char *args, size_t args_size) { + Result HtcmiscImpl::RunOnHostBegin(u32 *out_task_id, os::NativeHandle *out_event, const char *args, size_t args_size) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client.Begin(std::addressof(task_id), args, args_size)); diff --git a/libstratosphere/source/htc/server/htc_htcmisc_impl.hpp b/libstratosphere/source/htc/server/htc_htcmisc_impl.hpp index 538952a8..8ed96d5d 100644 --- a/libstratosphere/source/htc/server/htc_htcmisc_impl.hpp +++ b/libstratosphere/source/htc/server/htc_htcmisc_impl.hpp @@ -63,7 +63,7 @@ namespace ams::htc::server { Result GetEnvironmentVariable(size_t *out_size, char *dst, size_t dst_size, const char *name, size_t name_size); Result GetEnvironmentVariableLength(size_t *out_size, const char *name, size_t name_size); - Result RunOnHostBegin(u32 *out_task_id, Handle *out_event, const char *args, size_t args_size); + Result RunOnHostBegin(u32 *out_task_id, os::NativeHandle *out_event, const char *args, size_t args_size); Result RunOnHostEnd(s32 *out_result, u32 task_id); }; diff --git a/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp b/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp index f74d4b44..ea5b7066 100644 --- a/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp +++ b/libstratosphere/source/htc/server/rpc/htc_rpc_client.hpp @@ -199,7 +199,7 @@ namespace ams::htc::server::rpc { os::WaitEvent(m_task_table.Get(task_id)->GetEvent()); } - Handle DetachReadableHandle(u32 task_id) { + os::NativeHandle DetachReadableHandle(u32 task_id) { return os::DetachReadableHandleOfSystemEvent(m_task_table.Get(task_id)->GetSystemEvent()); } diff --git a/libstratosphere/source/htcs/impl/htcs_manager.cpp b/libstratosphere/source/htcs/impl/htcs_manager.cpp index b411eace..2300ae9e 100644 --- a/libstratosphere/source/htcs/impl/htcs_manager.cpp +++ b/libstratosphere/source/htcs/impl/htcs_manager.cpp @@ -204,7 +204,7 @@ namespace ams::htcs::impl { } } - Result HtcsManager::AcceptStart(u32 *out_task_id, Handle *out_handle, s32 desc) { + Result HtcsManager::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) { return m_impl->AcceptStart(out_task_id, out_handle, desc); } @@ -227,7 +227,7 @@ namespace ams::htcs::impl { } } - Result HtcsManager::RecvStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags) { + Result HtcsManager::RecvStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { return m_impl->RecvStart(out_task_id, out_handle, size, desc, flags); } @@ -255,11 +255,11 @@ namespace ams::htcs::impl { } } - Result HtcsManager::SendStart(u32 *out_task_id, Handle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) { + Result HtcsManager::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) { return m_impl->SendStart(out_task_id, out_handle, buffer, size, desc, flags); } - Result HtcsManager::SendLargeStart(u32 *out_task_id, Handle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) { + Result HtcsManager::SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) { return m_impl->SendLargeStart(out_task_id, out_handle, buffers, sizes, count, desc, flags); } @@ -287,7 +287,7 @@ namespace ams::htcs::impl { } } - Result HtcsManager::StartSend(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags) { + Result HtcsManager::StartSend(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) { return m_impl->StartSend(out_task_id, out_handle, desc, size, flags); } @@ -328,7 +328,7 @@ namespace ams::htcs::impl { } } - Result HtcsManager::StartRecv(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags) { + Result HtcsManager::StartRecv(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { return m_impl->StartRecv(out_task_id, out_handle, size, desc, flags); } @@ -356,7 +356,7 @@ namespace ams::htcs::impl { } } - Result HtcsManager::StartSelect(u32 *out_task_id, Handle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { + Result HtcsManager::StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { /* Invoke our implementation. */ R_TRY_CATCH(m_impl->StartSelect(out_task_id, out_handle, read_handles, write_handles, exception_handles, tv_sec, tv_usec)) { R_CONVERT(htc::ResultTaskCancelled, tma::ResultUnknown()) diff --git a/libstratosphere/source/htcs/impl/htcs_manager.hpp b/libstratosphere/source/htcs/impl/htcs_manager.hpp index 6f068e53..dc34c8d0 100644 --- a/libstratosphere/source/htcs/impl/htcs_manager.hpp +++ b/libstratosphere/source/htcs/impl/htcs_manager.hpp @@ -43,24 +43,24 @@ namespace ams::htcs::impl { void Shutdown(s32 *out_err, s32 *out_res, s32 how, s32 desc); void Fcntl(s32 *out_err, s32 *out_res, s32 command, s32 value, s32 desc); - Result AcceptStart(u32 *out_task_id, Handle *out_handle, s32 desc); + Result AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc); void AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc); - Result RecvStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags); + Result RecvStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags); void RecvResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc); - Result SendStart(u32 *out_task_id, Handle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags); - Result SendLargeStart(u32 *out_task_id, Handle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags); + Result SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags); + Result SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags); void SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc); - Result StartSend(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags); + Result StartSend(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags); Result ContinueSend(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc); void EndSend(s32 *out_err, s64 *out_size, u32 task_id, s32 desc); - Result StartRecv(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags); + Result StartRecv(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags); void EndRecv(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc); - Result StartSelect(u32 *out_task_id, Handle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec); + Result StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec); Result EndSelect(s32 *out_err, s32 *out_count, Span read_handles, Span write_handles, Span exception_handles, u32 task_id); }; diff --git a/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp b/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp index 6d78c3bf..b836c2c1 100644 --- a/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp +++ b/libstratosphere/source/htcs/impl/htcs_manager_impl.cpp @@ -82,7 +82,7 @@ namespace ams::htcs::impl { return m_service.Fcntl(out_err, out_res, desc, command, value); } - Result HtcsManagerImpl::AcceptStart(u32 *out_task_id, Handle *out_handle, s32 desc) { + Result HtcsManagerImpl::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) { return m_service.AcceptStart(out_task_id, out_handle, desc); } @@ -90,7 +90,7 @@ namespace ams::htcs::impl { return m_service.AcceptResults(out_err, out_desc, out_address, task_id, desc); } - Result HtcsManagerImpl::RecvStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags) { + Result HtcsManagerImpl::RecvStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { return m_service.ReceiveSmallStart(out_task_id, out_handle, size, desc, flags); } @@ -98,10 +98,10 @@ namespace ams::htcs::impl { return m_service.ReceiveSmallResults(out_err, out_size, buffer, buffer_size, task_id, desc); } - Result HtcsManagerImpl::SendStart(u32 *out_task_id, Handle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) { + Result HtcsManagerImpl::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags) { /* Start the send. */ u32 task_id; - Handle handle; + os::NativeHandle handle; R_TRY(m_service.SendSmallStart(std::addressof(task_id), std::addressof(handle), desc, size, flags)); /* Continue the send. */ @@ -126,7 +126,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsManagerImpl::SendLargeStart(u32 *out_task_id, Handle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) { + Result HtcsManagerImpl::SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags) { /* NOTE: Nintendo aborts here, too. */ AMS_ABORT("HtcsManagerImpl::SendLargeStart is not implemented"); } @@ -135,7 +135,7 @@ namespace ams::htcs::impl { return m_service.SendSmallResults(out_err, out_size, task_id, desc); } - Result HtcsManagerImpl::StartSend(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags) { + Result HtcsManagerImpl::StartSend(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) { return m_service.SendStart(out_task_id, out_handle, desc, size, flags); } @@ -147,7 +147,7 @@ namespace ams::htcs::impl { return m_service.SendResults(out_err, out_size, task_id, desc); } - Result HtcsManagerImpl::StartRecv(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags) { + Result HtcsManagerImpl::StartRecv(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { return m_service.ReceiveStart(out_task_id, out_handle, size, desc, flags); } @@ -155,10 +155,10 @@ namespace ams::htcs::impl { return m_service.ReceiveResults(out_err, out_size, buffer, buffer_size, task_id, desc); } - Result HtcsManagerImpl::StartSelect(u32 *out_task_id, Handle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { + Result HtcsManagerImpl::StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { /* Start the select. */ u32 task_id; - Handle handle; + os::NativeHandle handle; const Result result = m_service.SelectStart(std::addressof(task_id), std::addressof(handle), read_handles, write_handles, exception_handles, tv_sec, tv_usec); /* Ensure our state ends up clean. */ diff --git a/libstratosphere/source/htcs/impl/htcs_manager_impl.hpp b/libstratosphere/source/htcs/impl/htcs_manager_impl.hpp index e5aa1036..ba6917b8 100644 --- a/libstratosphere/source/htcs/impl/htcs_manager_impl.hpp +++ b/libstratosphere/source/htcs/impl/htcs_manager_impl.hpp @@ -52,24 +52,24 @@ namespace ams::htcs::impl { Result Shutdown(s32 *out_err, s32 desc, s32 how); Result Fcntl(s32 *out_err, s32 *out_res, s32 desc, s32 command, s32 value); - Result AcceptStart(u32 *out_task_id, Handle *out_handle, s32 desc); + Result AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc); Result AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc); - Result RecvStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags); + Result RecvStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags); Result RecvResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc); - Result SendStart(u32 *out_task_id, Handle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags); - Result SendLargeStart(u32 *out_task_id, Handle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags); + Result SendStart(u32 *out_task_id, os::NativeHandle *out_handle, const char *buffer, s64 size, s32 desc, s32 flags); + Result SendLargeStart(u32 *out_task_id, os::NativeHandle *out_handle, const char **buffers, const s64 *sizes, s32 count, s32 desc, s32 flags); Result SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc); - Result StartSend(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags); + Result StartSend(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags); Result ContinueSend(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc); Result EndSend(s32 *out_err, s64 *out_size, u32 task_id, s32 desc); - Result StartRecv(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags); + Result StartRecv(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags); Result EndRecv(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc); - Result StartSelect(u32 *out_task_id, Handle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec); + Result StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec); Result EndSelect(s32 *out_err, bool *out_empty, Span read_handles, Span write_handles, Span exception_handles, u32 task_id); }; diff --git a/libstratosphere/source/htcs/impl/htcs_service.cpp b/libstratosphere/source/htcs/impl/htcs_service.cpp index d5614e9c..3a00947b 100644 --- a/libstratosphere/source/htcs/impl/htcs_service.cpp +++ b/libstratosphere/source/htcs/impl/htcs_service.cpp @@ -196,7 +196,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsService::AcceptStart(u32 *out_task_id, Handle *out_handle, s32 desc) { + Result HtcsService::AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client->Begin(std::addressof(task_id), desc)); @@ -220,7 +220,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsService::ReceiveSmallStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags) { + Result HtcsService::ReceiveSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client->Begin(std::addressof(task_id), desc, size, static_cast(flags))); @@ -245,7 +245,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsService::SendSmallStart(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags) { + Result HtcsService::SendSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client->Begin(std::addressof(task_id), desc, size, static_cast(flags))); @@ -279,7 +279,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsService::SendStart(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags) { + Result HtcsService::SendStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client->Begin(std::addressof(task_id), desc, size, static_cast(flags))); @@ -325,7 +325,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsService::ReceiveStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags) { + Result HtcsService::ReceiveStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client->Begin(std::addressof(task_id), desc, size, static_cast(flags))); @@ -377,7 +377,7 @@ namespace ams::htcs::impl { return ResultSuccess(); } - Result HtcsService::SelectStart(u32 *out_task_id, Handle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { + Result HtcsService::SelectStart(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec) { /* Begin the task. */ u32 task_id; R_TRY(m_rpc_client->Begin(std::addressof(task_id), read_handles, write_handles, exception_handles, tv_sec, tv_usec)); diff --git a/libstratosphere/source/htcs/impl/htcs_service.hpp b/libstratosphere/source/htcs/impl/htcs_service.hpp index d379c3dc..bb7700fa 100644 --- a/libstratosphere/source/htcs/impl/htcs_service.hpp +++ b/libstratosphere/source/htcs/impl/htcs_service.hpp @@ -41,24 +41,24 @@ namespace ams::htcs::impl { Result Shutdown(s32 *out_err, s32 desc, s32 how); Result Fcntl(s32 *out_err, s32 *out_res, s32 desc, s32 command, s32 value); - Result AcceptStart(u32 *out_task_id, Handle *out_handle, s32 desc); + Result AcceptStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc); Result AcceptResults(s32 *out_err, s32 *out_desc, SockAddrHtcs *out_address, u32 task_id, s32 desc); - Result ReceiveSmallStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags); + Result ReceiveSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags); Result ReceiveSmallResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc); - Result SendSmallStart(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags); + Result SendSmallStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags); Result SendSmallContinue(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc); Result SendSmallResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc); - Result SendStart(u32 *out_task_id, Handle *out_handle, s32 desc, s64 size, s32 flags); + Result SendStart(u32 *out_task_id, os::NativeHandle *out_handle, s32 desc, s64 size, s32 flags); Result SendContinue(s64 *out_size, const char *buffer, s64 buffer_size, u32 task_id, s32 desc); Result SendResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc); - Result ReceiveStart(u32 *out_task_id, Handle *out_handle, s64 size, s32 desc, s32 flags); + Result ReceiveStart(u32 *out_task_id, os::NativeHandle *out_handle, s64 size, s32 desc, s32 flags); Result ReceiveResults(s32 *out_err, s64 *out_size, char *buffer, s64 buffer_size, u32 task_id, s32 desc); - Result SelectStart(u32 *out_task_id, Handle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec); + Result SelectStart(u32 *out_task_id, os::NativeHandle *out_handle, Span read_handles, Span write_handles, Span exception_handles, s64 tv_sec, s64 tv_usec); Result SelectEnd(s32 *out_err, bool *out_empty, Span read_handles, Span write_handles, Span exception_handles, u32 task_id); private: void WaitTask(u32 task_id); diff --git a/libstratosphere/source/ldr/ldr_pm_api.cpp b/libstratosphere/source/ldr/ldr_pm_api.cpp index 6b5af5c2..1a4856e4 100644 --- a/libstratosphere/source/ldr/ldr_pm_api.cpp +++ b/libstratosphere/source/ldr/ldr_pm_api.cpp @@ -19,7 +19,7 @@ namespace ams::ldr::pm { /* Information API. */ - Result CreateProcess(Handle *out, PinId pin_id, u32 flags, Handle reslimit) { + Result CreateProcess(os::NativeHandle *out, PinId pin_id, u32 flags, Handle reslimit) { return ldrPmCreateProcess(pin_id.value, flags, reslimit, out); } diff --git a/libstratosphere/source/osdbg/osdbg_thread.cpp b/libstratosphere/source/osdbg/osdbg_thread.cpp index 18eb7b28..6eb28015 100644 --- a/libstratosphere/source/osdbg/osdbg_thread.cpp +++ b/libstratosphere/source/osdbg/osdbg_thread.cpp @@ -23,7 +23,7 @@ namespace ams::osdbg { - Result InitializeThreadInfo(ThreadInfo *thread_info, svc::Handle debug_handle, const svc::DebugInfoCreateProcess *create_process, const svc::DebugInfoCreateThread *create_thread) { + Result InitializeThreadInfo(ThreadInfo *thread_info, os::NativeHandle debug_handle, const svc::DebugInfoCreateProcess *create_process, const svc::DebugInfoCreateThread *create_thread) { /* Set basic fields. */ thread_info->_thread_type = nullptr; thread_info->_thread_type_type = ThreadTypeType_Unknown; diff --git a/libstratosphere/source/pgl/srv/pgl_srv_api.cpp b/libstratosphere/source/pgl/srv/pgl_srv_api.cpp index 4fdbf3ce..d4dc7461 100644 --- a/libstratosphere/source/pgl/srv/pgl_srv_api.cpp +++ b/libstratosphere/source/pgl/srv/pgl_srv_api.cpp @@ -172,7 +172,7 @@ namespace ams::pgl::srv { LoopProcessServer(); } - Result AllocateShellEventObserverForTipc(svc::Handle *out) { + Result AllocateShellEventObserverForTipc(os::NativeHandle *out) { /* Get the shell event observer allocator. */ auto &allocator = GetGlobalsForTipc().observer_allocator; diff --git a/libstratosphere/source/pgl/srv/pgl_srv_tipc_utils.hpp b/libstratosphere/source/pgl/srv/pgl_srv_tipc_utils.hpp index 581573ea..c4ec6fc8 100644 --- a/libstratosphere/source/pgl/srv/pgl_srv_tipc_utils.hpp +++ b/libstratosphere/source/pgl/srv/pgl_srv_tipc_utils.hpp @@ -18,6 +18,6 @@ namespace ams::pgl::srv { - Result AllocateShellEventObserverForTipc(svc::Handle *out); + Result AllocateShellEventObserverForTipc(os::NativeHandle *out); } diff --git a/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.cpp b/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.cpp index bc4c5373..d5a829cb 100644 --- a/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.cpp +++ b/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.cpp @@ -54,7 +54,7 @@ namespace ams::sf::hipc::impl { } - void RegisterMitmQueryHandle(Handle query_handle, ServerManagerBase::MitmQueryFunction query_func) { + void RegisterMitmQueryHandle(os::NativeHandle query_handle, ServerManagerBase::MitmQueryFunction query_func) { std::scoped_lock lk(g_query_server_lock); if (AMS_UNLIKELY(!g_constructed_server)) { diff --git a/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.hpp b/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.hpp index af041c6c..0cd1518d 100644 --- a/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.hpp +++ b/libstratosphere/source/sf/hipc/sf_hipc_mitm_query_api.hpp @@ -18,6 +18,6 @@ namespace ams::sf::hipc::impl { - void RegisterMitmQueryHandle(Handle query_handle, ServerManagerBase::MitmQueryFunction query_func); + void RegisterMitmQueryHandle(os::NativeHandle query_handle, ServerManagerBase::MitmQueryFunction query_func); } diff --git a/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp b/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp index bb75e8a6..01086e15 100644 --- a/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp +++ b/libstratosphere/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp @@ -34,13 +34,13 @@ namespace ams::sf::hipc { ServerSession *session; bool is_mitm_session; private: - Result CloneCurrentObjectImpl(Handle *out_client_handle, ServerSessionManager *tagged_manager) { + Result CloneCurrentObjectImpl(os::NativeHandle *out_client_handle, ServerSessionManager *tagged_manager) { /* Clone the object. */ cmif::ServiceObjectHolder &&clone = this->session->srv_obj_holder.Clone(); R_UNLESS(clone, sf::hipc::ResultDomainObjectNotFound()); /* Create new session handles. */ - Handle server_handle; + os::NativeHandle server_handle; R_ABORT_UNLESS(hipc::CreateSession(&server_handle, out_client_handle)); /* Register with manager. */ @@ -118,18 +118,18 @@ namespace ams::sf::hipc { if (!this->is_mitm_session || object_id.value != serviceGetObjectId(this->session->forward_service.get())) { /* Create new session handles. */ - Handle server_handle; + os::NativeHandle server_handle; R_ABORT_UNLESS(hipc::CreateSession(&server_handle, out.GetHandlePointer())); /* Register. */ R_ABORT_UNLESS(this->manager->RegisterSession(server_handle, std::move(object))); } else { /* Copy from the target domain. */ - Handle new_forward_target; + os::NativeHandle new_forward_target; R_TRY(cmifCopyFromCurrentDomain(this->session->forward_service->session, object_id.value, &new_forward_target)); /* Create new session handles. */ - Handle server_handle; + os::NativeHandle server_handle; R_ABORT_UNLESS(hipc::CreateSession(&server_handle, out.GetHandlePointer())); /* Register. */ diff --git a/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp b/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp index a8827c63..f5823ba5 100644 --- a/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp +++ b/libstratosphere/source/sf/hipc/sf_hipc_server_manager.cpp @@ -18,9 +18,9 @@ namespace ams::sf::hipc { - Result ServerManagerBase::InstallMitmServerImpl(Handle *out_port_handle, sm::ServiceName service_name, ServerManagerBase::MitmQueryFunction query_func) { + Result ServerManagerBase::InstallMitmServerImpl(os::NativeHandle *out_port_handle, sm::ServiceName service_name, ServerManagerBase::MitmQueryFunction query_func) { /* Install the Mitm. */ - Handle query_handle; + os::NativeHandle query_handle; R_TRY(sm::mitm::InstallMitm(out_port_handle, &query_handle, service_name)); /* Register the query handle. */ diff --git a/libstratosphere/source/sm/sm_api.cpp b/libstratosphere/source/sm/sm_api.cpp index 4c46bb21..bd3b66f2 100644 --- a/libstratosphere/source/sm/sm_api.cpp +++ b/libstratosphere/source/sm/sm_api.cpp @@ -49,7 +49,7 @@ namespace ams::sm { return smGetServiceWrapper(out, impl::ConvertName(name)); } - Result RegisterService(Handle *out, ServiceName name, size_t max_sessions, bool is_light) { + Result RegisterService(os::NativeHandle *out, ServiceName name, size_t max_sessions, bool is_light) { return smRegisterService(out, impl::ConvertName(name), is_light, static_cast(max_sessions)); } diff --git a/libstratosphere/source/sm/sm_mitm_api.cpp b/libstratosphere/source/sm/sm_mitm_api.cpp index 34c56abe..82e392f1 100644 --- a/libstratosphere/source/sm/sm_mitm_api.cpp +++ b/libstratosphere/source/sm/sm_mitm_api.cpp @@ -19,7 +19,7 @@ namespace ams::sm::mitm { /* Mitm API. */ - Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name) { + Result InstallMitm(os::NativeHandle *out_port, os::NativeHandle *out_query, ServiceName name) { return impl::DoWithPerThreadSession([&](TipcService *fwd) { return smAtmosphereMitmInstall(fwd, out_port, out_query, impl::ConvertName(name)); }); diff --git a/libstratosphere/source/spl/spl_api.cpp b/libstratosphere/source/spl/spl_api.cpp index 2db30a03..8528eeed 100644 --- a/libstratosphere/source/spl/spl_api.cpp +++ b/libstratosphere/source/spl/spl_api.cpp @@ -41,7 +41,7 @@ namespace ams::spl { return serviceDispatchIn(splCryptoGetServiceSession(), 22, slot); } - Result GetAesKeySlotAvailableEventImpl(Handle *out) { + Result GetAesKeySlotAvailableEventImpl(os::NativeHandle *out) { return serviceDispatch(splCryptoGetServiceSession(), 23, .out_handle_attrs = { SfOutHandleAttr_HipcCopy }, .out_handles = out, @@ -49,8 +49,8 @@ namespace ams::spl { } void GetAesKeySlotAvailableEvent(os::SystemEvent *out) { - /* Get libnx event. */ - Handle handle = svc::InvalidHandle; + /* Get event handle. */ + os::NativeHandle handle; R_ABORT_UNLESS(GetAesKeySlotAvailableEventImpl(std::addressof(handle))); /* Attach to event. */ diff --git a/libvapours/include/vapours/svc/svc_common.hpp b/libvapours/include/vapours/svc/svc_common.hpp index 832fbb35..0227e9bf 100644 --- a/libvapours/include/vapours/svc/svc_common.hpp +++ b/libvapours/include/vapours/svc/svc_common.hpp @@ -22,10 +22,9 @@ namespace ams::svc { /* TODO: C++ style handle? */ -#ifdef ATMOSPHERE_IS_STRATOSPHERE - using Handle = ::Handle; -#else using Handle = u32; +#if defined(ATMOSPHERE_IS_STRATOSPHERE) + static_assert(std::same_as<::ams::svc::Handle, ::Handle>); #endif enum {