nvnflinger: convert to process

This commit is contained in:
Liam
2024-02-14 11:39:42 -05:00
parent 7b79cddacd
commit ee8eccc5fa
44 changed files with 241 additions and 273 deletions

View File

@@ -42,7 +42,7 @@ void EventInterface::FreeEvent(Kernel::KEvent* event) {
module.service_context.CloseEvent(event);
}
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
auto module = std::make_shared<Module>(system);
const auto NvdrvInterfaceFactoryForApplication = [&, module] {
@@ -62,7 +62,6 @@ void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) {
server_manager->RegisterNamedService("nvdrv:s", NvdrvInterfaceFactoryForSysmodules);
server_manager->RegisterNamedService("nvdrv:t", NvdrvInterfaceFactoryForTesting);
server_manager->RegisterNamedService("nvmemp", std::make_shared<NVMEMP>(system));
nvnflinger.SetNVDrvInstance(module);
ServerManager::RunServer(std::move(server_manager));
}

View File

@@ -118,6 +118,6 @@ private:
std::unordered_map<std::string, std::function<FilesContainerType::iterator(DeviceFD)>> builders;
};
void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system);
void LoopProcess(Core::System& system);
} // namespace Service::Nvidia

View File

@@ -263,8 +263,10 @@ NVDRV::NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char*
}
NVDRV::~NVDRV() {
auto& container = nvdrv->GetContainer();
container.CloseSession(session_id);
if (is_initialized) {
auto& container = nvdrv->GetContainer();
container.CloseSession(session_id);
}
}
} // namespace Service::Nvidia

View File

@@ -16,6 +16,10 @@ public:
explicit NVDRV(Core::System& system_, std::shared_ptr<Module> nvdrv_, const char* name);
~NVDRV() override;
std::shared_ptr<Module> GetModule() const {
return nvdrv;
}
private:
void Open(HLERequestContext& ctx);
void Ioctl1(HLERequestContext& ctx);