1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

stratosphere: misc static -> global

This commit is contained in:
Michael Scire 2020-02-22 23:16:53 -08:00
parent c0f7cd95b9
commit 981166783b
3 changed files with 11 additions and 10 deletions

View file

@ -39,6 +39,9 @@ namespace ams::creport {
};
static_assert(sizeof(RoDataStart) == sizeof(ModulePath), "RoDataStart definition!");
/* Globals. */
u8 g_last_rodata_pages[2 * os::MemoryPageSize];
}
void ModuleList::SaveToFile(FILE *f_report) {
@ -229,16 +232,15 @@ namespace ams::creport {
}
/* 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(s_last_rodata_pages) ? sizeof(s_last_rodata_pages) : (sizeof(s_last_rodata_pages) / 2);
if (R_FAILED(svcReadDebugProcessMemory(s_last_rodata_pages, this->debug_handle, mi.addr + mi.size - read_size, read_size))) {
const size_t read_size = mi.size >= sizeof(g_last_rodata_pages) ? sizeof(g_last_rodata_pages) : (sizeof(g_last_rodata_pages) / 2);
if (R_FAILED(svcReadDebugProcessMemory(g_last_rodata_pages, this->debug_handle, mi.addr + mi.size - read_size, read_size))) {
return;
}
/* Find GNU\x00 to locate start of build id. */
for (int ofs = read_size - sizeof(GnuSignature) - ModuleBuildIdLength; ofs >= 0; ofs--) {
if (std::memcmp(s_last_rodata_pages + ofs, GnuSignature, sizeof(GnuSignature)) == 0) {
std::memcpy(out_build_id, s_last_rodata_pages + ofs + sizeof(GnuSignature), ModuleBuildIdLength);
if (std::memcmp(g_last_rodata_pages + ofs, GnuSignature, sizeof(GnuSignature)) == 0) {
std::memcpy(out_build_id, g_last_rodata_pages + ofs + sizeof(GnuSignature), ModuleBuildIdLength);
break;
}
}

View file

@ -42,6 +42,7 @@ namespace ams::ldr::ro {
/* Globals. */
ProcessInfo g_process_infos[ProcessCountMax];
u64 g_cur_pin_id = 1;
/* Helpers. */
ProcessInfo *GetProcessInfo(PinId pin_id) {
@ -82,10 +83,8 @@ namespace ams::ldr::ro {
ProcessInfo *info = GetFreeProcessInfo();
R_UNLESS(info != nullptr, ldr::ResultTooManyProcesses());
static u64 s_cur_pin_id = 1;
std::memset(info, 0, sizeof(*info));
info->pin_id = { s_cur_pin_id++ };
info->pin_id = { g_cur_pin_id++ };
info->loc = loc;
info->override_status = status;
info->in_use = true;

View file

@ -555,7 +555,7 @@ namespace ams::spl::impl {
Result GenerateAesKey(AesKey *out_key, const AccessKey &access_key, const KeySource &key_source) {
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}
};
@ -571,7 +571,7 @@ namespace ams::spl::impl {
}
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}
};