OS/HPV: Add CFG

This commit is contained in:
Tony Wasserka 2024-03-09 15:56:11 +01:00
parent 6dc6de3422
commit 3a9af165ee
4 changed files with 72 additions and 0 deletions

View file

@ -31,6 +31,7 @@ target_sources(mikage PRIVATE
processes/cam.cpp
processes/cdc.cpp
processes/cecd.cpp
processes/cfg_hpv.cpp
processes/csnd.cpp
processes/dlp.cpp
processes/dsp.cpp

View file

@ -3,6 +3,7 @@
#include "os_hypervisor_private.hpp"
#include "processes/am_hpv.hpp"
#include "processes/cfg_hpv.hpp"
#include "processes/dsp_hpv.hpp"
#include "processes/fs_hpv.hpp"
#include "processes/ns_hpv.hpp"
@ -45,6 +46,7 @@ struct State {
HPV::NullContext null_context;
HPV::AMContext am_context;
HPV::CFGContext cfg_context;
HPV::DSPContext dsp_context;
HPV::FSContext fs_context;
HPV::SMContext sm_context;
@ -113,6 +115,10 @@ std::unordered_map<std::string_view, SessionFactoryType> service_factory_map = {
{ "am:sys"sv, WrapSessionFactory<HPV::CreateAmService, &HPV::State::am_context> },
{ "am:u"sv, WrapSessionFactory<HPV::CreateAmService, &HPV::State::am_context> },
{ "cfg:i"sv, WrapSessionFactory<HPV::CreateCfgService, &HPV::State::cfg_context> },
{ "cfg:s"sv, WrapSessionFactory<HPV::CreateCfgService, &HPV::State::cfg_context> },
{ "cfg:u"sv, WrapSessionFactory<HPV::CreateCfgService, &HPV::State::cfg_context> },
{ "dsp::DSP"sv, WrapSessionFactory<HPV::CreateDspService, &HPV::State::dsp_context> },
{ "fs:USER"sv, WrapSessionFactory<HPV::CreateFSUserService, &HPV::State::fs_context> },

View file

@ -0,0 +1,45 @@
#include "cfg_hpv.hpp"
#include "os_hypervisor_private.hpp"
#include "os.hpp"
#include <platform/config.hpp>
#include <framework/exceptions.hpp>
namespace HLE {
namespace OS {
namespace HPV {
namespace {
struct CfgService : SessionToPort {
CfgService(RefCounted<Port> port_, CFGContext& context_) : SessionToPort(port_, context_) {
}
void OnRequest(Hypervisor& hypervisor, Thread& thread, Handle session) override {
const uint32_t command_header = thread.ReadTLS(0x80);
auto dispatcher = RequestDispatcher<> { thread, *this, command_header };
namespace Cmd = Platform::Config;
dispatcher.DecodeRequest<Cmd::GetConfigInfoBlk2>([&](auto& response, uint32_t size, uint32_t block_id, IPC::MappedBuffer output) {
auto description = fmt::format( "GetConfigInfoBlk2, size={:#x}, block_id={:#x}",
size, block_id);
Session::OnRequest(hypervisor, thread, session, description);
});
}
};
} // anonymous namespace
HPV::RefCounted<Object> CreateCfgService(RefCounted<Port> port, CFGContext& context) {
return HPV::RefCounted<Object>(new CfgService(port, context));
}
} // namespace HPV
} // namespace OS
} // namespace HLE

View file

@ -0,0 +1,20 @@
#pragma once
#include "os_hypervisor_private.hpp"
namespace HLE {
namespace OS {
namespace HPV {
struct CFGContext : SessionContext {
};
HPV::RefCounted<Object> CreateCfgService(RefCounted<Port> port, CFGContext&);
} // namespace HPV
} // namespace HOS
} // namespace HLE