mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
ams: allow bootloader to merely approximate correct target firmware
This commit is contained in:
parent
d41de21753
commit
5708bb1557
24 changed files with 281 additions and 396 deletions
|
@ -14,7 +14,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "hos_version_api_private.hpp"
|
||||
#include "../os/impl/os_rng_manager.hpp"
|
||||
|
||||
namespace ams::os {
|
||||
|
@ -34,23 +33,29 @@ extern "C" {
|
|||
|
||||
namespace ams::hos {
|
||||
|
||||
namespace {
|
||||
|
||||
bool CanAllowTemporaryApproximateVersion() {
|
||||
/* Check if we're a program that can use a temporary approximate version. */
|
||||
const auto program_id = os::GetCurrentProgramId();
|
||||
|
||||
return program_id == ncm::SystemProgramId::Pm || /* Needed so that boot has permissions to use fsp-srv. */
|
||||
program_id == ncm::SystemProgramId::Sm || /* Needed so that boot can acquire fsp-srv. */
|
||||
program_id == ncm::SystemProgramId::Boot || /* Needed so that boot can set the true target firmware. */
|
||||
program_id == ncm::SystemProgramId::Spl || /* Needed so that FS can complete initialization. */
|
||||
program_id == ncm::SystemProgramId::Ncm; /* Needed so that FS can determine where SystemVersion is located. */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InitializeVersionInternal(bool allow_approximate);
|
||||
|
||||
void InitializeForStratosphere() {
|
||||
/* Initialize the global os resource managers. This *must* be done before anything else in stratosphere. */
|
||||
os::InitializeForStratosphereInternal();
|
||||
|
||||
/* Initialize hos::Version API. */
|
||||
hos::SetVersionForLibnxInternal();
|
||||
|
||||
/* Check that we're running under mesosphere. */
|
||||
AMS_ABORT_UNLESS(svc::IsKernelMesosphere());
|
||||
}
|
||||
|
||||
void InitializeForStratosphereDebug(hos::Version debug_version) {
|
||||
/* Initialize the global os resource managers. This *must* be done before anything else in stratosphere. */
|
||||
os::InitializeForStratosphereInternal();
|
||||
|
||||
/* Initialize hos::Version API. */
|
||||
hos::SetVersionForLibnxInternalDebug(debug_version);
|
||||
hos::InitializeVersionInternal(CanAllowTemporaryApproximateVersion());
|
||||
|
||||
/* Check that we're running under mesosphere. */
|
||||
AMS_ABORT_UNLESS(svc::IsKernelMesosphere());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue