From db8eb83057133c17f28ff5066764cedcba8eb8be Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sat, 28 Nov 2015 13:55:14 -0600 Subject: [PATCH] Track export data on Guest Functions --- src/xenia/cpu/function.cc | 3 ++- src/xenia/cpu/function.h | 8 +++++++- src/xenia/cpu/xex_module.cc | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/xenia/cpu/function.cc b/src/xenia/cpu/function.cc index ce063d917..095dded85 100644 --- a/src/xenia/cpu/function.cc +++ b/src/xenia/cpu/function.cc @@ -60,9 +60,10 @@ GuestFunction::GuestFunction(Module* module, uint32_t address) GuestFunction::~GuestFunction() = default; -void GuestFunction::SetupExtern(ExternHandler handler) { +void GuestFunction::SetupExtern(ExternHandler handler, Export* export_data) { behavior_ = Behavior::kExtern; extern_handler_ = handler; + export_data_ = export_data; } const SourceMapEntry* GuestFunction::LookupGuestAddress( diff --git a/src/xenia/cpu/function.h b/src/xenia/cpu/function.h index 802241133..8c0e5cc97 100644 --- a/src/xenia/cpu/function.h +++ b/src/xenia/cpu/function.h @@ -20,6 +20,10 @@ #include "xenia/debug/function_trace_data.h" namespace xe { +namespace cpu { +class Export; +} // namespace cpu + namespace cpu { struct SourceMapEntry { @@ -115,7 +119,8 @@ class GuestFunction : public Function { std::vector& source_map() { return source_map_; } ExternHandler extern_handler() const { return extern_handler_; } - void SetupExtern(ExternHandler handler); + Export* export_data() const { return export_data_; } + void SetupExtern(ExternHandler handler, Export* export_data = nullptr); const SourceMapEntry* LookupGuestAddress(uint32_t guest_address) const; const SourceMapEntry* LookupHIROffset(uint32_t offset) const; @@ -135,6 +140,7 @@ class GuestFunction : public Function { debug::FunctionTraceData trace_data_; std::vector source_map_; ExternHandler extern_handler_ = nullptr; + Export* export_data_ = nullptr; }; } // namespace cpu diff --git a/src/xenia/cpu/xex_module.cc b/src/xenia/cpu/xex_module.cc index 2b7ab26f2..eff23b2bb 100644 --- a/src/xenia/cpu/xex_module.cc +++ b/src/xenia/cpu/xex_module.cc @@ -475,7 +475,7 @@ bool XexModule::SetupLibraryImports(const char* name, XELOGW("WARNING: Imported kernel function %s is unimplemented!", import_name.GetString()); } - static_cast(function)->SetupExtern(handler); + static_cast(function)->SetupExtern(handler, kernel_export); } function->set_status(Symbol::Status::kDeclared); } else {