service: refactor server architecture
Converts services to have their own processes
This commit is contained in:
parent
23151ff498
commit
a936972614
|
@ -293,8 +293,6 @@ add_library(core STATIC
|
||||||
hle/kernel/physical_memory.h
|
hle/kernel/physical_memory.h
|
||||||
hle/kernel/process_capability.cpp
|
hle/kernel/process_capability.cpp
|
||||||
hle/kernel/process_capability.h
|
hle/kernel/process_capability.h
|
||||||
hle/kernel/service_thread.cpp
|
|
||||||
hle/kernel/service_thread.h
|
|
||||||
hle/kernel/slab_helpers.h
|
hle/kernel/slab_helpers.h
|
||||||
hle/kernel/svc.cpp
|
hle/kernel/svc.cpp
|
||||||
hle/kernel/svc.h
|
hle/kernel/svc.h
|
||||||
|
@ -684,6 +682,10 @@ add_library(core STATIC
|
||||||
hle/service/ptm/ts.h
|
hle/service/ptm/ts.h
|
||||||
hle/service/kernel_helpers.cpp
|
hle/service/kernel_helpers.cpp
|
||||||
hle/service/kernel_helpers.h
|
hle/service/kernel_helpers.h
|
||||||
|
hle/service/mutex.cpp
|
||||||
|
hle/service/mutex.h
|
||||||
|
hle/service/server_manager.cpp
|
||||||
|
hle/service/server_manager.h
|
||||||
hle/service/service.cpp
|
hle/service/service.cpp
|
||||||
hle/service/service.h
|
hle/service/service.h
|
||||||
hle/service/set/set.cpp
|
hle/service/set/set.cpp
|
||||||
|
|
|
@ -939,6 +939,10 @@ const Network::RoomNetwork& System::GetRoomNetwork() const {
|
||||||
return impl->room_network;
|
return impl->room_network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void System::RunServer(std::unique_ptr<Service::ServerManager>&& server_manager) {
|
||||||
|
return impl->kernel.RunServer(std::move(server_manager));
|
||||||
|
}
|
||||||
|
|
||||||
void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) {
|
void System::RegisterExecuteProgramCallback(ExecuteProgramCallback&& callback) {
|
||||||
impl->execute_program_callback = std::move(callback);
|
impl->execute_program_callback = std::move(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace Glue {
|
||||||
class ARPManager;
|
class ARPManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ServerManager;
|
||||||
|
|
||||||
namespace SM {
|
namespace SM {
|
||||||
class ServiceManager;
|
class ServiceManager;
|
||||||
} // namespace SM
|
} // namespace SM
|
||||||
|
@ -417,6 +419,9 @@ public:
|
||||||
/// Tells if the system debugger is enabled.
|
/// Tells if the system debugger is enabled.
|
||||||
[[nodiscard]] bool DebuggerEnabled() const;
|
[[nodiscard]] bool DebuggerEnabled() const;
|
||||||
|
|
||||||
|
/// Runs a server instance until shutdown.
|
||||||
|
void RunServer(std::unique_ptr<Service::ServerManager>&& server_manager);
|
||||||
|
|
||||||
/// Type used for the frontend to designate a callback for System to re-launch the application
|
/// Type used for the frontend to designate a callback for System to re-launch the application
|
||||||
/// using a specified program index.
|
/// using a specified program index.
|
||||||
using ExecuteProgramCallback = std::function<void(std::size_t)>;
|
using ExecuteProgramCallback = std::function<void(std::size_t)>;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "core/debugger/debugger_interface.h"
|
#include "core/debugger/debugger_interface.h"
|
||||||
#include "core/debugger/gdbstub.h"
|
#include "core/debugger/gdbstub.h"
|
||||||
#include "core/hle/kernel/global_scheduler_context.h"
|
#include "core/hle/kernel/global_scheduler_context.h"
|
||||||
|
#include "core/hle/kernel/k_process.h"
|
||||||
#include "core/hle/kernel/k_scheduler.h"
|
#include "core/hle/kernel/k_scheduler.h"
|
||||||
|
|
||||||
template <typename Readable, typename Buffer, typename Callback>
|
template <typename Readable, typename Buffer, typename Callback>
|
||||||
|
@ -284,12 +285,12 @@ private:
|
||||||
void UpdateActiveThread() {
|
void UpdateActiveThread() {
|
||||||
const auto& threads{ThreadList()};
|
const auto& threads{ThreadList()};
|
||||||
if (std::find(threads.begin(), threads.end(), state->active_thread) == threads.end()) {
|
if (std::find(threads.begin(), threads.end(), state->active_thread) == threads.end()) {
|
||||||
state->active_thread = threads[0];
|
state->active_thread = threads.front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Kernel::KThread*>& ThreadList() {
|
const std::list<Kernel::KThread*>& ThreadList() {
|
||||||
return system.GlobalSchedulerContext().GetThreadList();
|
return system.ApplicationProcess()->GetThreadList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -573,7 +573,7 @@ void GDBStub::HandleQuery(std::string_view command) {
|
||||||
SendReply(PaginateBuffer(buffer, command.substr(21)));
|
SendReply(PaginateBuffer(buffer, command.substr(21)));
|
||||||
} else if (command.starts_with("fThreadInfo")) {
|
} else if (command.starts_with("fThreadInfo")) {
|
||||||
// beginning of list
|
// beginning of list
|
||||||
const auto& threads = system.GlobalSchedulerContext().GetThreadList();
|
const auto& threads = system.ApplicationProcess()->GetThreadList();
|
||||||
std::vector<std::string> thread_ids;
|
std::vector<std::string> thread_ids;
|
||||||
for (const auto& thread : threads) {
|
for (const auto& thread : threads) {
|
||||||
thread_ids.push_back(fmt::format("{:x}", thread->GetThreadID()));
|
thread_ids.push_back(fmt::format("{:x}", thread->GetThreadID()));
|
||||||
|
@ -587,7 +587,7 @@ void GDBStub::HandleQuery(std::string_view command) {
|
||||||
buffer += R"(<?xml version="1.0"?>)";
|
buffer += R"(<?xml version="1.0"?>)";
|
||||||
buffer += "<threads>";
|
buffer += "<threads>";
|
||||||
|
|
||||||
const auto& threads = system.GlobalSchedulerContext().GetThreadList();
|
const auto& threads = system.ApplicationProcess()->GetThreadList();
|
||||||
for (const auto* thread : threads) {
|
for (const auto* thread : threads) {
|
||||||
auto thread_name{GetThreadName(system, thread)};
|
auto thread_name{GetThreadName(system, thread)};
|
||||||
if (!thread_name) {
|
if (!thread_name) {
|
||||||
|
@ -817,7 +817,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::KThread* GDBStub::GetThreadByID(u64 thread_id) {
|
Kernel::KThread* GDBStub::GetThreadByID(u64 thread_id) {
|
||||||
const auto& threads{system.GlobalSchedulerContext().GetThreadList()};
|
const auto& threads{system.ApplicationProcess()->GetThreadList()};
|
||||||
for (auto* thread : threads) {
|
for (auto* thread : threads) {
|
||||||
if (thread->GetThreadID() == thread_id) {
|
if (thread->GetThreadID() == thread_id) {
|
||||||
return thread;
|
return thread;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "core/hle/kernel/k_resource_limit.h"
|
#include "core/hle/kernel/k_resource_limit.h"
|
||||||
#include "core/hle/kernel/k_session.h"
|
#include "core/hle/kernel/k_session.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
|
||||||
|
@ -145,7 +146,9 @@ public:
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void PushIpcInterface(std::shared_ptr<T> iface) {
|
void PushIpcInterface(std::shared_ptr<T> iface) {
|
||||||
if (context->GetManager()->IsDomain()) {
|
auto manager{context->GetManager()};
|
||||||
|
|
||||||
|
if (manager->IsDomain()) {
|
||||||
context->AddDomainObject(std::move(iface));
|
context->AddDomainObject(std::move(iface));
|
||||||
} else {
|
} else {
|
||||||
kernel.ApplicationProcess()->GetResourceLimit()->Reserve(
|
kernel.ApplicationProcess()->GetResourceLimit()->Reserve(
|
||||||
|
@ -153,8 +156,11 @@ public:
|
||||||
|
|
||||||
auto* session = Kernel::KSession::Create(kernel);
|
auto* session = Kernel::KSession::Create(kernel);
|
||||||
session->Initialize(nullptr, iface->GetServiceName());
|
session->Initialize(nullptr, iface->GetServiceName());
|
||||||
iface->RegisterSession(&session->GetServerSession(),
|
|
||||||
std::make_shared<Kernel::SessionRequestManager>(kernel));
|
auto next_manager = std::make_shared<Kernel::SessionRequestManager>(
|
||||||
|
kernel, manager->GetServerManager());
|
||||||
|
next_manager->SetSessionHandler(iface);
|
||||||
|
manager->GetServerManager().RegisterSession(&session->GetServerSession(), next_manager);
|
||||||
|
|
||||||
context->AddMoveObject(&session->GetClientSession());
|
context->AddMoveObject(&session->GetClientSession());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,36 +21,18 @@
|
||||||
#include "core/hle/kernel/k_server_session.h"
|
#include "core/hle/kernel/k_server_session.h"
|
||||||
#include "core/hle/kernel/k_thread.h"
|
#include "core/hle/kernel/k_thread.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/service_thread.h"
|
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
SessionRequestHandler::SessionRequestHandler(KernelCore& kernel_, const char* service_name_,
|
SessionRequestHandler::SessionRequestHandler(KernelCore& kernel_, const char* service_name_)
|
||||||
ServiceThreadType thread_type)
|
: kernel{kernel_} {}
|
||||||
: kernel{kernel_}, service_thread{thread_type == ServiceThreadType::CreateNew
|
|
||||||
? kernel.CreateServiceThread(service_name_)
|
|
||||||
: kernel.GetDefaultServiceThread()} {}
|
|
||||||
|
|
||||||
SessionRequestHandler::~SessionRequestHandler() {
|
SessionRequestHandler::~SessionRequestHandler() = default;
|
||||||
kernel.ReleaseServiceThread(service_thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SessionRequestHandler::AcceptSession(KServerPort* server_port) {
|
SessionRequestManager::SessionRequestManager(KernelCore& kernel_,
|
||||||
auto* server_session = server_port->AcceptSession();
|
Service::ServerManager& server_manager_)
|
||||||
ASSERT(server_session != nullptr);
|
: kernel{kernel_}, server_manager{server_manager_} {}
|
||||||
|
|
||||||
RegisterSession(server_session, std::make_shared<SessionRequestManager>(kernel));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SessionRequestHandler::RegisterSession(KServerSession* server_session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager) {
|
|
||||||
manager->SetSessionHandler(shared_from_this());
|
|
||||||
service_thread.RegisterServerSession(server_session, manager);
|
|
||||||
server_session->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
SessionRequestManager::SessionRequestManager(KernelCore& kernel_) : kernel{kernel_} {}
|
|
||||||
|
|
||||||
SessionRequestManager::~SessionRequestManager() = default;
|
SessionRequestManager::~SessionRequestManager() = default;
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,8 @@ class ResponseBuilder;
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
class ServiceFrameworkBase;
|
class ServiceFrameworkBase;
|
||||||
}
|
class ServerManager;
|
||||||
|
} // namespace Service
|
||||||
enum class ServiceThreadType {
|
|
||||||
Default,
|
|
||||||
CreateNew,
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -53,9 +49,6 @@ class KThread;
|
||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
class KSession;
|
class KSession;
|
||||||
class SessionRequestManager;
|
class SessionRequestManager;
|
||||||
class ServiceThread;
|
|
||||||
|
|
||||||
enum class ThreadWakeupReason;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface implemented by HLE Session handlers.
|
* Interface implemented by HLE Session handlers.
|
||||||
|
@ -64,8 +57,7 @@ enum class ThreadWakeupReason;
|
||||||
*/
|
*/
|
||||||
class SessionRequestHandler : public std::enable_shared_from_this<SessionRequestHandler> {
|
class SessionRequestHandler : public std::enable_shared_from_this<SessionRequestHandler> {
|
||||||
public:
|
public:
|
||||||
SessionRequestHandler(KernelCore& kernel_, const char* service_name_,
|
SessionRequestHandler(KernelCore& kernel_, const char* service_name_);
|
||||||
ServiceThreadType thread_type);
|
|
||||||
virtual ~SessionRequestHandler();
|
virtual ~SessionRequestHandler();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,17 +71,8 @@ public:
|
||||||
virtual Result HandleSyncRequest(Kernel::KServerSession& session,
|
virtual Result HandleSyncRequest(Kernel::KServerSession& session,
|
||||||
Kernel::HLERequestContext& context) = 0;
|
Kernel::HLERequestContext& context) = 0;
|
||||||
|
|
||||||
void AcceptSession(KServerPort* server_port);
|
|
||||||
void RegisterSession(KServerSession* server_session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager);
|
|
||||||
|
|
||||||
ServiceThread& GetServiceThread() const {
|
|
||||||
return service_thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
KernelCore& kernel;
|
KernelCore& kernel;
|
||||||
ServiceThread& service_thread;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using SessionRequestHandlerWeakPtr = std::weak_ptr<SessionRequestHandler>;
|
using SessionRequestHandlerWeakPtr = std::weak_ptr<SessionRequestHandler>;
|
||||||
|
@ -102,7 +85,7 @@ using SessionRequestHandlerPtr = std::shared_ptr<SessionRequestHandler>;
|
||||||
*/
|
*/
|
||||||
class SessionRequestManager final {
|
class SessionRequestManager final {
|
||||||
public:
|
public:
|
||||||
explicit SessionRequestManager(KernelCore& kernel);
|
explicit SessionRequestManager(KernelCore& kernel, Service::ServerManager& server_manager);
|
||||||
~SessionRequestManager();
|
~SessionRequestManager();
|
||||||
|
|
||||||
bool IsDomain() const {
|
bool IsDomain() const {
|
||||||
|
@ -155,15 +138,15 @@ public:
|
||||||
session_handler = std::move(handler);
|
session_handler = std::move(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceThread& GetServiceThread() const {
|
|
||||||
return session_handler->GetServiceThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HasSessionRequestHandler(const HLERequestContext& context) const;
|
bool HasSessionRequestHandler(const HLERequestContext& context) const;
|
||||||
|
|
||||||
Result HandleDomainSyncRequest(KServerSession* server_session, HLERequestContext& context);
|
Result HandleDomainSyncRequest(KServerSession* server_session, HLERequestContext& context);
|
||||||
Result CompleteSyncRequest(KServerSession* server_session, HLERequestContext& context);
|
Result CompleteSyncRequest(KServerSession* server_session, HLERequestContext& context);
|
||||||
|
|
||||||
|
Service::ServerManager& GetServerManager() {
|
||||||
|
return server_manager;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool convert_to_domain{};
|
bool convert_to_domain{};
|
||||||
bool is_domain{};
|
bool is_domain{};
|
||||||
|
@ -172,6 +155,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KernelCore& kernel;
|
KernelCore& kernel;
|
||||||
|
Service::ServerManager& server_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,7 +119,6 @@ void KProcess::DecrementRunningThreadCount() {
|
||||||
|
|
||||||
if (const auto prev = num_running_threads--; prev == 1) {
|
if (const auto prev = num_running_threads--; prev == 1) {
|
||||||
// TODO(bunnei): Process termination to be implemented when multiprocess is supported.
|
// TODO(bunnei): Process termination to be implemented when multiprocess is supported.
|
||||||
UNIMPLEMENTED_MSG("KProcess termination is not implemennted!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,9 +356,6 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std:
|
||||||
system_resource_size = metadata.GetSystemResourceSize();
|
system_resource_size = metadata.GetSystemResourceSize();
|
||||||
image_size = code_size;
|
image_size = code_size;
|
||||||
|
|
||||||
// We currently do not support process-specific system resource
|
|
||||||
UNIMPLEMENTED_IF(system_resource_size != 0);
|
|
||||||
|
|
||||||
KScopedResourceReservation memory_reservation(
|
KScopedResourceReservation memory_reservation(
|
||||||
resource_limit, LimitableResource::PhysicalMemoryMax, code_size + system_resource_size);
|
resource_limit, LimitableResource::PhysicalMemoryMax, code_size + system_resource_size);
|
||||||
if (!memory_reservation.Succeeded()) {
|
if (!memory_reservation.Succeeded()) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "core/hle/kernel/k_thread_queue.h"
|
#include "core/hle/kernel/k_thread_queue.h"
|
||||||
#include "core/hle/kernel/k_worker_task_manager.h"
|
#include "core/hle/kernel/k_worker_task_manager.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
|
#include "core/hle/kernel/svc.h"
|
||||||
#include "core/hle/kernel/svc_results.h"
|
#include "core/hle/kernel/svc_results.h"
|
||||||
#include "core/hle/kernel/svc_types.h"
|
#include "core/hle/kernel/svc_types.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
@ -298,6 +299,25 @@ Result KThread::InitializeUserThread(Core::System& system, KThread* thread, KThr
|
||||||
ThreadType::User, system.GetCpuManager().GetGuestThreadFunc()));
|
ThreadType::User, system.GetCpuManager().GetGuestThreadFunc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result KThread::InitializeServiceThread(Core::System& system, KThread* thread,
|
||||||
|
std::function<void()>&& func, s32 prio, s32 virt_core,
|
||||||
|
KProcess* owner) {
|
||||||
|
system.Kernel().GlobalSchedulerContext().AddThread(thread);
|
||||||
|
std::function<void()> func2{[&system, func{std::move(func)}] {
|
||||||
|
// Similar to UserModeThreadStarter.
|
||||||
|
system.Kernel().CurrentScheduler()->OnThreadStart();
|
||||||
|
|
||||||
|
// Run the guest function.
|
||||||
|
func();
|
||||||
|
|
||||||
|
// Exit.
|
||||||
|
Svc::ExitThread(system);
|
||||||
|
}};
|
||||||
|
|
||||||
|
R_RETURN(InitializeThread(thread, {}, {}, {}, prio, virt_core, owner, ThreadType::HighPriority,
|
||||||
|
std::move(func2)));
|
||||||
|
}
|
||||||
|
|
||||||
void KThread::PostDestroy(uintptr_t arg) {
|
void KThread::PostDestroy(uintptr_t arg) {
|
||||||
KProcess* owner = reinterpret_cast<KProcess*>(arg & ~1ULL);
|
KProcess* owner = reinterpret_cast<KProcess*>(arg & ~1ULL);
|
||||||
const bool resource_limit_release_hint = (arg & 1);
|
const bool resource_limit_release_hint = (arg & 1);
|
||||||
|
|
|
@ -434,6 +434,10 @@ public:
|
||||||
VAddr user_stack_top, s32 prio, s32 virt_core,
|
VAddr user_stack_top, s32 prio, s32 virt_core,
|
||||||
KProcess* owner);
|
KProcess* owner);
|
||||||
|
|
||||||
|
[[nodiscard]] static Result InitializeServiceThread(Core::System& system, KThread* thread,
|
||||||
|
std::function<void()>&& thread_func,
|
||||||
|
s32 prio, s32 virt_core, KProcess* owner);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct StackParameters {
|
struct StackParameters {
|
||||||
u8 svc_permission[0x10];
|
u8 svc_permission[0x10];
|
||||||
|
|
|
@ -34,14 +34,15 @@
|
||||||
#include "core/hle/kernel/k_process.h"
|
#include "core/hle/kernel/k_process.h"
|
||||||
#include "core/hle/kernel/k_resource_limit.h"
|
#include "core/hle/kernel/k_resource_limit.h"
|
||||||
#include "core/hle/kernel/k_scheduler.h"
|
#include "core/hle/kernel/k_scheduler.h"
|
||||||
|
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
||||||
#include "core/hle/kernel/k_shared_memory.h"
|
#include "core/hle/kernel/k_shared_memory.h"
|
||||||
#include "core/hle/kernel/k_system_resource.h"
|
#include "core/hle/kernel/k_system_resource.h"
|
||||||
#include "core/hle/kernel/k_thread.h"
|
#include "core/hle/kernel/k_thread.h"
|
||||||
#include "core/hle/kernel/k_worker_task_manager.h"
|
#include "core/hle/kernel/k_worker_task_manager.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/physical_core.h"
|
#include "core/hle/kernel/physical_core.h"
|
||||||
#include "core/hle/kernel/service_thread.h"
|
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
|
@ -55,9 +56,7 @@ struct KernelCore::Impl {
|
||||||
static constexpr size_t BlockInfoSlabHeapSize = 4000;
|
static constexpr size_t BlockInfoSlabHeapSize = 4000;
|
||||||
static constexpr size_t ReservedDynamicPageCount = 64;
|
static constexpr size_t ReservedDynamicPageCount = 64;
|
||||||
|
|
||||||
explicit Impl(Core::System& system_, KernelCore& kernel_)
|
explicit Impl(Core::System& system_, KernelCore& kernel_) : system{system_} {}
|
||||||
: service_threads_manager{1, "ServiceThreadsManager"},
|
|
||||||
service_thread_barrier{2}, system{system_} {}
|
|
||||||
|
|
||||||
void SetMulticore(bool is_multi) {
|
void SetMulticore(bool is_multi) {
|
||||||
is_multicore = is_multi;
|
is_multicore = is_multi;
|
||||||
|
@ -98,8 +97,6 @@ struct KernelCore::Impl {
|
||||||
|
|
||||||
InitializeHackSharedMemory();
|
InitializeHackSharedMemory();
|
||||||
RegisterHostThread(nullptr);
|
RegisterHostThread(nullptr);
|
||||||
|
|
||||||
default_service_thread = &CreateServiceThread(kernel, "DefaultServiceThread");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeCores() {
|
void InitializeCores() {
|
||||||
|
@ -140,11 +137,6 @@ struct KernelCore::Impl {
|
||||||
|
|
||||||
preemption_event = nullptr;
|
preemption_event = nullptr;
|
||||||
|
|
||||||
for (auto& iter : named_ports) {
|
|
||||||
iter.second->Close();
|
|
||||||
}
|
|
||||||
named_ports.clear();
|
|
||||||
|
|
||||||
exclusive_monitor.reset();
|
exclusive_monitor.reset();
|
||||||
|
|
||||||
// Cleanup persistent kernel objects
|
// Cleanup persistent kernel objects
|
||||||
|
@ -207,8 +199,9 @@ struct KernelCore::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseServices() {
|
void CloseServices() {
|
||||||
// Ensures all service threads gracefully shutdown.
|
// Ensures all servers gracefully shutdown.
|
||||||
ClearServiceThreads();
|
std::scoped_lock lk{server_lock};
|
||||||
|
server_managers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializePhysicalCores() {
|
void InitializePhysicalCores() {
|
||||||
|
@ -761,55 +754,6 @@ struct KernelCore::Impl {
|
||||||
"HidBus:SharedMemory");
|
"HidBus:SharedMemory");
|
||||||
}
|
}
|
||||||
|
|
||||||
KClientPort* CreateNamedServicePort(std::string name) {
|
|
||||||
auto search = service_interface_factory.find(name);
|
|
||||||
if (search == service_interface_factory.end()) {
|
|
||||||
UNIMPLEMENTED();
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return &search->second(system.ServiceManager(), system);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RegisterNamedServiceHandler(std::string name, KServerPort* server_port) {
|
|
||||||
auto search = service_interface_handlers.find(name);
|
|
||||||
if (search == service_interface_handlers.end()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
search->second(system.ServiceManager(), server_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
Kernel::ServiceThread& CreateServiceThread(KernelCore& kernel, const std::string& name) {
|
|
||||||
auto* ptr = new ServiceThread(kernel, name);
|
|
||||||
|
|
||||||
service_threads_manager.QueueWork(
|
|
||||||
[this, ptr]() { service_threads.emplace(ptr, std::unique_ptr<ServiceThread>(ptr)); });
|
|
||||||
|
|
||||||
return *ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReleaseServiceThread(Kernel::ServiceThread& service_thread) {
|
|
||||||
auto* ptr = &service_thread;
|
|
||||||
|
|
||||||
if (ptr == default_service_thread) {
|
|
||||||
// Nothing to do here, the service is using default_service_thread, which will be
|
|
||||||
// released on shutdown.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
service_threads_manager.QueueWork([this, ptr]() { service_threads.erase(ptr); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearServiceThreads() {
|
|
||||||
service_threads_manager.QueueWork([this] {
|
|
||||||
service_threads.clear();
|
|
||||||
default_service_thread = nullptr;
|
|
||||||
service_thread_barrier.Sync();
|
|
||||||
});
|
|
||||||
service_thread_barrier.Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::mutex registered_objects_lock;
|
std::mutex registered_objects_lock;
|
||||||
std::mutex registered_in_use_objects_lock;
|
std::mutex registered_in_use_objects_lock;
|
||||||
|
|
||||||
|
@ -839,14 +783,12 @@ struct KernelCore::Impl {
|
||||||
|
|
||||||
std::unique_ptr<KObjectNameGlobalData> object_name_global_data;
|
std::unique_ptr<KObjectNameGlobalData> object_name_global_data;
|
||||||
|
|
||||||
/// Map of named ports managed by the kernel, which can be retrieved using
|
|
||||||
/// the ConnectToPort SVC.
|
|
||||||
std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory;
|
|
||||||
std::unordered_map<std::string, ServiceInterfaceHandlerFn> service_interface_handlers;
|
|
||||||
NamedPortTable named_ports;
|
|
||||||
std::unordered_set<KAutoObject*> registered_objects;
|
std::unordered_set<KAutoObject*> registered_objects;
|
||||||
std::unordered_set<KAutoObject*> registered_in_use_objects;
|
std::unordered_set<KAutoObject*> registered_in_use_objects;
|
||||||
|
|
||||||
|
std::mutex server_lock;
|
||||||
|
std::vector<std::unique_ptr<Service::ServerManager>> server_managers;
|
||||||
|
|
||||||
std::unique_ptr<Core::ExclusiveMonitor> exclusive_monitor;
|
std::unique_ptr<Core::ExclusiveMonitor> exclusive_monitor;
|
||||||
std::array<std::unique_ptr<Kernel::PhysicalCore>, Core::Hardware::NUM_CPU_CORES> cores;
|
std::array<std::unique_ptr<Kernel::PhysicalCore>, Core::Hardware::NUM_CPU_CORES> cores;
|
||||||
|
|
||||||
|
@ -881,12 +823,6 @@ struct KernelCore::Impl {
|
||||||
// Memory layout
|
// Memory layout
|
||||||
std::unique_ptr<KMemoryLayout> memory_layout;
|
std::unique_ptr<KMemoryLayout> memory_layout;
|
||||||
|
|
||||||
// Threads used for services
|
|
||||||
std::unordered_map<ServiceThread*, std::unique_ptr<ServiceThread>> service_threads;
|
|
||||||
ServiceThread* default_service_thread{};
|
|
||||||
Common::ThreadWorker service_threads_manager;
|
|
||||||
Common::Barrier service_thread_barrier;
|
|
||||||
|
|
||||||
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> shutdown_threads{};
|
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> shutdown_threads{};
|
||||||
std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{};
|
std::array<std::unique_ptr<Kernel::KScheduler>, Core::Hardware::NUM_CPU_CORES> schedulers{};
|
||||||
|
|
||||||
|
@ -1050,23 +986,6 @@ void KernelCore::PrepareReschedule(std::size_t id) {
|
||||||
// TODO: Reimplement, this
|
// TODO: Reimplement, this
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelCore::RegisterNamedService(std::string name, ServiceInterfaceFactory&& factory) {
|
|
||||||
impl->service_interface_factory.emplace(std::move(name), factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KernelCore::RegisterInterfaceForNamedService(std::string name,
|
|
||||||
ServiceInterfaceHandlerFn&& handler) {
|
|
||||||
impl->service_interface_handlers.emplace(std::move(name), handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
KClientPort* KernelCore::CreateNamedServicePort(std::string name) {
|
|
||||||
return impl->CreateNamedServicePort(std::move(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KernelCore::RegisterNamedServiceHandler(std::string name, KServerPort* server_port) {
|
|
||||||
impl->RegisterNamedServiceHandler(std::move(name), server_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KernelCore::RegisterKernelObject(KAutoObject* object) {
|
void KernelCore::RegisterKernelObject(KAutoObject* object) {
|
||||||
std::scoped_lock lk{impl->registered_objects_lock};
|
std::scoped_lock lk{impl->registered_objects_lock};
|
||||||
impl->registered_objects.insert(object);
|
impl->registered_objects.insert(object);
|
||||||
|
@ -1087,8 +1006,19 @@ void KernelCore::UnregisterInUseObject(KAutoObject* object) {
|
||||||
impl->registered_in_use_objects.erase(object);
|
impl->registered_in_use_objects.erase(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KernelCore::IsValidNamedPort(NamedPortTable::const_iterator port) const {
|
void KernelCore::RunServer(std::unique_ptr<Service::ServerManager>&& server_manager) {
|
||||||
return port != impl->named_ports.cend();
|
auto* manager = server_manager.get();
|
||||||
|
|
||||||
|
{
|
||||||
|
std::scoped_lock lk{impl->server_lock};
|
||||||
|
if (impl->is_shutting_down) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl->server_managers.emplace_back(std::move(server_manager));
|
||||||
|
}
|
||||||
|
|
||||||
|
manager->LoopProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 KernelCore::CreateNewObjectID() {
|
u32 KernelCore::CreateNewObjectID() {
|
||||||
|
@ -1127,6 +1057,87 @@ void KernelCore::RegisterHostThread(KThread* existing_thread) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::jthread RunHostThreadFunc(KernelCore& kernel, KProcess* process,
|
||||||
|
std::string&& thread_name, std::function<void()>&& func) {
|
||||||
|
// Reserve a new thread from the process resource limit.
|
||||||
|
KScopedResourceReservation thread_reservation(process, LimitableResource::ThreadCountMax);
|
||||||
|
ASSERT(thread_reservation.Succeeded());
|
||||||
|
|
||||||
|
// Initialize the thread.
|
||||||
|
KThread* thread = KThread::Create(kernel);
|
||||||
|
ASSERT(R_SUCCEEDED(KThread::InitializeDummyThread(thread, process)));
|
||||||
|
|
||||||
|
// Commit the thread reservation.
|
||||||
|
thread_reservation.Commit();
|
||||||
|
|
||||||
|
return std::jthread(
|
||||||
|
[&kernel, thread, thread_name{std::move(thread_name)}, func{std::move(func)}] {
|
||||||
|
// Set the thread name.
|
||||||
|
Common::SetCurrentThreadName(thread_name.c_str());
|
||||||
|
|
||||||
|
// Register the thread.
|
||||||
|
kernel.RegisterHostThread(thread);
|
||||||
|
|
||||||
|
// Run the callback.
|
||||||
|
func();
|
||||||
|
|
||||||
|
// Close the thread.
|
||||||
|
// This will free the process if it is the last reference.
|
||||||
|
thread->Close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::jthread KernelCore::RunOnHostCoreProcess(std::string&& process_name,
|
||||||
|
std::function<void()> func) {
|
||||||
|
// Make a new process.
|
||||||
|
KProcess* process = KProcess::Create(*this);
|
||||||
|
ASSERT(R_SUCCEEDED(KProcess::Initialize(process, System(), "", KProcess::ProcessType::Userland,
|
||||||
|
GetSystemResourceLimit())));
|
||||||
|
|
||||||
|
// Ensure that we don't hold onto any extra references.
|
||||||
|
SCOPE_EXIT({ process->Close(); });
|
||||||
|
|
||||||
|
// Run the host thread.
|
||||||
|
return RunHostThreadFunc(*this, process, std::move(process_name), std::move(func));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::jthread KernelCore::RunOnHostCoreThread(std::string&& thread_name,
|
||||||
|
std::function<void()> func) {
|
||||||
|
// Get the current process.
|
||||||
|
KProcess* process = GetCurrentProcessPointer(*this);
|
||||||
|
|
||||||
|
// Run the host thread.
|
||||||
|
return RunHostThreadFunc(*this, process, std::move(thread_name), std::move(func));
|
||||||
|
}
|
||||||
|
|
||||||
|
void KernelCore::RunOnGuestCoreProcess(std::string&& process_name, std::function<void()> func) {
|
||||||
|
constexpr s32 ServiceThreadPriority = 16;
|
||||||
|
constexpr s32 ServiceThreadCore = 3;
|
||||||
|
|
||||||
|
// Make a new process.
|
||||||
|
KProcess* process = KProcess::Create(*this);
|
||||||
|
ASSERT(R_SUCCEEDED(KProcess::Initialize(process, System(), "", KProcess::ProcessType::Userland,
|
||||||
|
GetSystemResourceLimit())));
|
||||||
|
|
||||||
|
// Ensure that we don't hold onto any extra references.
|
||||||
|
SCOPE_EXIT({ process->Close(); });
|
||||||
|
|
||||||
|
// Reserve a new thread from the process resource limit.
|
||||||
|
KScopedResourceReservation thread_reservation(process, LimitableResource::ThreadCountMax);
|
||||||
|
ASSERT(thread_reservation.Succeeded());
|
||||||
|
|
||||||
|
// Initialize the thread.
|
||||||
|
KThread* thread = KThread::Create(*this);
|
||||||
|
ASSERT(R_SUCCEEDED(KThread::InitializeServiceThread(
|
||||||
|
System(), thread, std::move(func), ServiceThreadPriority, ServiceThreadCore, process)));
|
||||||
|
|
||||||
|
// Commit the thread reservation.
|
||||||
|
thread_reservation.Commit();
|
||||||
|
|
||||||
|
// Begin running the thread.
|
||||||
|
ASSERT(R_SUCCEEDED(thread->Run()));
|
||||||
|
}
|
||||||
|
|
||||||
u32 KernelCore::GetCurrentHostThreadID() const {
|
u32 KernelCore::GetCurrentHostThreadID() const {
|
||||||
return impl->GetCurrentHostThreadID();
|
return impl->GetCurrentHostThreadID();
|
||||||
}
|
}
|
||||||
|
@ -1271,18 +1282,6 @@ void KernelCore::ExitSVCProfile() {
|
||||||
MicroProfileLeave(MICROPROFILE_TOKEN(Kernel_SVC), impl->svc_ticks[CurrentPhysicalCoreIndex()]);
|
MicroProfileLeave(MICROPROFILE_TOKEN(Kernel_SVC), impl->svc_ticks[CurrentPhysicalCoreIndex()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::ServiceThread& KernelCore::CreateServiceThread(const std::string& name) {
|
|
||||||
return impl->CreateServiceThread(*this, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Kernel::ServiceThread& KernelCore::GetDefaultServiceThread() const {
|
|
||||||
return *impl->default_service_thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KernelCore::ReleaseServiceThread(Kernel::ServiceThread& service_thread) {
|
|
||||||
impl->ReleaseServiceThread(service_thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() {
|
Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() {
|
||||||
return impl->slab_resource_counts;
|
return impl->slab_resource_counts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common/polyfill_thread.h"
|
||||||
#include "core/hardware_properties.h"
|
#include "core/hardware_properties.h"
|
||||||
#include "core/hle/kernel/k_auto_object.h"
|
#include "core/hle/kernel/k_auto_object.h"
|
||||||
#include "core/hle/kernel/k_slab_heap.h"
|
#include "core/hle/kernel/k_slab_heap.h"
|
||||||
|
@ -24,6 +26,10 @@ class CoreTiming;
|
||||||
struct EventType;
|
struct EventType;
|
||||||
} // namespace Core::Timing
|
} // namespace Core::Timing
|
||||||
|
|
||||||
|
namespace Service {
|
||||||
|
class ServerManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
namespace Service::SM {
|
||||||
class ServiceManager;
|
class ServiceManager;
|
||||||
}
|
}
|
||||||
|
@ -65,13 +71,6 @@ class KTransferMemory;
|
||||||
class KWorkerTaskManager;
|
class KWorkerTaskManager;
|
||||||
class KCodeMemory;
|
class KCodeMemory;
|
||||||
class PhysicalCore;
|
class PhysicalCore;
|
||||||
class ServiceThread;
|
|
||||||
class Synchronization;
|
|
||||||
|
|
||||||
using ServiceInterfaceFactory =
|
|
||||||
std::function<KClientPort&(Service::SM::ServiceManager&, Core::System&)>;
|
|
||||||
|
|
||||||
using ServiceInterfaceHandlerFn = std::function<void(Service::SM::ServiceManager&, KServerPort*)>;
|
|
||||||
|
|
||||||
namespace Init {
|
namespace Init {
|
||||||
struct KSlabResourceCounts;
|
struct KSlabResourceCounts;
|
||||||
|
@ -80,15 +79,8 @@ struct KSlabResourceCounts;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class KSlabHeap;
|
class KSlabHeap;
|
||||||
|
|
||||||
using EmuThreadHandle = uintptr_t;
|
|
||||||
constexpr EmuThreadHandle EmuThreadHandleInvalid{};
|
|
||||||
constexpr EmuThreadHandle EmuThreadHandleReserved{1ULL << 63};
|
|
||||||
|
|
||||||
/// Represents a single instance of the kernel.
|
/// Represents a single instance of the kernel.
|
||||||
class KernelCore {
|
class KernelCore {
|
||||||
private:
|
|
||||||
using NamedPortTable = std::unordered_map<std::string, KClientPort*>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructs an instance of the kernel using the given System
|
/// Constructs an instance of the kernel using the given System
|
||||||
/// instance as a context for any necessary system-related state,
|
/// instance as a context for any necessary system-related state,
|
||||||
|
@ -196,18 +188,6 @@ public:
|
||||||
|
|
||||||
void InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size);
|
void InvalidateCpuInstructionCacheRange(VAddr addr, std::size_t size);
|
||||||
|
|
||||||
/// Registers a named HLE service, passing a factory used to open a port to that service.
|
|
||||||
void RegisterNamedService(std::string name, ServiceInterfaceFactory&& factory);
|
|
||||||
|
|
||||||
/// Registers a setup function for the named HLE service.
|
|
||||||
void RegisterInterfaceForNamedService(std::string name, ServiceInterfaceHandlerFn&& handler);
|
|
||||||
|
|
||||||
/// Opens a port to a service previously registered with RegisterNamedService.
|
|
||||||
KClientPort* CreateNamedServicePort(std::string name);
|
|
||||||
|
|
||||||
/// Accepts a session on a port created by CreateNamedServicePort.
|
|
||||||
void RegisterNamedServiceHandler(std::string name, KServerPort* server_port);
|
|
||||||
|
|
||||||
/// Registers all kernel objects with the global emulation state, this is purely for tracking
|
/// Registers all kernel objects with the global emulation state, this is purely for tracking
|
||||||
/// leaks after emulation has been shutdown.
|
/// leaks after emulation has been shutdown.
|
||||||
void RegisterKernelObject(KAutoObject* object);
|
void RegisterKernelObject(KAutoObject* object);
|
||||||
|
@ -224,8 +204,8 @@ public:
|
||||||
/// destroyed during the current emulation session.
|
/// destroyed during the current emulation session.
|
||||||
void UnregisterInUseObject(KAutoObject* object);
|
void UnregisterInUseObject(KAutoObject* object);
|
||||||
|
|
||||||
/// Determines whether or not the given port is a valid named port.
|
// Runs the given server manager until shutdown.
|
||||||
bool IsValidNamedPort(NamedPortTable::const_iterator port) const;
|
void RunServer(std::unique_ptr<Service::ServerManager>&& server_manager);
|
||||||
|
|
||||||
/// Gets the current host_thread/guest_thread pointer.
|
/// Gets the current host_thread/guest_thread pointer.
|
||||||
KThread* GetCurrentEmuThread() const;
|
KThread* GetCurrentEmuThread() const;
|
||||||
|
@ -242,6 +222,12 @@ public:
|
||||||
/// Register the current thread as a non CPU core thread.
|
/// Register the current thread as a non CPU core thread.
|
||||||
void RegisterHostThread(KThread* existing_thread = nullptr);
|
void RegisterHostThread(KThread* existing_thread = nullptr);
|
||||||
|
|
||||||
|
void RunOnGuestCoreProcess(std::string&& process_name, std::function<void()> func);
|
||||||
|
|
||||||
|
std::jthread RunOnHostCoreProcess(std::string&& process_name, std::function<void()> func);
|
||||||
|
|
||||||
|
std::jthread RunOnHostCoreThread(std::string&& thread_name, std::function<void()> func);
|
||||||
|
|
||||||
/// Gets global data for KObjectName.
|
/// Gets global data for KObjectName.
|
||||||
KObjectNameGlobalData& ObjectNameGlobalData();
|
KObjectNameGlobalData& ObjectNameGlobalData();
|
||||||
|
|
||||||
|
@ -310,33 +296,6 @@ public:
|
||||||
|
|
||||||
void ExitSVCProfile();
|
void ExitSVCProfile();
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a host thread to execute HLE service requests, which are used to execute service
|
|
||||||
* routines asynchronously. While these are allocated per ServerSession, these need to be owned
|
|
||||||
* and managed outside of ServerSession to avoid a circular dependency. In general, most
|
|
||||||
* services can just use the default service thread, and not need their own host service thread.
|
|
||||||
* See GetDefaultServiceThread.
|
|
||||||
* @param name String name for the ServerSession creating this thread, used for debug
|
|
||||||
* purposes.
|
|
||||||
* @returns A reference to the newly created service thread.
|
|
||||||
*/
|
|
||||||
Kernel::ServiceThread& CreateServiceThread(const std::string& name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the default host service thread, which executes HLE service requests. Unless service
|
|
||||||
* requests need to block on the host, the default service thread should be used in favor of
|
|
||||||
* creating a new service thread.
|
|
||||||
* @returns A reference to the default service thread.
|
|
||||||
*/
|
|
||||||
Kernel::ServiceThread& GetDefaultServiceThread() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Releases a HLE service thread, instructing KernelCore to free it. This should be called when
|
|
||||||
* the ServerSession associated with the thread is destroyed.
|
|
||||||
* @param service_thread Service thread to release.
|
|
||||||
*/
|
|
||||||
void ReleaseServiceThread(Kernel::ServiceThread& service_thread);
|
|
||||||
|
|
||||||
/// Workaround for single-core mode when preempting threads while idle.
|
/// Workaround for single-core mode when preempting threads while idle.
|
||||||
bool IsPhantomModeForSingleCore() const;
|
bool IsPhantomModeForSingleCore() const;
|
||||||
void SetIsPhantomModeForSingleCore(bool value);
|
void SetIsPhantomModeForSingleCore(bool value);
|
||||||
|
|
|
@ -1,206 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
|
||||||
#include <mutex>
|
|
||||||
#include <thread>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "common/polyfill_thread.h"
|
|
||||||
#include "common/scope_exit.h"
|
|
||||||
#include "common/thread.h"
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
|
||||||
#include "core/hle/kernel/k_event.h"
|
|
||||||
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
|
||||||
#include "core/hle/kernel/k_session.h"
|
|
||||||
#include "core/hle/kernel/k_thread.h"
|
|
||||||
#include "core/hle/kernel/kernel.h"
|
|
||||||
#include "core/hle/kernel/service_thread.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
class ServiceThread::Impl final {
|
|
||||||
public:
|
|
||||||
explicit Impl(KernelCore& kernel, const std::string& service_name);
|
|
||||||
~Impl();
|
|
||||||
|
|
||||||
void WaitAndProcessImpl();
|
|
||||||
void SessionClosed(KServerSession* server_session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager);
|
|
||||||
void LoopProcess();
|
|
||||||
|
|
||||||
void RegisterServerSession(KServerSession* session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager);
|
|
||||||
|
|
||||||
private:
|
|
||||||
KernelCore& kernel;
|
|
||||||
const std::string m_service_name;
|
|
||||||
|
|
||||||
std::jthread m_host_thread{};
|
|
||||||
std::mutex m_session_mutex{};
|
|
||||||
std::map<KServerSession*, std::shared_ptr<SessionRequestManager>> m_sessions{};
|
|
||||||
KEvent* m_wakeup_event{};
|
|
||||||
KThread* m_thread{};
|
|
||||||
std::atomic<bool> m_shutdown_requested{};
|
|
||||||
};
|
|
||||||
|
|
||||||
void ServiceThread::Impl::WaitAndProcessImpl() {
|
|
||||||
// Create local list of waitable sessions.
|
|
||||||
std::vector<KSynchronizationObject*> objs;
|
|
||||||
std::vector<std::shared_ptr<SessionRequestManager>> managers;
|
|
||||||
|
|
||||||
{
|
|
||||||
// Lock to get the set.
|
|
||||||
std::scoped_lock lk{m_session_mutex};
|
|
||||||
|
|
||||||
// Reserve the needed quantity.
|
|
||||||
objs.reserve(m_sessions.size() + 1);
|
|
||||||
managers.reserve(m_sessions.size());
|
|
||||||
|
|
||||||
// Copy to our local list.
|
|
||||||
for (const auto& [session, manager] : m_sessions) {
|
|
||||||
objs.push_back(session);
|
|
||||||
managers.push_back(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the wakeup event at the end.
|
|
||||||
objs.push_back(&m_wakeup_event->GetReadableEvent());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait on the list of sessions.
|
|
||||||
s32 index{-1};
|
|
||||||
Result rc = KSynchronizationObject::Wait(kernel, &index, objs.data(),
|
|
||||||
static_cast<s32>(objs.size()), -1);
|
|
||||||
ASSERT(!rc.IsFailure());
|
|
||||||
|
|
||||||
// If this was the wakeup event, clear it and finish.
|
|
||||||
if (index >= static_cast<s64>(objs.size() - 1)) {
|
|
||||||
m_wakeup_event->Clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This event is from a server session.
|
|
||||||
auto* server_session = static_cast<KServerSession*>(objs[index]);
|
|
||||||
auto& manager = managers[index];
|
|
||||||
|
|
||||||
// Fetch the HLE request context.
|
|
||||||
std::shared_ptr<HLERequestContext> context;
|
|
||||||
rc = server_session->ReceiveRequest(&context, manager);
|
|
||||||
|
|
||||||
// If the session was closed, handle that.
|
|
||||||
if (rc == ResultSessionClosed) {
|
|
||||||
SessionClosed(server_session, manager);
|
|
||||||
|
|
||||||
// Finish.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: handle other cases
|
|
||||||
ASSERT(rc == ResultSuccess);
|
|
||||||
|
|
||||||
// Perform the request.
|
|
||||||
Result service_rc = manager->CompleteSyncRequest(server_session, *context);
|
|
||||||
|
|
||||||
// Reply to the client.
|
|
||||||
rc = server_session->SendReplyHLE();
|
|
||||||
|
|
||||||
if (rc == ResultSessionClosed || service_rc == IPC::ERR_REMOTE_PROCESS_DEAD) {
|
|
||||||
SessionClosed(server_session, manager);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: handle other cases
|
|
||||||
ASSERT(rc == ResultSuccess);
|
|
||||||
ASSERT(service_rc == ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceThread::Impl::SessionClosed(KServerSession* server_session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager) {
|
|
||||||
{
|
|
||||||
// Lock to get the set.
|
|
||||||
std::scoped_lock lk{m_session_mutex};
|
|
||||||
|
|
||||||
// Erase the session.
|
|
||||||
ASSERT(m_sessions.erase(server_session) == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close our reference to the server session.
|
|
||||||
server_session->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceThread::Impl::LoopProcess() {
|
|
||||||
Common::SetCurrentThreadName(m_service_name.c_str());
|
|
||||||
|
|
||||||
kernel.RegisterHostThread(m_thread);
|
|
||||||
|
|
||||||
while (!m_shutdown_requested.load()) {
|
|
||||||
WaitAndProcessImpl();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServiceThread::Impl::RegisterServerSession(KServerSession* server_session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager) {
|
|
||||||
// Open the server session.
|
|
||||||
server_session->Open();
|
|
||||||
|
|
||||||
{
|
|
||||||
// Lock to get the set.
|
|
||||||
std::scoped_lock lk{m_session_mutex};
|
|
||||||
|
|
||||||
// Insert the session and manager.
|
|
||||||
m_sessions[server_session] = manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signal the wakeup event.
|
|
||||||
m_wakeup_event->Signal();
|
|
||||||
}
|
|
||||||
|
|
||||||
ServiceThread::Impl::~Impl() {
|
|
||||||
// Shut down the processing thread.
|
|
||||||
m_shutdown_requested.store(true);
|
|
||||||
m_wakeup_event->Signal();
|
|
||||||
m_host_thread.join();
|
|
||||||
|
|
||||||
// Close all remaining sessions.
|
|
||||||
for (const auto& [server_session, manager] : m_sessions) {
|
|
||||||
server_session->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Destroy remaining managers.
|
|
||||||
m_sessions.clear();
|
|
||||||
|
|
||||||
// Close event.
|
|
||||||
m_wakeup_event->GetReadableEvent().Close();
|
|
||||||
m_wakeup_event->Close();
|
|
||||||
|
|
||||||
// Close thread.
|
|
||||||
m_thread->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
ServiceThread::Impl::Impl(KernelCore& kernel_, const std::string& service_name)
|
|
||||||
: kernel{kernel_}, m_service_name{service_name} {
|
|
||||||
// Initialize event.
|
|
||||||
m_wakeup_event = KEvent::Create(kernel);
|
|
||||||
m_wakeup_event->Initialize(nullptr);
|
|
||||||
|
|
||||||
// Initialize thread.
|
|
||||||
m_thread = KThread::Create(kernel);
|
|
||||||
ASSERT(KThread::InitializeDummyThread(m_thread, nullptr).IsSuccess());
|
|
||||||
|
|
||||||
// Start thread.
|
|
||||||
m_host_thread = std::jthread([this] { LoopProcess(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
ServiceThread::ServiceThread(KernelCore& kernel, const std::string& name)
|
|
||||||
: impl{std::make_unique<Impl>(kernel, name)} {}
|
|
||||||
|
|
||||||
ServiceThread::~ServiceThread() = default;
|
|
||||||
|
|
||||||
void ServiceThread::RegisterServerSession(KServerSession* session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager) {
|
|
||||||
impl->RegisterServerSession(session, manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Kernel
|
|
|
@ -1,29 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
class HLERequestContext;
|
|
||||||
class KernelCore;
|
|
||||||
class KSession;
|
|
||||||
class SessionRequestManager;
|
|
||||||
|
|
||||||
class ServiceThread final {
|
|
||||||
public:
|
|
||||||
explicit ServiceThread(KernelCore& kernel, const std::string& name);
|
|
||||||
~ServiceThread();
|
|
||||||
|
|
||||||
void RegisterServerSession(KServerSession* session,
|
|
||||||
std::shared_ptr<SessionRequestManager> manager);
|
|
||||||
|
|
||||||
private:
|
|
||||||
class Impl;
|
|
||||||
std::unique_ptr<Impl> impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Kernel
|
|
|
@ -126,6 +126,11 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
||||||
*result = process->GetTotalPhysicalMemoryUsedWithoutSystemResource();
|
*result = process->GetTotalPhysicalMemoryUsedWithoutSystemResource();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
|
|
||||||
|
case InfoType::IsApplication:
|
||||||
|
LOG_WARNING(Kernel_SVC, "(STUBBED) Assuming process is application");
|
||||||
|
*result = true;
|
||||||
|
return ResultSuccess;
|
||||||
|
|
||||||
case InfoType::FreeThreadCount:
|
case InfoType::FreeThreadCount:
|
||||||
*result = process->GetFreeThreadCount();
|
*result = process->GetFreeThreadCount();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
|
|
|
@ -12,56 +12,40 @@
|
||||||
|
|
||||||
namespace Kernel::Svc {
|
namespace Kernel::Svc {
|
||||||
|
|
||||||
/// Connect to an OS service given the port name, returns the handle to the port to out
|
Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr user_name) {
|
||||||
Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_address) {
|
// Copy the provided name from user memory to kernel memory.
|
||||||
auto& memory = system.Memory();
|
auto string_name = system.Memory().ReadCString(user_name, KObjectName::NameLengthMax);
|
||||||
if (!memory.IsValidVirtualAddress(port_name_address)) {
|
|
||||||
LOG_ERROR(Kernel_SVC,
|
|
||||||
"Port Name Address is not a valid virtual address, port_name_address=0x{:016X}",
|
|
||||||
port_name_address);
|
|
||||||
return ResultNotFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr std::size_t PortNameMaxLength = 11;
|
std::array<char, KObjectName::NameLengthMax> name{};
|
||||||
// Read 1 char beyond the max allowed port name to detect names that are too long.
|
std::strncpy(name.data(), string_name.c_str(), KObjectName::NameLengthMax - 1);
|
||||||
const std::string port_name = memory.ReadCString(port_name_address, PortNameMaxLength + 1);
|
|
||||||
if (port_name.size() > PortNameMaxLength) {
|
|
||||||
LOG_ERROR(Kernel_SVC, "Port name is too long, expected {} but got {}", PortNameMaxLength,
|
|
||||||
port_name.size());
|
|
||||||
return ResultOutOfRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
|
// Validate that the name is valid.
|
||||||
|
R_UNLESS(name[sizeof(name) - 1] == '\x00', ResultOutOfRange);
|
||||||
|
|
||||||
// Get the current handle table.
|
// Get the current handle table.
|
||||||
auto& kernel = system.Kernel();
|
auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
|
||||||
auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
|
|
||||||
|
|
||||||
// Find the client port.
|
// Find the client port.
|
||||||
auto port = kernel.CreateNamedServicePort(port_name);
|
auto port = KObjectName::Find<KClientPort>(system.Kernel(), name.data());
|
||||||
if (!port) {
|
R_UNLESS(port.IsNotNull(), ResultNotFound);
|
||||||
LOG_ERROR(Kernel_SVC, "tried to connect to unknown port: {}", port_name);
|
|
||||||
return ResultNotFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reserve a handle for the port.
|
// Reserve a handle for the port.
|
||||||
// NOTE: Nintendo really does write directly to the output handle here.
|
// NOTE: Nintendo really does write directly to the output handle here.
|
||||||
R_TRY(handle_table.Reserve(out));
|
R_TRY(handle_table.Reserve(out));
|
||||||
auto handle_guard = SCOPE_GUARD({ handle_table.Unreserve(*out); });
|
ON_RESULT_FAILURE {
|
||||||
|
handle_table.Unreserve(*out);
|
||||||
|
};
|
||||||
|
|
||||||
// Create a session.
|
// Create a session.
|
||||||
KClientSession* session{};
|
KClientSession* session;
|
||||||
R_TRY(port->CreateSession(std::addressof(session)));
|
R_TRY(port->CreateSession(std::addressof(session)));
|
||||||
|
|
||||||
kernel.RegisterNamedServiceHandler(port_name, &port->GetParent()->GetServerPort());
|
|
||||||
|
|
||||||
// Register the session in the table, close the extra reference.
|
// Register the session in the table, close the extra reference.
|
||||||
handle_table.Register(*out, session);
|
handle_table.Register(*out, session);
|
||||||
session->Close();
|
session->Close();
|
||||||
|
|
||||||
// We succeeded.
|
// We succeeded.
|
||||||
handle_guard.Cancel();
|
R_SUCCEED();
|
||||||
return ResultSuccess;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client,
|
Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client,
|
||||||
|
@ -77,9 +61,12 @@ Result ConnectToPort(Core::System& system, Handle* out_handle, Handle port) {
|
||||||
|
|
||||||
Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t user_name,
|
Result ManageNamedPort(Core::System& system, Handle* out_server_handle, uint64_t user_name,
|
||||||
int32_t max_sessions) {
|
int32_t max_sessions) {
|
||||||
|
// Copy the provided name from user memory to kernel memory.
|
||||||
|
auto string_name = system.Memory().ReadCString(user_name, KObjectName::NameLengthMax);
|
||||||
|
|
||||||
// Copy the provided name from user memory to kernel memory.
|
// Copy the provided name from user memory to kernel memory.
|
||||||
std::array<char, KObjectName::NameLengthMax> name{};
|
std::array<char, KObjectName::NameLengthMax> name{};
|
||||||
system.Memory().ReadBlock(user_name, name.data(), sizeof(name));
|
std::strncpy(name.data(), string_name.c_str(), KObjectName::NameLengthMax - 1);
|
||||||
|
|
||||||
// Validate that sessions and name are valid.
|
// Validate that sessions and name are valid.
|
||||||
R_UNLESS(max_sessions >= 0, ResultOutOfRange);
|
R_UNLESS(max_sessions >= 0, ResultOutOfRange);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "core/hle/service/acc/errors.h"
|
#include "core/hle/service/acc/errors.h"
|
||||||
#include "core/hle/service/acc/profile_manager.h"
|
#include "core/hle/service/acc/profile_manager.h"
|
||||||
#include "core/hle/service/glue/glue_manager.h"
|
#include "core/hle/service/glue/glue_manager.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
|
||||||
namespace Service::Account {
|
namespace Service::Account {
|
||||||
|
@ -942,18 +943,20 @@ Module::Interface::Interface(std::shared_ptr<Module> module_,
|
||||||
|
|
||||||
Module::Interface::~Interface() = default;
|
Module::Interface::~Interface() = default;
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
auto module = std::make_shared<Module>();
|
auto module = std::make_shared<Module>();
|
||||||
auto profile_manager = std::make_shared<ProfileManager>();
|
auto profile_manager = std::make_shared<ProfileManager>();
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
std::make_shared<ACC_AA>(module, profile_manager, system)
|
server_manager->RegisterNamedService("acc:aa",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<ACC_AA>(module, profile_manager, system));
|
||||||
std::make_shared<ACC_SU>(module, profile_manager, system)
|
server_manager->RegisterNamedService("acc:su",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<ACC_SU>(module, profile_manager, system));
|
||||||
std::make_shared<ACC_U0>(module, profile_manager, system)
|
server_manager->RegisterNamedService("acc:u0",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<ACC_U0>(module, profile_manager, system));
|
||||||
std::make_shared<ACC_U1>(module, profile_manager, system)
|
server_manager->RegisterNamedService("acc:u1",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<ACC_U1>(module, profile_manager, system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Account
|
} // namespace Service::Account
|
||||||
|
|
|
@ -67,7 +67,6 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all ACC services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::Account
|
} // namespace Service::Account
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "core/hle/service/ns/ns.h"
|
#include "core/hle/service/ns/ns.h"
|
||||||
#include "core/hle/service/nvflinger/nvflinger.h"
|
#include "core/hle/service/nvflinger/nvflinger.h"
|
||||||
#include "core/hle/service/pm/pm.h"
|
#include "core/hle/service/pm/pm.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
#include "core/hle/service/vi/vi.h"
|
#include "core/hle/service/vi/vi.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
@ -1828,17 +1829,21 @@ void IApplicationFunctions::PrepareForJit(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
|
void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system) {
|
||||||
Core::System& system) {
|
|
||||||
auto message_queue = std::make_shared<AppletMessageQueue>(system);
|
auto message_queue = std::make_shared<AppletMessageQueue>(system);
|
||||||
// Needed on game boot
|
// Needed on game boot
|
||||||
message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged);
|
||||||
|
|
||||||
std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager);
|
|
||||||
std::make_shared<IdleSys>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService(
|
||||||
std::make_shared<OMM>(system)->InstallAsService(service_manager);
|
"appletAE", std::make_shared<AppletAE>(nvflinger, message_queue, system));
|
||||||
std::make_shared<SPSM>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService(
|
||||||
|
"appletOE", std::make_shared<AppletOE>(nvflinger, message_queue, system));
|
||||||
|
server_manager->RegisterNamedService("idle:sys", std::make_shared<IdleSys>(system));
|
||||||
|
server_manager->RegisterNamedService("omm", std::make_shared<OMM>(system));
|
||||||
|
server_manager->RegisterNamedService("spsm", std::make_shared<SPSM>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
|
IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
|
||||||
|
|
|
@ -396,8 +396,6 @@ public:
|
||||||
~IProcessWindingController() override;
|
~IProcessWindingController() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all AM services with the specified service manager.
|
void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
|
|
||||||
Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::AM
|
} // namespace Service::AM
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/aoc/aoc_u.h"
|
#include "core/hle/service/aoc/aoc_u.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
|
||||||
namespace Service::AOC {
|
namespace Service::AOC {
|
||||||
|
@ -311,8 +312,10 @@ void AOC_U::CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ct
|
||||||
rb.PushIpcInterface<IPurchaseEventManager>(system);
|
rb.PushIpcInterface<IPurchaseEventManager>(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<AOC_U>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
server_manager->RegisterNamedService("aoc:u", std::make_shared<AOC_U>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::AOC
|
} // namespace Service::AOC
|
||||||
|
|
|
@ -40,7 +40,6 @@ private:
|
||||||
Kernel::KEvent* aoc_change_event;
|
Kernel::KEvent* aoc_change_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all AOC services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::AOC
|
} // namespace Service::AOC
|
||||||
|
|
|
@ -4,20 +4,24 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/service/apm/apm.h"
|
#include "core/hle/service/apm/apm.h"
|
||||||
#include "core/hle/service/apm/apm_interface.h"
|
#include "core/hle/service/apm/apm_interface.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace Service::APM {
|
namespace Service::APM {
|
||||||
|
|
||||||
Module::Module() = default;
|
Module::Module() = default;
|
||||||
Module::~Module() = default;
|
Module::~Module() = default;
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
auto module_ = std::make_shared<Module>();
|
auto module = std::make_shared<Module>();
|
||||||
std::make_shared<APM>(system, module_, system.GetAPMController(), "apm")
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
->InstallAsService(system.ServiceManager());
|
|
||||||
std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:am")
|
server_manager->RegisterNamedService(
|
||||||
->InstallAsService(system.ServiceManager());
|
"apm", std::make_shared<APM>(system, module, system.GetAPMController(), "apm"));
|
||||||
std::make_shared<APM_Sys>(system, system.GetAPMController())
|
server_manager->RegisterNamedService(
|
||||||
->InstallAsService(system.ServiceManager());
|
"apm:am", std::make_shared<APM>(system, module, system.GetAPMController(), "apm:am"));
|
||||||
|
server_manager->RegisterNamedService(
|
||||||
|
"apm:sys", std::make_shared<APM_Sys>(system, system.GetAPMController()));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::APM
|
} // namespace Service::APM
|
||||||
|
|
|
@ -15,7 +15,6 @@ public:
|
||||||
~Module();
|
~Module();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all AM services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::APM
|
} // namespace Service::APM
|
||||||
|
|
|
@ -203,9 +203,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
AudInU::AudInU(Core::System& system_)
|
AudInU::AudInU(Core::System& system_)
|
||||||
: ServiceFramework{system_, "audin:u", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "audin:u"}, service_context{system_, "AudInU"},
|
||||||
service_context{system_, "AudInU"}, impl{std::make_unique<AudioCore::AudioIn::Manager>(
|
impl{std::make_unique<AudioCore::AudioIn::Manager>(system_)} {
|
||||||
system_)} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &AudInU::ListAudioIns, "ListAudioIns"},
|
{0, &AudInU::ListAudioIns, "ListAudioIns"},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/core.h"
|
||||||
#include "core/hle/service/audio/audctl.h"
|
#include "core/hle/service/audio/audctl.h"
|
||||||
#include "core/hle/service/audio/audin_u.h"
|
#include "core/hle/service/audio/audin_u.h"
|
||||||
#include "core/hle/service/audio/audio.h"
|
#include "core/hle/service/audio/audio.h"
|
||||||
|
@ -9,18 +10,22 @@
|
||||||
#include "core/hle/service/audio/audrec_u.h"
|
#include "core/hle/service/audio/audrec_u.h"
|
||||||
#include "core/hle/service/audio/audren_u.h"
|
#include "core/hle/service/audio/audren_u.h"
|
||||||
#include "core/hle/service/audio/hwopus.h"
|
#include "core/hle/service/audio/hwopus.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::Audio {
|
namespace Service::Audio {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<AudCtl>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<AudOutU>(system)->InstallAsService(service_manager);
|
|
||||||
std::make_shared<AudInU>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("audctl", std::make_shared<AudCtl>(system));
|
||||||
std::make_shared<AudRecA>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("audout:u", std::make_shared<AudOutU>(system));
|
||||||
std::make_shared<AudRecU>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("audin:u", std::make_shared<AudInU>(system));
|
||||||
std::make_shared<AudRenU>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("audrec:a", std::make_shared<AudRecA>(system));
|
||||||
std::make_shared<HwOpus>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("audrec:u", std::make_shared<AudRecU>(system));
|
||||||
|
server_manager->RegisterNamedService("audren:u", std::make_shared<AudRenU>(system));
|
||||||
|
server_manager->RegisterNamedService("hwopus", std::make_shared<HwOpus>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Audio
|
} // namespace Service::Audio
|
||||||
|
|
|
@ -13,7 +13,6 @@ class ServiceManager;
|
||||||
|
|
||||||
namespace Service::Audio {
|
namespace Service::Audio {
|
||||||
|
|
||||||
/// Registers all Audio services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::Audio
|
} // namespace Service::Audio
|
||||||
|
|
|
@ -26,9 +26,8 @@ public:
|
||||||
explicit IAudioOut(Core::System& system_, AudioCore::AudioOut::Manager& manager,
|
explicit IAudioOut(Core::System& system_, AudioCore::AudioOut::Manager& manager,
|
||||||
size_t session_id, const std::string& device_name,
|
size_t session_id, const std::string& device_name,
|
||||||
const AudioOutParameter& in_params, u32 handle, u64 applet_resource_user_id)
|
const AudioOutParameter& in_params, u32 handle, u64 applet_resource_user_id)
|
||||||
: ServiceFramework{system_, "IAudioOut", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IAudioOut"}, service_context{system_, "IAudioOut"},
|
||||||
service_context{system_, "IAudioOut"}, event{service_context.CreateEvent(
|
event{service_context.CreateEvent("AudioOutEvent")},
|
||||||
"AudioOutEvent")},
|
|
||||||
impl{std::make_shared<AudioCore::AudioOut::Out>(system_, manager, event, session_id)} {
|
impl{std::make_shared<AudioCore::AudioOut::Out>(system_, manager, event, session_id)} {
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
@ -221,9 +220,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
AudOutU::AudOutU(Core::System& system_)
|
AudOutU::AudOutU(Core::System& system_)
|
||||||
: ServiceFramework{system_, "audout:u", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "audout:u"}, service_context{system_, "AudOutU"},
|
||||||
service_context{system_, "AudOutU"}, impl{std::make_unique<AudioCore::AudioOut::Manager>(
|
impl{std::make_unique<AudioCore::AudioOut::Manager>(system_)} {
|
||||||
system_)} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &AudOutU::ListAudioOuts, "ListAudioOuts"},
|
{0, &AudOutU::ListAudioOuts, "ListAudioOuts"},
|
||||||
|
|
|
@ -35,10 +35,9 @@ public:
|
||||||
AudioCore::AudioRendererParameterInternal& params,
|
AudioCore::AudioRendererParameterInternal& params,
|
||||||
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
|
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
|
||||||
u32 process_handle, u64 applet_resource_user_id, s32 session_id)
|
u32 process_handle, u64 applet_resource_user_id, s32 session_id)
|
||||||
: ServiceFramework{system_, "IAudioRenderer", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"},
|
||||||
service_context{system_, "IAudioRenderer"}, rendered_event{service_context.CreateEvent(
|
rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_},
|
||||||
"IAudioRendererEvent")},
|
impl{std::make_unique<Renderer>(system_, manager, rendered_event)} {
|
||||||
manager{manager_}, impl{std::make_unique<Renderer>(system_, manager, rendered_event)} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
|
{0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
|
||||||
|
@ -243,10 +242,8 @@ class IAudioDevice final : public ServiceFramework<IAudioDevice> {
|
||||||
public:
|
public:
|
||||||
explicit IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision,
|
explicit IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision,
|
||||||
u32 device_num)
|
u32 device_num)
|
||||||
: ServiceFramework{system_, "IAudioDevice", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IAudioDevice"}, service_context{system_, "IAudioDevice"},
|
||||||
service_context{system_, "IAudioDevice"}, impl{std::make_unique<AudioDevice>(
|
impl{std::make_unique<AudioDevice>(system_, applet_resource_user_id, revision)},
|
||||||
system_, applet_resource_user_id,
|
|
||||||
revision)},
|
|
||||||
event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} {
|
event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
|
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
|
||||||
|
@ -421,7 +418,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
AudRenU::AudRenU(Core::System& system_)
|
AudRenU::AudRenU(Core::System& system_)
|
||||||
: ServiceFramework{system_, "audren:u", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "audren:u"},
|
||||||
service_context{system_, "audren:u"}, impl{std::make_unique<Manager>(system_)} {
|
service_context{system_, "audren:u"}, impl{std::make_unique<Manager>(system_)} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "core/hle/service/bcat/bcat.h"
|
#include "core/hle/service/bcat/bcat.h"
|
||||||
#include "core/hle/service/bcat/bcat_module.h"
|
#include "core/hle/service/bcat/bcat_module.h"
|
||||||
#include "core/hle/service/filesystem/filesystem.h"
|
#include "core/hle/service/filesystem/filesystem.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace Service::BCAT {
|
namespace Service::BCAT {
|
||||||
|
|
||||||
|
@ -585,16 +586,23 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
|
||||||
|
|
||||||
Module::Interface::~Interface() = default;
|
Module::Interface::~Interface() = default;
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
auto module = std::make_shared<Module>();
|
auto module = std::make_shared<Module>();
|
||||||
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a")
|
|
||||||
->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService(
|
||||||
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:m")
|
"bcat:a",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a"));
|
||||||
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:u")
|
server_manager->RegisterNamedService(
|
||||||
->InstallAsService(system.ServiceManager());
|
"bcat:m",
|
||||||
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:s")
|
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:m"));
|
||||||
->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService(
|
||||||
|
"bcat:u",
|
||||||
|
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:u"));
|
||||||
|
server_manager->RegisterNamedService(
|
||||||
|
"bcat:s",
|
||||||
|
std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:s"));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::BCAT
|
} // namespace Service::BCAT
|
||||||
|
|
|
@ -39,8 +39,7 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all BCAT services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(Core::System& system);
|
|
||||||
|
|
||||||
} // namespace BCAT
|
} // namespace BCAT
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "core/hle/service/bpc/bpc.h"
|
#include "core/hle/service/bpc/bpc.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::BPC {
|
namespace Service::BPC {
|
||||||
|
|
||||||
|
@ -54,9 +54,12 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<BPC>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<BPC_R>(system)->InstallAsService(sm);
|
|
||||||
|
server_manager->RegisterNamedService("bpc", std::make_shared<BPC>(system));
|
||||||
|
server_manager->RegisterNamedService("bpc:r", std::make_shared<BPC_R>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::BPC
|
} // namespace Service::BPC
|
||||||
|
|
|
@ -13,6 +13,6 @@ class ServiceManager;
|
||||||
|
|
||||||
namespace Service::BPC {
|
namespace Service::BPC {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::BPC
|
} // namespace Service::BPC
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/btdrv/btdrv.h"
|
#include "core/hle/service/btdrv/btdrv.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
|
@ -196,9 +197,12 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<BtDrv>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<Bt>(system)->InstallAsService(sm);
|
|
||||||
|
server_manager->RegisterNamedService("btdrv", std::make_shared<BtDrv>(system));
|
||||||
|
server_manager->RegisterNamedService("bt", std::make_shared<Bt>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::BtDrv
|
} // namespace Service::BtDrv
|
||||||
|
|
|
@ -13,7 +13,6 @@ class System;
|
||||||
|
|
||||||
namespace Service::BtDrv {
|
namespace Service::BtDrv {
|
||||||
|
|
||||||
/// Registers all BtDrv services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::BtDrv
|
} // namespace Service::BtDrv
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/btm/btm.h"
|
#include "core/hle/service/btm/btm.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::BTM {
|
namespace Service::BTM {
|
||||||
|
@ -311,11 +312,14 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<BTM>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<BTM_DBG>(system)->InstallAsService(sm);
|
|
||||||
std::make_shared<BTM_SYS>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("btm", std::make_shared<BTM>(system));
|
||||||
std::make_shared<BTM_USR>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("btm:dbg", std::make_shared<BTM_DBG>(system));
|
||||||
|
server_manager->RegisterNamedService("btm:sys", std::make_shared<BTM_SYS>(system));
|
||||||
|
server_manager->RegisterNamedService("btm:u", std::make_shared<BTM_USR>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::BTM
|
} // namespace Service::BTM
|
||||||
|
|
|
@ -13,6 +13,6 @@ class System;
|
||||||
|
|
||||||
namespace Service::BTM {
|
namespace Service::BTM {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::BTM
|
} // namespace Service::BTM
|
||||||
|
|
|
@ -8,17 +8,21 @@
|
||||||
#include "core/hle/service/caps/caps_ss.h"
|
#include "core/hle/service/caps/caps_ss.h"
|
||||||
#include "core/hle/service/caps/caps_su.h"
|
#include "core/hle/service/caps/caps_su.h"
|
||||||
#include "core/hle/service/caps/caps_u.h"
|
#include "core/hle/service/caps/caps_u.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::Capture {
|
namespace Service::Capture {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<CAPS_A>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<CAPS_C>(system)->InstallAsService(sm);
|
|
||||||
std::make_shared<CAPS_U>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("caps:a", std::make_shared<CAPS_A>(system));
|
||||||
std::make_shared<CAPS_SC>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("caps:c", std::make_shared<CAPS_C>(system));
|
||||||
std::make_shared<CAPS_SS>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("caps:u", std::make_shared<CAPS_U>(system));
|
||||||
std::make_shared<CAPS_SU>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("caps:sc", std::make_shared<CAPS_SC>(system));
|
||||||
|
server_manager->RegisterNamedService("caps:ss", std::make_shared<CAPS_SS>(system));
|
||||||
|
server_manager->RegisterNamedService("caps:su", std::make_shared<CAPS_SU>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Capture
|
} // namespace Service::Capture
|
||||||
|
|
|
@ -90,7 +90,6 @@ struct ApplicationAlbumFileEntry {
|
||||||
static_assert(sizeof(ApplicationAlbumFileEntry) == 0x30,
|
static_assert(sizeof(ApplicationAlbumFileEntry) == 0x30,
|
||||||
"ApplicationAlbumFileEntry has incorrect size.");
|
"ApplicationAlbumFileEntry has incorrect size.");
|
||||||
|
|
||||||
/// Registers all Capture services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::Capture
|
} // namespace Service::Capture
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "core/hle/service/erpt/erpt.h"
|
#include "core/hle/service/erpt/erpt.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
|
@ -52,9 +53,13 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<ErrorReportContext>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<ErrorReportSession>(system)->InstallAsService(sm);
|
|
||||||
|
server_manager->RegisterNamedService("erpt:c", std::make_shared<ErrorReportContext>(system));
|
||||||
|
server_manager->RegisterNamedService("erpt:r", std::make_shared<ErrorReportSession>(system));
|
||||||
|
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::ERPT
|
} // namespace Service::ERPT
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::ERPT {
|
namespace Service::ERPT {
|
||||||
|
|
||||||
/// Registers all ERPT services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::ERPT
|
} // namespace Service::ERPT
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "core/crypto/key_manager.h"
|
#include "core/crypto/key_manager.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/es/es.h"
|
#include "core/hle/service/es/es.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::ES {
|
namespace Service::ES {
|
||||||
|
@ -307,8 +308,11 @@ private:
|
||||||
Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();
|
Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<ETicket>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("es", std::make_shared<ETicket>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::ES
|
} // namespace Service::ES
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::ES {
|
namespace Service::ES {
|
||||||
|
|
||||||
/// Registers all ES services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::ES
|
} // namespace Service::ES
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "core/hle/service/eupld/eupld.h"
|
#include "core/hle/service/eupld/eupld.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::EUPLD {
|
namespace Service::EUPLD {
|
||||||
|
|
||||||
|
@ -44,9 +44,12 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<ErrorUploadContext>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<ErrorUploadRequest>(system)->InstallAsService(sm);
|
|
||||||
|
server_manager->RegisterNamedService("eupld:c", std::make_shared<ErrorUploadContext>(system));
|
||||||
|
server_manager->RegisterNamedService("eupld:r", std::make_shared<ErrorUploadRequest>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::EUPLD
|
} // namespace Service::EUPLD
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::EUPLD {
|
namespace Service::EUPLD {
|
||||||
|
|
||||||
/// Registers all EUPLD services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::EUPLD
|
} // namespace Service::EUPLD
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "core/hle/service/fatal/fatal.h"
|
#include "core/hle/service/fatal/fatal.h"
|
||||||
#include "core/hle/service/fatal/fatal_p.h"
|
#include "core/hle/service/fatal/fatal_p.h"
|
||||||
#include "core/hle/service/fatal/fatal_u.h"
|
#include "core/hle/service/fatal/fatal_u.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/reporter.h"
|
#include "core/reporter.h"
|
||||||
|
|
||||||
namespace Service::Fatal {
|
namespace Service::Fatal {
|
||||||
|
@ -163,10 +164,13 @@ void Module::Interface::ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx)
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
auto module = std::make_shared<Module>();
|
auto module = std::make_shared<Module>();
|
||||||
std::make_shared<Fatal_P>(module, system)->InstallAsService(service_manager);
|
|
||||||
std::make_shared<Fatal_U>(module, system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("fatal:p", std::make_shared<Fatal_P>(module, system));
|
||||||
|
server_manager->RegisterNamedService("fatal:u", std::make_shared<Fatal_U>(module, system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Fatal
|
} // namespace Service::Fatal
|
||||||
|
|
|
@ -28,6 +28,6 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::Fatal
|
} // namespace Service::Fatal
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/fgm/fgm.h"
|
#include "core/hle/service/fgm/fgm.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
|
@ -63,11 +64,14 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<FGM>(system, "fgm")->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<FGM>(system, "fgm:0")->InstallAsService(sm);
|
|
||||||
std::make_shared<FGM>(system, "fgm:9")->InstallAsService(sm);
|
server_manager->RegisterNamedService("fgm", std::make_shared<FGM>(system, "fgm"));
|
||||||
std::make_shared<FGM_DBG>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("fgm:0", std::make_shared<FGM>(system, "fgm:0"));
|
||||||
|
server_manager->RegisterNamedService("fgm:9", std::make_shared<FGM>(system, "fgm:9"));
|
||||||
|
server_manager->RegisterNamedService("fgm:dbg", std::make_shared<FGM_DBG>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::FGM
|
} // namespace Service::FGM
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::FGM {
|
namespace Service::FGM {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::FGM
|
} // namespace Service::FGM
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "core/hle/service/filesystem/fsp_ldr.h"
|
#include "core/hle/service/filesystem/fsp_ldr.h"
|
||||||
#include "core/hle/service/filesystem/fsp_pr.h"
|
#include "core/hle/service/filesystem/fsp_pr.h"
|
||||||
#include "core/hle/service/filesystem/fsp_srv.h"
|
#include "core/hle/service/filesystem/fsp_srv.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
|
||||||
namespace Service::FileSystem {
|
namespace Service::FileSystem {
|
||||||
|
@ -796,10 +797,13 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<FSP_LDR>(system)->InstallAsService(system.ServiceManager());
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<FSP_PR>(system)->InstallAsService(system.ServiceManager());
|
|
||||||
std::make_shared<FSP_SRV>(system)->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService("fsp-ldr", std::make_shared<FSP_LDR>(system));
|
||||||
|
server_manager->RegisterNamedService("fsp:pr", std::make_shared<FSP_PR>(system));
|
||||||
|
server_manager->RegisterNamedService("fsp-srv", std::make_shared<FSP_SRV>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::FileSystem
|
} // namespace Service::FileSystem
|
||||||
|
|
|
@ -139,7 +139,7 @@ private:
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
// A class that wraps a VfsDirectory with methods that return ResultVal and Result instead of
|
// A class that wraps a VfsDirectory with methods that return ResultVal and Result instead of
|
||||||
// pointers and booleans. This makes using a VfsDirectory with switch services much easier and
|
// pointers and booleans. This makes using a VfsDirectory with switch services much easier and
|
||||||
|
|
|
@ -57,8 +57,7 @@ enum class FileSystemType : u8 {
|
||||||
class IStorage final : public ServiceFramework<IStorage> {
|
class IStorage final : public ServiceFramework<IStorage> {
|
||||||
public:
|
public:
|
||||||
explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_)
|
explicit IStorage(Core::System& system_, FileSys::VirtualFile backend_)
|
||||||
: ServiceFramework{system_, "IStorage", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IStorage"}, backend(std::move(backend_)) {
|
||||||
backend(std::move(backend_)) {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IStorage::Read, "Read"},
|
{0, &IStorage::Read, "Read"},
|
||||||
{1, nullptr, "Write"},
|
{1, nullptr, "Write"},
|
||||||
|
@ -116,8 +115,7 @@ private:
|
||||||
class IFile final : public ServiceFramework<IFile> {
|
class IFile final : public ServiceFramework<IFile> {
|
||||||
public:
|
public:
|
||||||
explicit IFile(Core::System& system_, FileSys::VirtualFile backend_)
|
explicit IFile(Core::System& system_, FileSys::VirtualFile backend_)
|
||||||
: ServiceFramework{system_, "IFile", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IFile"}, backend(std::move(backend_)) {
|
||||||
backend(std::move(backend_)) {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IFile::Read, "Read"},
|
{0, &IFile::Read, "Read"},
|
||||||
{1, &IFile::Write, "Write"},
|
{1, &IFile::Write, "Write"},
|
||||||
|
@ -254,8 +252,7 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
|
||||||
class IDirectory final : public ServiceFramework<IDirectory> {
|
class IDirectory final : public ServiceFramework<IDirectory> {
|
||||||
public:
|
public:
|
||||||
explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_)
|
explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_)
|
||||||
: ServiceFramework{system_, "IDirectory", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IDirectory"}, backend(std::move(backend_)) {
|
||||||
backend(std::move(backend_)) {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IDirectory::Read, "Read"},
|
{0, &IDirectory::Read, "Read"},
|
||||||
{1, &IDirectory::GetEntryCount, "GetEntryCount"},
|
{1, &IDirectory::GetEntryCount, "GetEntryCount"},
|
||||||
|
@ -311,8 +308,8 @@ private:
|
||||||
class IFileSystem final : public ServiceFramework<IFileSystem> {
|
class IFileSystem final : public ServiceFramework<IFileSystem> {
|
||||||
public:
|
public:
|
||||||
explicit IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_)
|
explicit IFileSystem(Core::System& system_, FileSys::VirtualDir backend_, SizeGetter size_)
|
||||||
: ServiceFramework{system_, "IFileSystem", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IFileSystem"}, backend{std::move(backend_)}, size{std::move(
|
||||||
backend{std::move(backend_)}, size{std::move(size_)} {
|
size_)} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IFileSystem::CreateFile, "CreateFile"},
|
{0, &IFileSystem::CreateFile, "CreateFile"},
|
||||||
{1, &IFileSystem::DeleteFile, "DeleteFile"},
|
{1, &IFileSystem::DeleteFile, "DeleteFile"},
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "core/hle/service/friend/friend.h"
|
#include "core/hle/service/friend/friend.h"
|
||||||
#include "core/hle/service/friend/friend_interface.h"
|
#include "core/hle/service/friend/friend_interface.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace Service::Friend {
|
namespace Service::Friend {
|
||||||
|
|
||||||
|
@ -335,13 +336,22 @@ Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& syst
|
||||||
|
|
||||||
Module::Interface::~Interface() = default;
|
Module::Interface::~Interface() = default;
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
auto module = std::make_shared<Module>();
|
auto module = std::make_shared<Module>();
|
||||||
std::make_shared<Friend>(module, system, "friend:a")->InstallAsService(service_manager);
|
|
||||||
std::make_shared<Friend>(module, system, "friend:m")->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("friend:a",
|
||||||
std::make_shared<Friend>(module, system, "friend:s")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:a"));
|
||||||
std::make_shared<Friend>(module, system, "friend:u")->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("friend:m",
|
||||||
std::make_shared<Friend>(module, system, "friend:v")->InstallAsService(service_manager);
|
std::make_shared<Friend>(module, system, "friend:m"));
|
||||||
|
server_manager->RegisterNamedService("friend:s",
|
||||||
|
std::make_shared<Friend>(module, system, "friend:s"));
|
||||||
|
server_manager->RegisterNamedService("friend:u",
|
||||||
|
std::make_shared<Friend>(module, system, "friend:u"));
|
||||||
|
server_manager->RegisterNamedService("friend:v",
|
||||||
|
std::make_shared<Friend>(module, system, "friend:v"));
|
||||||
|
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Friend
|
} // namespace Service::Friend
|
||||||
|
|
|
@ -27,7 +27,6 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all Friend services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::Friend
|
} // namespace Service::Friend
|
||||||
|
|
|
@ -8,25 +8,30 @@
|
||||||
#include "core/hle/service/glue/ectx.h"
|
#include "core/hle/service/glue/ectx.h"
|
||||||
#include "core/hle/service/glue/glue.h"
|
#include "core/hle/service/glue/glue.h"
|
||||||
#include "core/hle/service/glue/notif.h"
|
#include "core/hle/service/glue/notif.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace Service::Glue {
|
namespace Service::Glue {
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
// ARP
|
// ARP
|
||||||
std::make_shared<ARP_R>(system, system.GetARPManager())
|
server_manager->RegisterNamedService("arp:r",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<ARP_R>(system, system.GetARPManager()));
|
||||||
std::make_shared<ARP_W>(system, system.GetARPManager())
|
server_manager->RegisterNamedService("arp:w",
|
||||||
->InstallAsService(system.ServiceManager());
|
std::make_shared<ARP_W>(system, system.GetARPManager()));
|
||||||
|
|
||||||
// BackGround Task Controller
|
// BackGround Task Controller
|
||||||
std::make_shared<BGTC_T>(system)->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService("bgtc:t", std::make_shared<BGTC_T>(system));
|
||||||
std::make_shared<BGTC_SC>(system)->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService("bgtc:sc", std::make_shared<BGTC_SC>(system));
|
||||||
|
|
||||||
// Error Context
|
// Error Context
|
||||||
std::make_shared<ECTX_AW>(system)->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService("ectx:aw", std::make_shared<ECTX_AW>(system));
|
||||||
|
|
||||||
// Notification Services for application
|
// Notification Services for application
|
||||||
std::make_shared<NOTIF_A>(system)->InstallAsService(system.ServiceManager());
|
server_manager->RegisterNamedService("notif:a", std::make_shared<NOTIF_A>(system));
|
||||||
|
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Glue
|
} // namespace Service::Glue
|
||||||
|
|
|
@ -9,7 +9,6 @@ class System;
|
||||||
|
|
||||||
namespace Service::Glue {
|
namespace Service::Glue {
|
||||||
|
|
||||||
/// Registers all Glue services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::Glue
|
} // namespace Service::Glue
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "core/hle/service/grc/grc.h"
|
#include "core/hle/service/grc/grc.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::GRC {
|
namespace Service::GRC {
|
||||||
|
|
||||||
|
@ -26,8 +26,11 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<GRC>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("grc:c", std::make_shared<GRC>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::GRC
|
} // namespace Service::GRC
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::GRC {
|
namespace Service::GRC {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::GRC
|
} // namespace Service::GRC
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "core/hle/service/hid/hidbus.h"
|
#include "core/hle/service/hid/hidbus.h"
|
||||||
#include "core/hle/service/hid/irs.h"
|
#include "core/hle/service/hid/irs.h"
|
||||||
#include "core/hle/service/hid/xcd.h"
|
#include "core/hle/service/hid/xcd.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
#include "core/hle/service/hid/controllers/console_sixaxis.h"
|
#include "core/hle/service/hid/controllers/console_sixaxis.h"
|
||||||
|
@ -2734,16 +2735,20 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<Hid>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<HidBus>(system)->InstallAsService(service_manager);
|
|
||||||
std::make_shared<HidDbg>(system)->InstallAsService(service_manager);
|
|
||||||
std::make_shared<HidSys>(system)->InstallAsService(service_manager);
|
|
||||||
|
|
||||||
std::make_shared<Service::IRS::IRS>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("hid", std::make_shared<Hid>(system));
|
||||||
std::make_shared<Service::IRS::IRS_SYS>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("hidbus", std::make_shared<HidBus>(system));
|
||||||
|
server_manager->RegisterNamedService("hid:dbg", std::make_shared<HidDbg>(system));
|
||||||
|
server_manager->RegisterNamedService("hid:sys", std::make_shared<HidSys>(system));
|
||||||
|
|
||||||
std::make_shared<XCD_SYS>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("irs", std::make_shared<Service::IRS::IRS>(system));
|
||||||
|
server_manager->RegisterNamedService("irs:sys",
|
||||||
|
std::make_shared<Service::IRS::IRS_SYS>(system));
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("xcd:sys", std::make_shared<XCD_SYS>(system));
|
||||||
|
system.RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
|
@ -209,7 +209,6 @@ private:
|
||||||
KernelHelpers::ServiceContext service_context;
|
KernelHelpers::ServiceContext service_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all HID services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/jit/jit.h"
|
#include "core/hle/service/jit/jit.h"
|
||||||
#include "core/hle/service/jit/jit_context.h"
|
#include "core/hle/service/jit/jit_context.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ class IJitEnvironment final : public ServiceFramework<IJitEnvironment> {
|
||||||
public:
|
public:
|
||||||
explicit IJitEnvironment(Core::System& system_, Kernel::KProcess& process_, CodeRange user_rx,
|
explicit IJitEnvironment(Core::System& system_, Kernel::KProcess& process_, CodeRange user_rx,
|
||||||
CodeRange user_ro)
|
CodeRange user_ro)
|
||||||
: ServiceFramework{system_, "IJitEnvironment", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IJitEnvironment"}, process{&process_}, context{
|
||||||
process{&process_}, context{system_.Memory()} {
|
system_.Memory()} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IJitEnvironment::GenerateCode, "GenerateCode"},
|
{0, &IJitEnvironment::GenerateCode, "GenerateCode"},
|
||||||
|
@ -397,8 +398,11 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<JITU>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("jit:u", std::make_shared<JITU>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::JIT
|
} // namespace Service::JIT
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::JIT {
|
namespace Service::JIT {
|
||||||
|
|
||||||
/// Registers all JIT services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::JIT
|
} // namespace Service::JIT
|
||||||
|
|
|
@ -15,18 +15,25 @@ namespace Service::KernelHelpers {
|
||||||
|
|
||||||
ServiceContext::ServiceContext(Core::System& system_, std::string name_)
|
ServiceContext::ServiceContext(Core::System& system_, std::string name_)
|
||||||
: kernel(system_.Kernel()) {
|
: kernel(system_.Kernel()) {
|
||||||
|
if (process = Kernel::GetCurrentProcessPointer(kernel); process != nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the process.
|
// Create the process.
|
||||||
process = Kernel::KProcess::Create(kernel);
|
process = Kernel::KProcess::Create(kernel);
|
||||||
ASSERT(Kernel::KProcess::Initialize(process, system_, std::move(name_),
|
ASSERT(Kernel::KProcess::Initialize(process, system_, std::move(name_),
|
||||||
Kernel::KProcess::ProcessType::KernelInternal,
|
Kernel::KProcess::ProcessType::KernelInternal,
|
||||||
kernel.GetSystemResourceLimit())
|
kernel.GetSystemResourceLimit())
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
|
process_created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceContext::~ServiceContext() {
|
ServiceContext::~ServiceContext() {
|
||||||
|
if (process_created) {
|
||||||
process->Close();
|
process->Close();
|
||||||
process = nullptr;
|
process = nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Kernel::KEvent* ServiceContext::CreateEvent(std::string&& name) {
|
Kernel::KEvent* ServiceContext::CreateEvent(std::string&& name) {
|
||||||
// Reserve a new event from the process resource limit
|
// Reserve a new event from the process resource limit
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Kernel::KernelCore& kernel;
|
Kernel::KernelCore& kernel;
|
||||||
Kernel::KProcess* process{};
|
Kernel::KProcess* process{};
|
||||||
|
bool process_created{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::KernelHelpers
|
} // namespace Service::KernelHelpers
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/lbl/lbl.h"
|
#include "core/hle/service/lbl/lbl.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
|
@ -319,8 +320,11 @@ private:
|
||||||
bool auto_brightness = false; // TODO(ogniK): Move to system settings
|
bool auto_brightness = false; // TODO(ogniK): Move to system settings
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<LBL>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("lbl", std::make_shared<LBL>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::LBL
|
} // namespace Service::LBL
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::LBL {
|
namespace Service::LBL {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::LBL
|
} // namespace Service::LBL
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "core/hle/service/ldn/ldn.h"
|
#include "core/hle/service/ldn/ldn.h"
|
||||||
#include "core/hle/service/ldn/ldn_results.h"
|
#include "core/hle/service/ldn/ldn_results.h"
|
||||||
#include "core/hle/service/ldn/ldn_types.h"
|
#include "core/hle/service/ldn/ldn_types.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/internal_network/network.h"
|
#include "core/internal_network/network.h"
|
||||||
#include "core/internal_network/network_interface.h"
|
#include "core/internal_network/network_interface.h"
|
||||||
#include "network/network.h"
|
#include "network/network.h"
|
||||||
|
@ -106,7 +107,7 @@ class IUserLocalCommunicationService final
|
||||||
: public ServiceFramework<IUserLocalCommunicationService> {
|
: public ServiceFramework<IUserLocalCommunicationService> {
|
||||||
public:
|
public:
|
||||||
explicit IUserLocalCommunicationService(Core::System& system_)
|
explicit IUserLocalCommunicationService(Core::System& system_)
|
||||||
: ServiceFramework{system_, "IUserLocalCommunicationService", ServiceThreadType::CreateNew},
|
: ServiceFramework{system_, "IUserLocalCommunicationService"},
|
||||||
service_context{system, "IUserLocalCommunicationService"},
|
service_context{system, "IUserLocalCommunicationService"},
|
||||||
room_network{system_.GetRoomNetwork()}, lan_discovery{room_network} {
|
room_network{system_.GetRoomNetwork()}, lan_discovery{room_network} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
@ -730,12 +731,15 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<LDNM>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<LDNS>(system)->InstallAsService(sm);
|
|
||||||
std::make_shared<LDNU>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("ldn:m", std::make_shared<LDNM>(system));
|
||||||
std::make_shared<LP2PAPP>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("ldn:s", std::make_shared<LDNS>(system));
|
||||||
std::make_shared<LP2PSYS>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("ldn:u", std::make_shared<LDNU>(system));
|
||||||
|
server_manager->RegisterNamedService("lp2p:app", std::make_shared<LP2PAPP>(system));
|
||||||
|
server_manager->RegisterNamedService("lp2p:sys", std::make_shared<LP2PSYS>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::LDN
|
} // namespace Service::LDN
|
||||||
|
|
|
@ -13,13 +13,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::LDN {
|
namespace Service::LDN {
|
||||||
|
|
||||||
/// Registers all LDN services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::LDN
|
} // namespace Service::LDN
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "core/hle/kernel/svc_results.h"
|
#include "core/hle/kernel/svc_results.h"
|
||||||
#include "core/hle/kernel/svc_types.h"
|
#include "core/hle/kernel/svc_types.h"
|
||||||
#include "core/hle/service/ldr/ldr.h"
|
#include "core/hle/service/ldr/ldr.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/loader/nro.h"
|
#include "core/loader/nro.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
@ -159,8 +160,7 @@ public:
|
||||||
|
|
||||||
class RelocatableObject final : public ServiceFramework<RelocatableObject> {
|
class RelocatableObject final : public ServiceFramework<RelocatableObject> {
|
||||||
public:
|
public:
|
||||||
explicit RelocatableObject(Core::System& system_)
|
explicit RelocatableObject(Core::System& system_) : ServiceFramework{system_, "ldr:ro"} {
|
||||||
: ServiceFramework{system_, "ldr:ro", ServiceThreadType::CreateNew} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &RelocatableObject::LoadModule, "LoadModule"},
|
{0, &RelocatableObject::LoadModule, "LoadModule"},
|
||||||
|
@ -682,11 +682,15 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<DebugMonitor>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<ProcessManager>(system)->InstallAsService(sm);
|
|
||||||
std::make_shared<Shell>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("ldr:dmnt", std::make_shared<DebugMonitor>(system));
|
||||||
std::make_shared<RelocatableObject>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("ldr:pm", std::make_shared<ProcessManager>(system));
|
||||||
|
server_manager->RegisterNamedService("ldr:shel", std::make_shared<Shell>(system));
|
||||||
|
server_manager->RegisterNamedService("ldr:ro", std::make_shared<RelocatableObject>(system));
|
||||||
|
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::LDR
|
} // namespace Service::LDR
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::LDR {
|
namespace Service::LDR {
|
||||||
|
|
||||||
/// Registers all LDR services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::LDR
|
} // namespace Service::LDR
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/lm/lm.h"
|
#include "core/hle/service/lm/lm.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::LM {
|
namespace Service::LM {
|
||||||
|
@ -351,8 +352,11 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<LM>(system)->InstallAsService(system.ServiceManager());
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("lm", std::make_shared<LM>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::LM
|
} // namespace Service::LM
|
||||||
|
|
|
@ -9,7 +9,6 @@ class System;
|
||||||
|
|
||||||
namespace Service::LM {
|
namespace Service::LM {
|
||||||
|
|
||||||
/// Registers all LM services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::LM
|
} // namespace Service::LM
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "core/hle/service/mig/mig.h"
|
#include "core/hle/service/mig/mig.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::Migration {
|
namespace Service::Migration {
|
||||||
|
|
||||||
|
@ -32,8 +32,11 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<MIG_USR>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("mig:user", std::make_shared<MIG_USR>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Migration
|
} // namespace Service::Migration
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Migration {
|
namespace Service::Migration {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::Migration
|
} // namespace Service::Migration
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/mii/mii.h"
|
#include "core/hle/service/mii/mii.h"
|
||||||
#include "core/hle/service/mii/mii_manager.h"
|
#include "core/hle/service/mii/mii_manager.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::Mii {
|
namespace Service::Mii {
|
||||||
|
|
||||||
|
@ -310,11 +310,13 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<MiiDBModule>(system, "mii:e")->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<MiiDBModule>(system, "mii:u")->InstallAsService(sm);
|
|
||||||
|
|
||||||
std::make_shared<MiiImg>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("mii:e", std::make_shared<MiiDBModule>(system, "mii:e"));
|
||||||
|
server_manager->RegisterNamedService("mii:u", std::make_shared<MiiDBModule>(system, "mii:u"));
|
||||||
|
server_manager->RegisterNamedService("miiimg", std::make_shared<MiiImg>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Mii
|
} // namespace Service::Mii
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Mii {
|
namespace Service::Mii {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::Mii
|
} // namespace Service::Mii
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/mm/mm_u.h"
|
#include "core/hle/service/mm/mm_u.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/sm/sm.h"
|
||||||
|
|
||||||
namespace Service::MM {
|
namespace Service::MM {
|
||||||
|
@ -103,8 +104,11 @@ private:
|
||||||
u32 id{1};
|
u32 id{1};
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<MM_U>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("mm:u", std::make_shared<MM_U>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::MM
|
} // namespace Service::MM
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::MM {
|
namespace Service::MM {
|
||||||
|
|
||||||
/// Registers all MM services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::MM
|
} // namespace Service::MM
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/mnpp/mnpp_app.h"
|
#include "core/hle/service/mnpp/mnpp_app.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::MNPP {
|
namespace Service::MNPP {
|
||||||
|
|
||||||
|
@ -37,8 +38,11 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<MNPP_APP>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("mnpp:app", std::make_shared<MNPP_APP>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::MNPP
|
} // namespace Service::MNPP
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::MNPP {
|
namespace Service::MNPP {
|
||||||
|
|
||||||
/// Registers all MNPP services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::MNPP
|
} // namespace Service::MNPP
|
||||||
|
|
43
src/core/hle/service/mutex.cpp
Normal file
43
src/core/hle/service/mutex.cpp
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/core.h"
|
||||||
|
#include "core/hle/kernel/k_event.h"
|
||||||
|
#include "core/hle/kernel/k_synchronization_object.h"
|
||||||
|
#include "core/hle/service/mutex.h"
|
||||||
|
|
||||||
|
namespace Service {
|
||||||
|
|
||||||
|
Mutex::Mutex(Core::System& system) : m_system(system) {
|
||||||
|
m_event = Kernel::KEvent::Create(system.Kernel());
|
||||||
|
m_event->Initialize(nullptr);
|
||||||
|
|
||||||
|
ASSERT(R_SUCCEEDED(m_event->Signal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Mutex::~Mutex() {
|
||||||
|
m_event->GetReadableEvent().Close();
|
||||||
|
m_event->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mutex::lock() {
|
||||||
|
// Infinitely retry until we successfully clear the event.
|
||||||
|
while (R_FAILED(m_event->GetReadableEvent().Reset())) {
|
||||||
|
s32 index;
|
||||||
|
Kernel::KSynchronizationObject* obj = &m_event->GetReadableEvent();
|
||||||
|
|
||||||
|
// The event was already cleared!
|
||||||
|
// Wait for it to become signaled again.
|
||||||
|
ASSERT(R_SUCCEEDED(
|
||||||
|
Kernel::KSynchronizationObject::Wait(m_system.Kernel(), &index, &obj, 1, -1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// We successfully cleared the event, and now have exclusive ownership.
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mutex::unlock() {
|
||||||
|
// Unlock.
|
||||||
|
ASSERT(R_SUCCEEDED(m_event->Signal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service
|
31
src/core/hle/service/mutex.h
Normal file
31
src/core/hle/service/mutex.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Kernel {
|
||||||
|
class KEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Service {
|
||||||
|
|
||||||
|
class Mutex {
|
||||||
|
public:
|
||||||
|
explicit Mutex(Core::System& system);
|
||||||
|
~Mutex();
|
||||||
|
|
||||||
|
void lock();
|
||||||
|
void unlock();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Core::System& m_system;
|
||||||
|
Kernel::KEvent* m_event{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service
|
|
@ -6,8 +6,8 @@
|
||||||
#include "core/file_sys/romfs_factory.h"
|
#include "core/file_sys/romfs_factory.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/ncm/ncm.h"
|
#include "core/hle/service/ncm/ncm.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::NCM {
|
namespace Service::NCM {
|
||||||
|
|
||||||
|
@ -131,9 +131,12 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<LR>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<NCM>(system)->InstallAsService(sm);
|
|
||||||
|
server_manager->RegisterNamedService("lr", std::make_shared<LR>(system));
|
||||||
|
server_manager->RegisterNamedService("ncm", std::make_shared<NCM>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NCM
|
} // namespace Service::NCM
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::NCM {
|
namespace Service::NCM {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::NCM
|
} // namespace Service::NCM
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
#include "core/hle/service/nfc/mifare_user.h"
|
#include "core/hle/service/nfc/mifare_user.h"
|
||||||
#include "core/hle/service/nfc/nfc.h"
|
#include "core/hle/service/nfc/nfc.h"
|
||||||
#include "core/hle/service/nfc/nfc_user.h"
|
#include "core/hle/service/nfc/nfc_user.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::NFC {
|
namespace Service::NFC {
|
||||||
|
|
||||||
|
@ -154,11 +154,14 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<NFC_AM>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<NFC_MF_U>(system)->InstallAsService(sm);
|
|
||||||
std::make_shared<NFC_U>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("nfc:am", std::make_shared<NFC_AM>(system));
|
||||||
std::make_shared<NFC_SYS>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("nfc:mf:u", std::make_shared<NFC_MF_U>(system));
|
||||||
|
server_manager->RegisterNamedService("nfc:user", std::make_shared<NFC_U>(system));
|
||||||
|
server_manager->RegisterNamedService("nfc:sys", std::make_shared<NFC_SYS>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NFC
|
} // namespace Service::NFC
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::NFC {
|
namespace Service::NFC {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::NFC
|
} // namespace Service::NFC
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/nfp/nfp.h"
|
#include "core/hle/service/nfp/nfp.h"
|
||||||
#include "core/hle/service/nfp/nfp_user.h"
|
#include "core/hle/service/nfp/nfp_user.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace Service::NFP {
|
namespace Service::NFP {
|
||||||
|
|
||||||
|
@ -36,8 +37,11 @@ private:
|
||||||
std::shared_ptr<IUser> user_interface;
|
std::shared_ptr<IUser> user_interface;
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<IUserManager>(system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("nfp:user", std::make_shared<IUserManager>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NFP
|
} // namespace Service::NFP
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
namespace Service::NFP {
|
namespace Service::NFP {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::NFP
|
} // namespace Service::NFP
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/ngct/ngct.h"
|
#include "core/hle/service/ngct/ngct.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::NGCT {
|
namespace Service::NGCT {
|
||||||
|
@ -51,8 +52,11 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<IService>(system)->InstallAsService(system.ServiceManager());
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
|
server_manager->RegisterNamedService("ngct:u", std::make_shared<IService>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NGCT
|
} // namespace Service::NGCT
|
||||||
|
|
|
@ -7,13 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::NGCT {
|
namespace Service::NGCT {
|
||||||
|
|
||||||
/// Registers all NGCT services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace Service::NGCT
|
} // namespace Service::NGCT
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
#include "core/hle/service/nifm/nifm.h"
|
#include "core/hle/service/nifm/nifm.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -626,10 +627,16 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<NetworkInterface>("nifm:a", system)->InstallAsService(service_manager);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<NetworkInterface>("nifm:s", system)->InstallAsService(service_manager);
|
|
||||||
std::make_shared<NetworkInterface>("nifm:u", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("nifm:a",
|
||||||
|
std::make_shared<NetworkInterface>("nifm:a", system));
|
||||||
|
server_manager->RegisterNamedService("nifm:s",
|
||||||
|
std::make_shared<NetworkInterface>("nifm:s", system));
|
||||||
|
server_manager->RegisterNamedService("nifm:u",
|
||||||
|
std::make_shared<NetworkInterface>("nifm:u", system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NIFM
|
} // namespace Service::NIFM
|
||||||
|
|
|
@ -12,14 +12,9 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::NIFM {
|
namespace Service::NIFM {
|
||||||
|
|
||||||
/// Registers all NIFM services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
class IGeneralService final : public ServiceFramework<IGeneralService> {
|
class IGeneralService final : public ServiceFramework<IGeneralService> {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
#include "core/hle/service/nim/nim.h"
|
#include "core/hle/service/nim/nim.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::NIM {
|
namespace Service::NIM {
|
||||||
|
|
||||||
|
@ -418,11 +418,14 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<NIM>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<NIM_ECA>(system)->InstallAsService(sm);
|
|
||||||
std::make_shared<NIM_SHP>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("nim", std::make_shared<NIM>(system));
|
||||||
std::make_shared<NTC>(system)->InstallAsService(sm);
|
server_manager->RegisterNamedService("nim:eca", std::make_shared<NIM_ECA>(system));
|
||||||
|
server_manager->RegisterNamedService("nim:shp", std::make_shared<NIM_SHP>(system));
|
||||||
|
server_manager->RegisterNamedService("ntc", std::make_shared<NTC>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NIM
|
} // namespace Service::NIM
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::NIM {
|
namespace Service::NIM {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::NIM
|
} // namespace Service::NIM
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "core/hle/service/npns/npns.h"
|
#include "core/hle/service/npns/npns.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
#include "core/hle/service/sm/sm.h"
|
|
||||||
|
|
||||||
namespace Service::NPNS {
|
namespace Service::NPNS {
|
||||||
|
|
||||||
|
@ -94,9 +94,12 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
std::make_shared<NPNS_S>(system)->InstallAsService(sm);
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
std::make_shared<NPNS_U>(system)->InstallAsService(sm);
|
|
||||||
|
server_manager->RegisterNamedService("npns:s", std::make_shared<NPNS_S>(system));
|
||||||
|
server_manager->RegisterNamedService("npns:u", std::make_shared<NPNS_U>(system));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NPNS
|
} // namespace Service::NPNS
|
||||||
|
|
|
@ -7,12 +7,8 @@ namespace Core {
|
||||||
class System;
|
class System;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::SM {
|
|
||||||
class ServiceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::NPNS {
|
namespace Service::NPNS {
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
|
void LoopProcess(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::NPNS
|
} // namespace Service::NPNS
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "core/hle/service/ns/language.h"
|
#include "core/hle/service/ns/language.h"
|
||||||
#include "core/hle/service/ns/ns.h"
|
#include "core/hle/service/ns/ns.h"
|
||||||
#include "core/hle/service/ns/pdm_qry.h"
|
#include "core/hle/service/ns/pdm_qry.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/hle/service/set/set.h"
|
#include "core/hle/service/set/set.h"
|
||||||
|
|
||||||
namespace Service::NS {
|
namespace Service::NS {
|
||||||
|
@ -777,23 +778,26 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void LoopProcess(Core::System& system) {
|
||||||
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
|
|
||||||
std::make_shared<NS>("ns:am2", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:am2", std::make_shared<NS>("ns:am2", system));
|
||||||
std::make_shared<NS>("ns:ec", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:ec", std::make_shared<NS>("ns:ec", system));
|
||||||
std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:rid", std::make_shared<NS>("ns:rid", system));
|
||||||
std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:rt", std::make_shared<NS>("ns:rt", system));
|
||||||
std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:web", std::make_shared<NS>("ns:web", system));
|
||||||
std::make_shared<NS>("ns:ro", system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:ro", std::make_shared<NS>("ns:ro", system));
|
||||||
|
|
||||||
std::make_shared<NS_DEV>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:dev", std::make_shared<NS_DEV>(system));
|
||||||
std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:su", std::make_shared<NS_SU>(system));
|
||||||
std::make_shared<NS_VM>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("ns:vm", std::make_shared<NS_VM>(system));
|
||||||
|
server_manager->RegisterNamedService("pdm:qry", std::make_shared<PDM_QRY>(system));
|
||||||
|
|
||||||
std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("pl:s",
|
||||||
|
std::make_shared<IPlatformServiceManager>(system, "pl:s"));
|
||||||
std::make_shared<IPlatformServiceManager>(system, "pl:s")->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("pl:u",
|
||||||
std::make_shared<IPlatformServiceManager>(system, "pl:u")->InstallAsService(service_manager);
|
std::make_shared<IPlatformServiceManager>(system, "pl:u"));
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::NS
|
} // namespace Service::NS
|
||||||
|
|
|
@ -117,8 +117,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Registers all NS services with the specified service manager.
|
void LoopProcess(Core::System& system);
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
|
|
||||||
|
|
||||||
} // namespace NS
|
} // namespace NS
|
||||||
} // namespace Service
|
} // namespace Service
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "core/hle/service/nvdrv/nvdrv_interface.h"
|
#include "core/hle/service/nvdrv/nvdrv_interface.h"
|
||||||
#include "core/hle/service/nvdrv/nvmemp.h"
|
#include "core/hle/service/nvdrv/nvmemp.h"
|
||||||
#include "core/hle/service/nvflinger/nvflinger.h"
|
#include "core/hle/service/nvflinger/nvflinger.h"
|
||||||
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "video_core/gpu.h"
|
#include "video_core/gpu.h"
|
||||||
|
|
||||||
namespace Service::Nvidia {
|
namespace Service::Nvidia {
|
||||||
|
@ -41,15 +42,19 @@ void EventInterface::FreeEvent(Kernel::KEvent* event) {
|
||||||
module.service_context.CloseEvent(event);
|
module.service_context.CloseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,
|
void LoopProcess(NVFlinger::NVFlinger& nvflinger, Core::System& system) {
|
||||||
Core::System& system) {
|
auto server_manager = std::make_unique<ServerManager>(system);
|
||||||
auto module_ = std::make_shared<Module>(system);
|
auto module = std::make_shared<Module>(system);
|
||||||
std::make_shared<NVDRV>(system, module_, "nvdrv")->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("nvdrv", std::make_shared<NVDRV>(system, module, "nvdrv"));
|
||||||
std::make_shared<NVDRV>(system, module_, "nvdrv:a")->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("nvdrv:a",
|
||||||
std::make_shared<NVDRV>(system, module_, "nvdrv:s")->InstallAsService(service_manager);
|
std::make_shared<NVDRV>(system, module, "nvdrv:a"));
|
||||||
std::make_shared<NVDRV>(system, module_, "nvdrv:t")->InstallAsService(service_manager);
|
server_manager->RegisterNamedService("nvdrv:s",
|
||||||
std::make_shared<NVMEMP>(system)->InstallAsService(service_manager);
|
std::make_shared<NVDRV>(system, module, "nvdrv:s"));
|
||||||
nvflinger.SetNVDrvInstance(module_);
|
server_manager->RegisterNamedService("nvdrv:t",
|
||||||
|
std::make_shared<NVDRV>(system, module, "nvdrv:t"));
|
||||||
|
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
|
||||||
|
nvflinger.SetNVDrvInstance(module);
|
||||||
|
ServerManager::RunServer(std::move(server_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::Module(Core::System& system)
|
Module::Module(Core::System& system)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue