mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04: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!");
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue