mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-10 07:06:34 +00:00
stratosphere: misc static -> global
This commit is contained in:
parent
c0f7cd95b9
commit
981166783b
3 changed files with 11 additions and 10 deletions
|
@ -39,6 +39,9 @@ namespace ams::creport {
|
||||||
};
|
};
|
||||||
static_assert(sizeof(RoDataStart) == sizeof(ModulePath), "RoDataStart definition!");
|
static_assert(sizeof(RoDataStart) == sizeof(ModulePath), "RoDataStart definition!");
|
||||||
|
|
||||||
|
/* Globals. */
|
||||||
|
u8 g_last_rodata_pages[2 * os::MemoryPageSize];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModuleList::SaveToFile(FILE *f_report) {
|
void ModuleList::SaveToFile(FILE *f_report) {
|
||||||
|
@ -229,16 +232,15 @@ namespace ams::creport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We want to read the last two pages of .rodata. */
|
/* We want to read the last two pages of .rodata. */
|
||||||
static u8 s_last_rodata_pages[2 * os::MemoryPageSize];
|
const size_t read_size = mi.size >= sizeof(g_last_rodata_pages) ? sizeof(g_last_rodata_pages) : (sizeof(g_last_rodata_pages) / 2);
|
||||||
const size_t read_size = mi.size >= sizeof(s_last_rodata_pages) ? sizeof(s_last_rodata_pages) : (sizeof(s_last_rodata_pages) / 2);
|
if (R_FAILED(svcReadDebugProcessMemory(g_last_rodata_pages, this->debug_handle, mi.addr + mi.size - read_size, read_size))) {
|
||||||
if (R_FAILED(svcReadDebugProcessMemory(s_last_rodata_pages, this->debug_handle, mi.addr + mi.size - read_size, read_size))) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find GNU\x00 to locate start of build id. */
|
/* Find GNU\x00 to locate start of build id. */
|
||||||
for (int ofs = read_size - sizeof(GnuSignature) - ModuleBuildIdLength; ofs >= 0; ofs--) {
|
for (int ofs = read_size - sizeof(GnuSignature) - ModuleBuildIdLength; ofs >= 0; ofs--) {
|
||||||
if (std::memcmp(s_last_rodata_pages + ofs, GnuSignature, sizeof(GnuSignature)) == 0) {
|
if (std::memcmp(g_last_rodata_pages + ofs, GnuSignature, sizeof(GnuSignature)) == 0) {
|
||||||
std::memcpy(out_build_id, s_last_rodata_pages + ofs + sizeof(GnuSignature), ModuleBuildIdLength);
|
std::memcpy(out_build_id, g_last_rodata_pages + ofs + sizeof(GnuSignature), ModuleBuildIdLength);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace ams::ldr::ro {
|
||||||
|
|
||||||
/* Globals. */
|
/* Globals. */
|
||||||
ProcessInfo g_process_infos[ProcessCountMax];
|
ProcessInfo g_process_infos[ProcessCountMax];
|
||||||
|
u64 g_cur_pin_id = 1;
|
||||||
|
|
||||||
/* Helpers. */
|
/* Helpers. */
|
||||||
ProcessInfo *GetProcessInfo(PinId pin_id) {
|
ProcessInfo *GetProcessInfo(PinId pin_id) {
|
||||||
|
@ -82,10 +83,8 @@ namespace ams::ldr::ro {
|
||||||
ProcessInfo *info = GetFreeProcessInfo();
|
ProcessInfo *info = GetFreeProcessInfo();
|
||||||
R_UNLESS(info != nullptr, ldr::ResultTooManyProcesses());
|
R_UNLESS(info != nullptr, ldr::ResultTooManyProcesses());
|
||||||
|
|
||||||
static u64 s_cur_pin_id = 1;
|
|
||||||
|
|
||||||
std::memset(info, 0, sizeof(*info));
|
std::memset(info, 0, sizeof(*info));
|
||||||
info->pin_id = { s_cur_pin_id++ };
|
info->pin_id = { g_cur_pin_id++ };
|
||||||
info->loc = loc;
|
info->loc = loc;
|
||||||
info->override_status = status;
|
info->override_status = status;
|
||||||
info->in_use = true;
|
info->in_use = true;
|
||||||
|
|
|
@ -555,7 +555,7 @@ namespace ams::spl::impl {
|
||||||
Result GenerateAesKey(AesKey *out_key, const AccessKey &access_key, const KeySource &key_source) {
|
Result GenerateAesKey(AesKey *out_key, const AccessKey &access_key, const KeySource &key_source) {
|
||||||
smc::Result smc_rc;
|
smc::Result smc_rc;
|
||||||
|
|
||||||
static const KeySource s_generate_aes_key_source = {
|
static constexpr KeySource s_generate_aes_key_source = {
|
||||||
.data = {0x89, 0x61, 0x5E, 0xE0, 0x5C, 0x31, 0xB6, 0x80, 0x5F, 0xE5, 0x8F, 0x3D, 0xA2, 0x4F, 0x7A, 0xA8}
|
.data = {0x89, 0x61, 0x5E, 0xE0, 0x5C, 0x31, 0xB6, 0x80, 0x5F, 0xE5, 0x8F, 0x3D, 0xA2, 0x4F, 0x7A, 0xA8}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ namespace ams::spl::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result DecryptAesKey(AesKey *out_key, const KeySource &key_source, u32 generation, u32 option) {
|
Result DecryptAesKey(AesKey *out_key, const KeySource &key_source, u32 generation, u32 option) {
|
||||||
static const KeySource s_decrypt_aes_key_source = {
|
static constexpr KeySource s_decrypt_aes_key_source = {
|
||||||
.data = {0x11, 0x70, 0x24, 0x2B, 0x48, 0x69, 0x11, 0xF1, 0x11, 0xB0, 0x0C, 0x47, 0x7C, 0xC3, 0xEF, 0x7E}
|
.data = {0x11, 0x70, 0x24, 0x2B, 0x48, 0x69, 0x11, 0xF1, 0x11, 0xB0, 0x0C, 0x47, 0x7C, 0xC3, 0xEF, 0x7E}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue