Minor fixes and debug helpers to track externs.

This commit is contained in:
Ben Vanik
2014-01-04 13:20:19 -08:00
parent e362a65189
commit 615229bd87
6 changed files with 39 additions and 22 deletions

View File

@@ -134,8 +134,16 @@ int XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
uint32_t* slot = (uint32_t*)(membase + info->value_address);
if (kernel_export->type == KernelExport::Function) {
// Not exactly sure what this should be...
// TODO(benvanik): find out what import variables are.
XELOGW("kernel import variable not defined");
if (info->thunk_address) {
// slot = XESWAP32BE(info->thunk_address);
// Setting this breaks other emu code that relies on it not being
// modified. Not sure what to do.
} else {
// TODO(benvanik): find out what import variables are.
XELOGW("kernel import variable not defined %.8X %s",
info->value_address, kernel_export->name);
//*slot = XESWAP32BE(0xF00DF00D);
}
} else {
if (kernel_export->is_implemented) {
// Implemented - replace with pointer.
@@ -176,11 +184,14 @@ int XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
}
DefineFunction(fn_info);
Function* fn = new ExternFunction(
info->thunk_address,
auto fn = new ExternFunction(
info->thunk_address,
handler,
handler_data,
NULL);
if (kernel_export) {
fn->set_name(kernel_export->name);
}
fn_info->set_function(fn);
fn_info->set_status(SymbolInfo::STATUS_DEFINED);
}

View File

@@ -27,6 +27,7 @@ namespace xboxkrnl {
void xeKeBugCheckEx(uint32_t code, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4) {
XELOGD("*** STOP: 0x%.8X (0x%.8X, 0x%.8X, 0x%.8X, 0x%.8X)", code, param1, param2, param3, param4);
fflush(stdout);
DebugBreak();
XEASSERTALWAYS();
}

View File

@@ -931,6 +931,8 @@ int xe_xex2_get_import_infos(xe_xex2_ref xex,
info_count * sizeof(xe_xex2_import_info_t));
XEEXPECTNOTNULL(infos);
XEASSERTNOTZERO(info_count);
// Construct infos.
for (size_t n = 0, i = 0; n < library->record_count; n++) {
const uint32_t record = library->records[n];