[CPU] Rename ImportLibrary fields to follow naming conventions
This commit is contained in:
parent
6e74ba93d6
commit
7443b7e61f
|
@ -1231,10 +1231,10 @@ bool XexModule::SetupLibraryImports(const char* name,
|
|||
}
|
||||
|
||||
ImportLibrary library_info;
|
||||
library_info.Name = libbasename;
|
||||
library_info.ID = library->id;
|
||||
library_info.Version.value = library->version.value;
|
||||
library_info.MinVersion.value = library->version_min.value;
|
||||
library_info.name = libbasename;
|
||||
library_info.id = library->id;
|
||||
library_info.version.value = library->version.value;
|
||||
library_info.min_version.value = library->version_min.value;
|
||||
|
||||
// Imports are stored as {import descriptor, thunk addr, import desc, ...}
|
||||
// Even thunks have an import descriptor (albeit unused/useless)
|
||||
|
@ -1271,9 +1271,9 @@ bool XexModule::SetupLibraryImports(const char* name,
|
|||
// Variable.
|
||||
|
||||
ImportLibraryFn import_info;
|
||||
import_info.Ordinal = ordinal;
|
||||
import_info.ValueAddress = record_addr;
|
||||
library_info.Imports.push_back(import_info);
|
||||
import_info.ordinal = ordinal;
|
||||
import_info.value_address = record_addr;
|
||||
library_info.imports.push_back(import_info);
|
||||
|
||||
import_name.AppendFormat("__imp__");
|
||||
if (kernel_export) {
|
||||
|
@ -1314,10 +1314,10 @@ bool XexModule::SetupLibraryImports(const char* name,
|
|||
var_info->set_status(Symbol::Status::kDefined);
|
||||
} else if (record_type == 1) {
|
||||
// Thunk.
|
||||
assert_true(library_info.Imports.size() > 0);
|
||||
auto& prev_import = library_info.Imports[library_info.Imports.size() - 1];
|
||||
assert_true(prev_import.Ordinal == ordinal);
|
||||
prev_import.ThunkAddress = record_addr;
|
||||
assert_true(library_info.imports.size() > 0);
|
||||
auto& prev_import = library_info.imports[library_info.imports.size() - 1];
|
||||
assert_true(prev_import.ordinal == ordinal);
|
||||
prev_import.thunk_address = record_addr;
|
||||
|
||||
if (kernel_export) {
|
||||
import_name.AppendFormat("%s", kernel_export->name);
|
||||
|
|
|
@ -31,17 +31,17 @@ class XexModule : public xe::cpu::Module {
|
|||
public:
|
||||
struct ImportLibraryFn {
|
||||
public:
|
||||
uint32_t Ordinal;
|
||||
uint32_t ValueAddress;
|
||||
uint32_t ThunkAddress;
|
||||
uint32_t ordinal;
|
||||
uint32_t value_address;
|
||||
uint32_t thunk_address;
|
||||
};
|
||||
struct ImportLibrary {
|
||||
public:
|
||||
std::string Name;
|
||||
uint32_t ID;
|
||||
xe_xex2_version_t Version;
|
||||
xe_xex2_version_t MinVersion;
|
||||
std::vector<ImportLibraryFn> Imports;
|
||||
std::string name;
|
||||
uint32_t id;
|
||||
xe_xex2_version_t version;
|
||||
xe_xex2_version_t min_version;
|
||||
std::vector<ImportLibraryFn> imports;
|
||||
};
|
||||
|
||||
XexModule(Processor* processor, kernel::KernelState* kernel_state);
|
||||
|
|
|
@ -695,15 +695,15 @@ void UserModule::Dump() {
|
|||
for (std::vector<cpu::XexModule::ImportLibrary>::const_iterator library =
|
||||
import_libs->begin();
|
||||
library != import_libs->end(); ++library) {
|
||||
if (library->Imports.size() > 0) {
|
||||
sb.AppendFormat(" %s - %lld imports\n", library->Name.c_str(),
|
||||
library->Imports.size());
|
||||
sb.AppendFormat(" Version: %d.%d.%d.%d\n", library->Version.major,
|
||||
library->Version.minor, library->Version.build,
|
||||
library->Version.qfe);
|
||||
if (library->imports.size() > 0) {
|
||||
sb.AppendFormat(" %s - %lld imports\n", library->name.c_str(),
|
||||
library->imports.size());
|
||||
sb.AppendFormat(" Version: %d.%d.%d.%d\n", library->version.major,
|
||||
library->version.minor, library->version.build,
|
||||
library->version.qfe);
|
||||
sb.AppendFormat(" Min Version: %d.%d.%d.%d\n",
|
||||
library->MinVersion.major, library->MinVersion.minor,
|
||||
library->MinVersion.build, library->MinVersion.qfe);
|
||||
library->min_version.major, library->min_version.minor,
|
||||
library->min_version.build, library->min_version.qfe);
|
||||
sb.AppendFormat("\n");
|
||||
|
||||
// Counts.
|
||||
|
@ -713,11 +713,11 @@ void UserModule::Dump() {
|
|||
int unimpl_count = 0;
|
||||
|
||||
for (std::vector<cpu::XexModule::ImportLibraryFn>::const_iterator info =
|
||||
library->Imports.begin();
|
||||
info != library->Imports.end(); ++info) {
|
||||
if (kernel_state_->IsKernelModule(library->Name.c_str())) {
|
||||
library->imports.begin();
|
||||
info != library->imports.end(); ++info) {
|
||||
if (kernel_state_->IsKernelModule(library->name.c_str())) {
|
||||
auto kernel_export = export_resolver->GetExportByOrdinal(
|
||||
library->Name.c_str(), info->Ordinal);
|
||||
library->name.c_str(), info->ordinal);
|
||||
if (kernel_export) {
|
||||
known_count++;
|
||||
if (kernel_export->is_implemented()) {
|
||||
|
@ -730,10 +730,10 @@ void UserModule::Dump() {
|
|||
unimpl_count++;
|
||||
}
|
||||
} else {
|
||||
auto module = kernel_state_->GetModule(library->Name.c_str());
|
||||
auto module = kernel_state_->GetModule(library->name.c_str());
|
||||
if (module) {
|
||||
uint32_t export_addr =
|
||||
module->GetProcAddressByOrdinal(info->Ordinal);
|
||||
module->GetProcAddressByOrdinal(info->ordinal);
|
||||
if (export_addr) {
|
||||
impl_count++;
|
||||
known_count++;
|
||||
|
@ -747,8 +747,8 @@ void UserModule::Dump() {
|
|||
}
|
||||
}
|
||||
}
|
||||
float total_count = static_cast<float>(library->Imports.size()) / 100.0f;
|
||||
sb.AppendFormat(" Total: %4llu\n", library->Imports.size());
|
||||
float total_count = static_cast<float>(library->imports.size()) / 100.0f;
|
||||
sb.AppendFormat(" Total: %4llu\n", library->imports.size());
|
||||
sb.AppendFormat(" Known: %3d%% (%d known, %d unknown)\n",
|
||||
static_cast<int>(known_count / total_count), known_count,
|
||||
unknown_count);
|
||||
|
@ -759,22 +759,22 @@ void UserModule::Dump() {
|
|||
|
||||
// Listing.
|
||||
for (std::vector<cpu::XexModule::ImportLibraryFn>::const_iterator info =
|
||||
library->Imports.begin();
|
||||
info != library->Imports.end(); ++info) {
|
||||
library->imports.begin();
|
||||
info != library->imports.end(); ++info) {
|
||||
const char* name = "UNKNOWN";
|
||||
bool implemented = false;
|
||||
|
||||
cpu::Export* kernel_export = nullptr;
|
||||
if (kernel_state_->IsKernelModule(library->Name.c_str())) {
|
||||
if (kernel_state_->IsKernelModule(library->name.c_str())) {
|
||||
kernel_export = export_resolver->GetExportByOrdinal(
|
||||
library->Name.c_str(), info->Ordinal);
|
||||
library->name.c_str(), info->ordinal);
|
||||
if (kernel_export) {
|
||||
name = kernel_export->name;
|
||||
implemented = kernel_export->is_implemented();
|
||||
}
|
||||
} else {
|
||||
auto module = kernel_state_->GetModule(library->Name.c_str());
|
||||
if (module && module->GetProcAddressByOrdinal(info->Ordinal)) {
|
||||
auto module = kernel_state_->GetModule(library->name.c_str());
|
||||
if (module && module->GetProcAddressByOrdinal(info->ordinal)) {
|
||||
// TODO(benvanik): name lookup.
|
||||
implemented = true;
|
||||
}
|
||||
|
@ -782,12 +782,12 @@ void UserModule::Dump() {
|
|||
if (kernel_export &&
|
||||
kernel_export->type == cpu::Export::Type::kVariable) {
|
||||
sb.AppendFormat(" V %.8X %.3X (%3d) %s %s\n",
|
||||
info->ValueAddress, info->Ordinal, info->Ordinal,
|
||||
info->value_address, info->ordinal, info->ordinal,
|
||||
implemented ? " " : "!!", name);
|
||||
} else if (info->ThunkAddress) {
|
||||
} else if (info->thunk_address) {
|
||||
sb.AppendFormat(" F %.8X %.8X %.3X (%3d) %s %s\n",
|
||||
info->ValueAddress, info->ThunkAddress, info->Ordinal,
|
||||
info->Ordinal, implemented ? " " : "!!", name);
|
||||
info->value_address, info->thunk_address, info->ordinal,
|
||||
info->ordinal, implemented ? " " : "!!", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue