diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/spl/module.cpp | 87 | ||||
| -rw-r--r-- | src/core/hle/service/spl/module.h | 4 |
2 files changed, 90 insertions, 1 deletions
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index eabf2e319..11a44edbb 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 12 | #include "common/settings.h" | 12 | #include "common/settings.h" |
| 13 | #include "core/hle/api_version.h" | ||
| 13 | #include "core/hle/ipc_helpers.h" | 14 | #include "core/hle/ipc_helpers.h" |
| 14 | #include "core/hle/service/spl/csrng.h" | 15 | #include "core/hle/service/spl/csrng.h" |
| 15 | #include "core/hle/service/spl/module.h" | 16 | #include "core/hle/service/spl/module.h" |
| @@ -24,7 +25,30 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu | |||
| 24 | 25 | ||
| 25 | Module::Interface::~Interface() = default; | 26 | Module::Interface::~Interface() = default; |
| 26 | 27 | ||
| 27 | void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {} | 28 | void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) { |
| 29 | IPC::RequestParser rp{ctx}; | ||
| 30 | const auto config_item = rp.PopEnum<ConfigItem>(); | ||
| 31 | |||
| 32 | // This should call svcCallSecureMonitor with the appropriate args. | ||
| 33 | // Since we do not have it implemented yet, we will use this for now. | ||
| 34 | const auto smc_result = GetConfigImpl(config_item); | ||
| 35 | const auto result_code = smc_result.Code(); | ||
| 36 | |||
| 37 | if (smc_result.Failed()) { | ||
| 38 | LOG_ERROR(Service_SPL, "called, config_item={}, result_code={}", config_item, | ||
| 39 | result_code.raw); | ||
| 40 | |||
| 41 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 42 | rb.Push(result_code); | ||
| 43 | } | ||
| 44 | |||
| 45 | LOG_DEBUG(Service_SPL, "called, config_item={}, result_code={}, smc_result={}", config_item, | ||
| 46 | result_code.raw, *smc_result); | ||
| 47 | |||
| 48 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 49 | rb.Push(result_code); | ||
| 50 | rb.Push(*smc_result); | ||
| 51 | } | ||
| 28 | 52 | ||
| 29 | void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {} | 53 | void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {} |
| 30 | 54 | ||
| @@ -51,6 +75,67 @@ void Module::Interface::SetBootReason(Kernel::HLERequestContext& ctx) {} | |||
| 51 | 75 | ||
| 52 | void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {} | 76 | void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {} |
| 53 | 77 | ||
| 78 | ResultVal<u64> Module::Interface::GetConfigImpl(ConfigItem config_item) const { | ||
| 79 | switch (config_item) { | ||
| 80 | case ConfigItem::DisableProgramVerification: | ||
| 81 | case ConfigItem::DramId: | ||
| 82 | case ConfigItem::SecurityEngineInterruptNumber: | ||
| 83 | case ConfigItem::FuseVersion: | ||
| 84 | case ConfigItem::HardwareType: | ||
| 85 | case ConfigItem::HardwareState: | ||
| 86 | case ConfigItem::IsRecoveryBoot: | ||
| 87 | case ConfigItem::DeviceId: | ||
| 88 | case ConfigItem::BootReason: | ||
| 89 | case ConfigItem::MemoryMode: | ||
| 90 | case ConfigItem::IsDevelopmentFunctionEnabled: | ||
| 91 | case ConfigItem::KernelConfiguration: | ||
| 92 | case ConfigItem::IsChargerHiZModeEnabled: | ||
| 93 | case ConfigItem::QuestState: | ||
| 94 | case ConfigItem::RegulatorType: | ||
| 95 | case ConfigItem::DeviceUniqueKeyGeneration: | ||
| 96 | case ConfigItem::Package2Hash: | ||
| 97 | return ResultSecureMonitorNotImplemented; | ||
| 98 | case ConfigItem::ExosphereApiVersion: | ||
| 99 | // Get information about the current exosphere version. | ||
| 100 | return MakeResult((u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MAJOR} << 56) | | ||
| 101 | (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MINOR} << 48) | | ||
| 102 | (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MICRO} << 40) | | ||
| 103 | (static_cast<u64>(HLE::ApiVersion::GetTargetFirmware()))); | ||
| 104 | case ConfigItem::ExosphereNeedsReboot: | ||
| 105 | // We are executing, so we aren't in the process of rebooting. | ||
| 106 | return MakeResult(u64{0}); | ||
| 107 | case ConfigItem::ExosphereNeedsShutdown: | ||
| 108 | // We are executing, so we aren't in the process of shutting down. | ||
| 109 | return MakeResult(u64{0}); | ||
| 110 | case ConfigItem::ExosphereGitCommitHash: | ||
| 111 | // Get information about the current exosphere git commit hash. | ||
| 112 | return MakeResult(u64{0}); | ||
| 113 | case ConfigItem::ExosphereHasRcmBugPatch: | ||
| 114 | // Get information about whether this unit has the RCM bug patched. | ||
| 115 | return MakeResult(u64{0}); | ||
| 116 | case ConfigItem::ExosphereBlankProdInfo: | ||
| 117 | // Get whether this unit should simulate a "blanked" PRODINFO. | ||
| 118 | return MakeResult(u64{0}); | ||
| 119 | case ConfigItem::ExosphereAllowCalWrites: | ||
| 120 | // Get whether this unit should allow writing to the calibration partition. | ||
| 121 | return MakeResult(u64{0}); | ||
| 122 | case ConfigItem::ExosphereEmummcType: | ||
| 123 | // Get what kind of emummc this unit has active. | ||
| 124 | return MakeResult(u64{0}); | ||
| 125 | case ConfigItem::ExospherePayloadAddress: | ||
| 126 | // Gets the physical address of the reboot payload buffer, if one exists. | ||
| 127 | return ResultSecureMonitorNotInitialized; | ||
| 128 | case ConfigItem::ExosphereLogConfiguration: | ||
| 129 | // Get the log configuration. | ||
| 130 | return MakeResult(u64{0}); | ||
| 131 | case ConfigItem::ExosphereForceEnableUsb30: | ||
| 132 | // Get whether usb 3.0 should be force-enabled. | ||
| 133 | return MakeResult(u64{0}); | ||
| 134 | default: | ||
| 135 | return ResultSecureMonitorInvalidArgument; | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 54 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { | 139 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { |
| 55 | auto module = std::make_shared<Module>(); | 140 | auto module = std::make_shared<Module>(); |
| 56 | std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); | 141 | std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); |
diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/module.h index 67f7657e9..61630df80 100644 --- a/src/core/hle/service/spl/module.h +++ b/src/core/hle/service/spl/module.h | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | #include <random> | 7 | #include <random> |
| 8 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 9 | #include "core/hle/service/spl/spl_results.h" | ||
| 10 | #include "core/hle/service/spl/spl_types.h" | ||
| 9 | 11 | ||
| 10 | namespace Core { | 12 | namespace Core { |
| 11 | class System; | 13 | class System; |
| @@ -34,6 +36,8 @@ public: | |||
| 34 | std::shared_ptr<Module> module; | 36 | std::shared_ptr<Module> module; |
| 35 | 37 | ||
| 36 | private: | 38 | private: |
| 39 | ResultVal<u64> GetConfigImpl(ConfigItem config_item) const; | ||
| 40 | |||
| 37 | std::mt19937 rng; | 41 | std::mt19937 rng; |
| 38 | }; | 42 | }; |
| 39 | }; | 43 | }; |