diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/svc.cpp | 10 | ||||
| -rw-r--r-- | src/core/loader/elf.cpp | 32 |
2 files changed, 2 insertions, 40 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 2db823c61..8538cfc9d 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -2,12 +2,12 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <cinttypes> | ||
| 5 | #include <map> | 6 | #include <map> |
| 6 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 7 | #include "common/microprofile.h" | 8 | #include "common/microprofile.h" |
| 8 | #include "common/scope_exit.h" | 9 | #include "common/scope_exit.h" |
| 9 | #include "common/string_util.h" | 10 | #include "common/string_util.h" |
| 10 | #include "common/symbols.h" | ||
| 11 | #include "core/arm/arm_interface.h" | 11 | #include "core/arm/arm_interface.h" |
| 12 | #include "core/core_timing.h" | 12 | #include "core/core_timing.h" |
| 13 | #include "core/hle/function_wrappers.h" | 13 | #include "core/hle/function_wrappers.h" |
| @@ -524,13 +524,7 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, s32 priority, u32 ent | |||
| 524 | u32 stack_top, s32 processor_id) { | 524 | u32 stack_top, s32 processor_id) { |
| 525 | using Kernel::Thread; | 525 | using Kernel::Thread; |
| 526 | 526 | ||
| 527 | std::string name; | 527 | std::string name = Common::StringFromFormat("unknown-%08" PRIX32, entry_point); |
| 528 | if (Symbols::HasSymbol(entry_point)) { | ||
| 529 | TSymbol symbol = Symbols::GetSymbol(entry_point); | ||
| 530 | name = symbol.name; | ||
| 531 | } else { | ||
| 532 | name = Common::StringFromFormat("unknown-%08x", entry_point); | ||
| 533 | } | ||
| 534 | 528 | ||
| 535 | if (priority > THREADPRIO_LOWEST) { | 529 | if (priority > THREADPRIO_LOWEST) { |
| 536 | return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, | 530 | return ResultCode(ErrorDescription::OutOfRange, ErrorModule::OS, |
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 8eb5200ab..cfcde9167 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/file_util.h" | 9 | #include "common/file_util.h" |
| 10 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 11 | #include "common/symbols.h" | ||
| 12 | #include "core/hle/kernel/process.h" | 11 | #include "core/hle/kernel/process.h" |
| 13 | #include "core/hle/kernel/resource_limit.h" | 12 | #include "core/hle/kernel/resource_limit.h" |
| 14 | #include "core/loader/elf.h" | 13 | #include "core/loader/elf.h" |
| @@ -210,7 +209,6 @@ public: | |||
| 210 | return (u32)(header->e_flags); | 209 | return (u32)(header->e_flags); |
| 211 | } | 210 | } |
| 212 | SharedPtr<CodeSet> LoadInto(u32 vaddr); | 211 | SharedPtr<CodeSet> LoadInto(u32 vaddr); |
| 213 | bool LoadSymbols(); | ||
| 214 | 212 | ||
| 215 | int GetNumSegments() const { | 213 | int GetNumSegments() const { |
| 216 | return (int)(header->e_phnum); | 214 | return (int)(header->e_phnum); |
| @@ -258,8 +256,6 @@ ElfReader::ElfReader(void* ptr) { | |||
| 258 | sections = (Elf32_Shdr*)(base + header->e_shoff); | 256 | sections = (Elf32_Shdr*)(base + header->e_shoff); |
| 259 | 257 | ||
| 260 | entryPoint = header->e_entry; | 258 | entryPoint = header->e_entry; |
| 261 | |||
| 262 | LoadSymbols(); | ||
| 263 | } | 259 | } |
| 264 | 260 | ||
| 265 | const char* ElfReader::GetSectionName(int section) const { | 261 | const char* ElfReader::GetSectionName(int section) const { |
| @@ -362,34 +358,6 @@ SectionID ElfReader::GetSectionByName(const char* name, int firstSection) const | |||
| 362 | return -1; | 358 | return -1; |
| 363 | } | 359 | } |
| 364 | 360 | ||
| 365 | bool ElfReader::LoadSymbols() { | ||
| 366 | bool hasSymbols = false; | ||
| 367 | SectionID sec = GetSectionByName(".symtab"); | ||
| 368 | if (sec != -1) { | ||
| 369 | int stringSection = sections[sec].sh_link; | ||
| 370 | const char* stringBase = reinterpret_cast<const char*>(GetSectionDataPtr(stringSection)); | ||
| 371 | |||
| 372 | // We have a symbol table! | ||
| 373 | const Elf32_Sym* symtab = reinterpret_cast<const Elf32_Sym*>(GetSectionDataPtr(sec)); | ||
| 374 | unsigned int numSymbols = sections[sec].sh_size / sizeof(Elf32_Sym); | ||
| 375 | for (unsigned sym = 0; sym < numSymbols; sym++) { | ||
| 376 | int size = symtab[sym].st_size; | ||
| 377 | if (size == 0) | ||
| 378 | continue; | ||
| 379 | |||
| 380 | int type = symtab[sym].st_info & 0xF; | ||
| 381 | |||
| 382 | const char* name = stringBase + symtab[sym].st_name; | ||
| 383 | |||
| 384 | Symbols::Add(symtab[sym].st_value, name, size, type); | ||
| 385 | |||
| 386 | hasSymbols = true; | ||
| 387 | } | ||
| 388 | } | ||
| 389 | |||
| 390 | return hasSymbols; | ||
| 391 | } | ||
| 392 | |||
| 393 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 361 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 394 | // Loader namespace | 362 | // Loader namespace |
| 395 | 363 | ||