support for sd redirection, changed config

This commit is contained in:
Christoph Baumann
2025-02-20 17:13:52 +01:00
parent ed17414b50
commit f07eb50e68
6 changed files with 120 additions and 30 deletions

View File

@@ -30,12 +30,16 @@ namespace ams::secmon {
EmummcConfiguration emummc_cfg;
u8 _raw_emummc_config[0x120];
};
union {
EmummcSdConfiguration emummc_sd_cfg;
u8 _raw_emummc_sd_config[0x120];
};
u8 sealed_device_keys[pkg1::KeyGeneration_Max][se::AesBlockSize];
u8 sealed_master_keys[pkg1::KeyGeneration_Max][se::AesBlockSize];
pkg1::BootConfig boot_config;
u8 rsa_private_exponents[4][se::RsaSize];
union {
u8 _misc_data[0xFC0 - sizeof(_raw_exosphere_config) - sizeof(_raw_emummc_config) - sizeof(sealed_device_keys) - sizeof(sealed_master_keys) - sizeof(boot_config) - sizeof(rsa_private_exponents)];
u8 _misc_data[0xFC0 - sizeof(_raw_exosphere_config) - sizeof(_raw_emummc_sd_config) - sizeof(_raw_emummc_config) - sizeof(sealed_device_keys) - sizeof(sealed_master_keys) - sizeof(boot_config) - sizeof(rsa_private_exponents)];
};
/* u8 l1_page_table[0x40]; */
};
@@ -92,6 +96,10 @@ namespace ams::secmon {
return GetConfigurationContext().emummc_cfg;
}
ALWAYS_INLINE const EmummcSdConfiguration &GetEmummcSdConfiguration() {
return GetConfigurationContext().emummc_sd_cfg;
}
ALWAYS_INLINE const pkg1::BootConfig &GetBootConfig() {
return GetConfigurationContext().boot_config;
}

View File

@@ -19,10 +19,12 @@
namespace ams::secmon {
enum EmummcType : u32 {
EmummcType_Min = 0,
EmummcType_Raw_Emmc = 0,
EmummcType_Partition_Sd = 1,
EmummcType_Partition_Emmc = 2,
EmummcType_File = 3,
EmummcType_Max = 4,
};
enum EmummcMmc {
@@ -87,4 +89,14 @@ namespace ams::secmon {
static_assert(util::is_pod<EmummcConfiguration>::value);
static_assert(sizeof(EmummcConfiguration) <= 0x200);
struct EmummcSdConfiguration : public EmummcConfiguration {
constexpr bool IsEmummcActive() const {
if(IsValid()){
if(this->base_cfg.type == EmummcType_Partition_Emmc || this->partition_cfg.start_sector != 0){
return true;
}
}
return false;
}
};
}

View File

@@ -45,12 +45,16 @@ namespace ams::secmon {
u8 log_flags;
u32 log_baud_rate;
u32 reserved1[2];
EmummcConfiguration emummc_cfg;
EmummcConfiguration emummc_cfg;
// TODO: most of emummc_sd_cfg is a duplicate of emummc_cfg
// (fs_version, id, n_path...), emu path never used since
// file based not supported for sd redirection.
EmummcSdConfiguration emummc_sd_cfg;
constexpr bool IsValid() const { return this->magic == Magic; }
};
static_assert(util::is_pod<SecureMonitorStorageConfiguration>::value);
static_assert(sizeof(SecureMonitorStorageConfiguration) == 0x130);
static_assert(sizeof(SecureMonitorStorageConfiguration) == 0x240);
struct SecureMonitorConfiguration {
ams::TargetFirmware target_firmware;