mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-21 02:45:00 +00:00
Add auto stubs, static init
- Adds a python script to generate the tables, to avoid std::map init - Generates stub "slots" to provide runtime information when a stub is called - Provides fallback for unknown stubs
This commit is contained in:
parent
1e18efcd05
commit
f1ce6fe669
9 changed files with 22633 additions and 11232 deletions
|
@ -6,7 +6,7 @@
|
|||
#include "Util/aerolib.h"
|
||||
#include "Loader/SymbolsResolver.h"
|
||||
#include "HLE/Kernel/ThreadManagement.h"
|
||||
|
||||
#include "Stubs.h"
|
||||
|
||||
constexpr bool debug_loader = true;
|
||||
|
||||
|
@ -467,14 +467,18 @@ void Linker::LoadSymbols(Module* m)
|
|||
//if st_value!=0 then it's export symbol
|
||||
bool is_sym_export = sym->st_value != 0;
|
||||
std::string nidName = "";
|
||||
if (aerolib::symbolsMap.find(ids.at(0)) != aerolib::symbolsMap.end())
|
||||
|
||||
auto aeronid = aerolib::find_by_nid(ids.at(0).c_str());
|
||||
|
||||
if (aeronid != nullptr)
|
||||
{
|
||||
nidName = aerolib::symbolsMap.at(ids.at(0));
|
||||
nidName = aeronid->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
nidName = "UNK";
|
||||
}
|
||||
|
||||
SymbolRes sym_r{};
|
||||
sym_r.name = ids.at(0);
|
||||
sym_r.nidName = nidName;
|
||||
|
@ -589,7 +593,6 @@ void Linker::Relocate(Module* m)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void Linker::Resolve(const std::string& name, int Symtype, Module* m, SymbolRecord* return_info) {
|
||||
auto ids = StringUtil::split_string(name, '#');
|
||||
|
||||
|
@ -616,8 +619,15 @@ void Linker::Resolve(const std::string& name, int Symtype, Module* m, SymbolReco
|
|||
if (rec != nullptr) {
|
||||
*return_info = *rec;
|
||||
} else {
|
||||
return_info->virtual_address = 0;
|
||||
return_info->name = "Unresolved!!!";
|
||||
auto aeronid = aerolib::find_by_nid(sr.name.c_str());
|
||||
if (aeronid) {
|
||||
return_info->name = aeronid->name;
|
||||
return_info->virtual_address = GetStub(aeronid->nid);
|
||||
LOG_ERROR_IF(debug_loader, "Linker: Stub resolved {} as {} (lib: {}, mod: {}) \n", sr.name, return_info->name, library->name, module->name);
|
||||
} else {
|
||||
return_info->virtual_address = (u64)&UnresolvedStub;
|
||||
return_info->name = "Unresolved!!!";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue