mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
spl: Implement spl::GetConfig
This commit is contained in:
parent
e4318a1914
commit
8ba83c4c2a
2 changed files with 90 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
#include "core/hle/api_version.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/service/spl/csrng.h"
|
#include "core/hle/service/spl/csrng.h"
|
||||||
#include "core/hle/service/spl/module.h"
|
#include "core/hle/service/spl/module.h"
|
||||||
|
@ -24,7 +25,30 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
|
||||||
|
|
||||||
Module::Interface::~Interface() = default;
|
Module::Interface::~Interface() = default;
|
||||||
|
|
||||||
void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {}
|
void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
const auto config_item = rp.PopEnum<ConfigItem>();
|
||||||
|
|
||||||
|
// This should call svcCallSecureMonitor with the appropriate args.
|
||||||
|
// Since we do not have it implemented yet, we will use this for now.
|
||||||
|
const auto smc_result = GetConfigImpl(config_item);
|
||||||
|
const auto result_code = smc_result.Code();
|
||||||
|
|
||||||
|
if (smc_result.Failed()) {
|
||||||
|
LOG_ERROR(Service_SPL, "called, config_item={}, result_code={}", config_item,
|
||||||
|
result_code.raw);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(result_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_SPL, "called, config_item={}, result_code={}, smc_result={}", config_item,
|
||||||
|
result_code.raw, *smc_result);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
rb.Push(result_code);
|
||||||
|
rb.Push(*smc_result);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {}
|
void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {}
|
||||||
|
|
||||||
|
@ -51,6 +75,67 @@ void Module::Interface::SetBootReason(Kernel::HLERequestContext& ctx) {}
|
||||||
|
|
||||||
void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {}
|
void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {}
|
||||||
|
|
||||||
|
ResultVal<u64> Module::Interface::GetConfigImpl(ConfigItem config_item) const {
|
||||||
|
switch (config_item) {
|
||||||
|
case ConfigItem::DisableProgramVerification:
|
||||||
|
case ConfigItem::DramId:
|
||||||
|
case ConfigItem::SecurityEngineInterruptNumber:
|
||||||
|
case ConfigItem::FuseVersion:
|
||||||
|
case ConfigItem::HardwareType:
|
||||||
|
case ConfigItem::HardwareState:
|
||||||
|
case ConfigItem::IsRecoveryBoot:
|
||||||
|
case ConfigItem::DeviceId:
|
||||||
|
case ConfigItem::BootReason:
|
||||||
|
case ConfigItem::MemoryMode:
|
||||||
|
case ConfigItem::IsDevelopmentFunctionEnabled:
|
||||||
|
case ConfigItem::KernelConfiguration:
|
||||||
|
case ConfigItem::IsChargerHiZModeEnabled:
|
||||||
|
case ConfigItem::QuestState:
|
||||||
|
case ConfigItem::RegulatorType:
|
||||||
|
case ConfigItem::DeviceUniqueKeyGeneration:
|
||||||
|
case ConfigItem::Package2Hash:
|
||||||
|
return ResultSecureMonitorNotImplemented;
|
||||||
|
case ConfigItem::ExosphereApiVersion:
|
||||||
|
// Get information about the current exosphere version.
|
||||||
|
return MakeResult((u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MAJOR} << 56) |
|
||||||
|
(u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MINOR} << 48) |
|
||||||
|
(u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MICRO} << 40) |
|
||||||
|
(static_cast<u64>(HLE::ApiVersion::GetTargetFirmware())));
|
||||||
|
case ConfigItem::ExosphereNeedsReboot:
|
||||||
|
// We are executing, so we aren't in the process of rebooting.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereNeedsShutdown:
|
||||||
|
// We are executing, so we aren't in the process of shutting down.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereGitCommitHash:
|
||||||
|
// Get information about the current exosphere git commit hash.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereHasRcmBugPatch:
|
||||||
|
// Get information about whether this unit has the RCM bug patched.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereBlankProdInfo:
|
||||||
|
// Get whether this unit should simulate a "blanked" PRODINFO.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereAllowCalWrites:
|
||||||
|
// Get whether this unit should allow writing to the calibration partition.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereEmummcType:
|
||||||
|
// Get what kind of emummc this unit has active.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExospherePayloadAddress:
|
||||||
|
// Gets the physical address of the reboot payload buffer, if one exists.
|
||||||
|
return ResultSecureMonitorNotInitialized;
|
||||||
|
case ConfigItem::ExosphereLogConfiguration:
|
||||||
|
// Get the log configuration.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
case ConfigItem::ExosphereForceEnableUsb30:
|
||||||
|
// Get whether usb 3.0 should be force-enabled.
|
||||||
|
return MakeResult(u64{0});
|
||||||
|
default:
|
||||||
|
return ResultSecureMonitorInvalidArgument;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
|
||||||
auto module = std::make_shared<Module>();
|
auto module = std::make_shared<Module>();
|
||||||
std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager);
|
std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
#include "core/hle/service/spl/spl_results.h"
|
||||||
|
#include "core/hle/service/spl/spl_types.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class System;
|
class System;
|
||||||
|
@ -34,6 +36,8 @@ public:
|
||||||
std::shared_ptr<Module> module;
|
std::shared_ptr<Module> module;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ResultVal<u64> GetConfigImpl(ConfigItem config_item) const;
|
||||||
|
|
||||||
std::mt19937 rng;
|
std::mt19937 rng;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue