Code cleanup: moving ExportResolver to xe::cpu

This commit is contained in:
Ben Vanik 2015-05-02 02:11:11 -07:00
parent d76998915a
commit 642259e16f
50 changed files with 148 additions and 124 deletions

View File

@ -7,12 +7,13 @@
******************************************************************************
*/
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
#include "poly/assert.h"
#include "poly/math.h"
namespace xe {
namespace cpu {
ExportResolver::ExportResolver() {}
@ -65,4 +66,5 @@ void ExportResolver::SetFunctionMapping(const std::string& library_name,
kernel_export->function_data.shim = shim;
}
} // namespace cpu
} // namespace xe

View File

@ -7,14 +7,14 @@
******************************************************************************
*/
#ifndef XENIA_EXPORT_RESOLVER_H_
#define XENIA_EXPORT_RESOLVER_H_
#ifndef XENIA_CPU_EXPORT_RESOLVER_H_
#define XENIA_CPU_EXPORT_RESOLVER_H_
#include <string>
#include <vector>
namespace xe {
namespace cpu {
typedef void (*xe_kernel_export_shim_fn)(void*, void*);
@ -78,6 +78,7 @@ class ExportResolver {
std::vector<ExportTable> tables_;
};
} // namespace cpu
} // namespace xe
#endif // XENIA_EXPORT_RESOLVER_H_
#endif // XENIA_CPU_EXPORT_RESOLVER_H_

View File

@ -10,9 +10,9 @@
#include "xenia/cpu/processor.h"
#include "xenia/cpu/cpu-private.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/cpu/runtime.h"
#include "xenia/cpu/xex_module.h"
#include "xenia/export_resolver.h"
#include "xenia/logging.h"
#include "xenia/profiling.h"

View File

@ -13,7 +13,7 @@
#include <mutex>
#include <vector>
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/memory.h"
namespace xe {

View File

@ -13,11 +13,11 @@
#include "xenia/cpu/backend/backend.h"
#include "xenia/cpu/debugger.h"
#include "xenia/cpu/entry_table.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/cpu/frontend/ppc_frontend.h"
#include "xenia/cpu/function.h"
#include "xenia/cpu/module.h"
#include "xenia/cpu/thread_state.h"
#include "xenia/export_resolver.h"
#include "xenia/memory.h"
namespace xe {

View File

@ -10,6 +10,8 @@
'debugger.h',
'entry_table.cc',
'entry_table.h',
'export_resolver.cc',
'export_resolver.h',
'function.cc',
'function.h',
'instrument.cc',

View File

@ -13,8 +13,8 @@
#include "poly/math.h"
#include "xenia/cpu/cpu-private.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/cpu/runtime.h"
#include "xenia/export_resolver.h"
#include "xenia/logging.h"
namespace xe {

View File

@ -89,7 +89,7 @@ X_STATUS Emulator::Setup() {
memory_->set_trace_base(debug_agent_->trace_base());
// Shared export resolver used to attach and query for HLE exports.
export_resolver_ = std::make_unique<ExportResolver>();
export_resolver_ = std::make_unique<xe::cpu::ExportResolver>();
// Initialize the CPU.
processor_ =

View File

@ -23,6 +23,7 @@ namespace apu {
class AudioSystem;
} // namespace apu
namespace cpu {
class ExportResolver;
class Processor;
class ThreadState;
} // namespace cpu
@ -43,8 +44,6 @@ class MainWindow;
namespace xe {
class ExportResolver;
class Emulator {
public:
Emulator(const std::wstring& command_line);
@ -65,7 +64,9 @@ class Emulator {
}
hid::InputSystem* input_system() const { return input_system_.get(); }
ExportResolver* export_resolver() const { return export_resolver_.get(); }
cpu::ExportResolver* export_resolver() const {
return export_resolver_.get();
}
kernel::fs::FileSystem* file_system() const { return file_system_.get(); }
kernel::XboxkrnlModule* xboxkrnl() const { return xboxkrnl_.get(); }
@ -95,7 +96,7 @@ class Emulator {
std::unique_ptr<gpu::GraphicsSystem> graphics_system_;
std::unique_ptr<hid::InputSystem> input_system_;
std::unique_ptr<ExportResolver> export_resolver_;
std::unique_ptr<cpu::ExportResolver> export_resolver_;
std::unique_ptr<kernel::fs::FileSystem> file_system_;
std::unique_ptr<kernel::KernelState> kernel_state_;

View File

@ -13,7 +13,7 @@
#include <memory>
#include <mutex>
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/app.h"
#include "xenia/kernel/content_manager.h"
#include "xenia/kernel/fs/filesystem.h"
@ -49,7 +49,7 @@ class KernelState {
Memory* memory() const { return memory_; }
cpu::Processor* processor() const { return processor_; }
fs::FileSystem* file_system() const { return file_system_; }
uint32_t title_id() const;
Dispatcher* dispatcher() const { return dispatcher_; }

View File

@ -28,7 +28,7 @@ class XKernelModule : public XModule {
protected:
Emulator* emulator_;
Memory* memory_;
ExportResolver* export_resolver_;
xe::cpu::ExportResolver* export_resolver_;
};
} // namespace kernel

View File

@ -190,7 +190,7 @@ X_STATUS XUserModule::Launch(uint32_t flags) {
}
void XUserModule::Dump() {
ExportResolver* export_resolver =
xe::cpu::ExportResolver* export_resolver =
kernel_state_->emulator()->export_resolver();
const xe_xex2_header_t* header = xe_xex2_get_header(xex_);

View File

@ -12,7 +12,7 @@
#include "xenia/kernel/objects/xmodule.h"
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/util/xex2.h"
#include "xenia/xbox.h"

View File

@ -26,7 +26,7 @@
#define XE_EXPORT(module, ordinal, name, type, flags) \
{ \
ordinal, \
KernelExport::type, \
xe::cpu::KernelExport::type, \
flags, \
#name, \
}

View File

@ -10,8 +10,8 @@
#ifndef XENIA_KERNEL_UTIL_SHIM_UTILS_H_
#define XENIA_KERNEL_UTIL_SHIM_UTILS_H_
#include "xenia/cpu/export_resolver.h"
#include "xenia/cpu/frontend/ppc_context.h"
#include "xenia/export_resolver.h"
namespace xe {
namespace kernel {
@ -20,10 +20,9 @@ using PPCContext = xe::cpu::frontend::PPCContext;
#define SHIM_CALL void _cdecl
#define SHIM_SET_MAPPING(library_name, export_name, shim_data) \
export_resolver->SetFunctionMapping( \
library_name, ordinals::##export_name, \
shim_data, \
(xe_kernel_export_shim_fn)export_name##_shim);
export_resolver->SetFunctionMapping( \
library_name, ordinals::##export_name, shim_data, \
(xe::cpu::xe_kernel_export_shim_fn)export_name##_shim);
#define SHIM_MEM_BASE ppc_state->virtual_membase
#define SHIM_MEM_ADDR(a) (a ? (ppc_state->virtual_membase + a) : nullptr)

View File

@ -535,8 +535,8 @@ SHIM_CALL XamContentDelete_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterContentExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterContentExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamContentGetLicenseMask, state);
SHIM_SET_MAPPING("xam.xex", XamShowDeviceSelectorUI, state);
SHIM_SET_MAPPING("xam.xex", XamContentGetDeviceName, state);

View File

@ -186,8 +186,8 @@ SHIM_CALL XamEnumerate_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterInfoExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterInfoExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamGetSystemVersion, state);
SHIM_SET_MAPPING("xam.xex", XGetAVPack, state);
SHIM_SET_MAPPING("xam.xex", XGetGameRegion, state);

View File

@ -195,8 +195,8 @@ SHIM_CALL XamUserGetDeviceContext_shim(PPCContext* ppc_state,
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterInputExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterInputExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamResetInactivity, state);
SHIM_SET_MAPPING("xam.xex", XamEnableInactivityProcessing, state);
SHIM_SET_MAPPING("xam.xex", XamInputGetCapabilities, state);

View File

@ -10,7 +10,6 @@
#include "xenia/kernel/xam_module.h"
#include "poly/math.h"
#include "xenia/export_resolver.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xam_private.h"
@ -34,7 +33,7 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state)
xam::RegisterVoiceExports(export_resolver_, kernel_state_);
}
void XamModule::RegisterExportTable(ExportResolver* export_resolver) {
void XamModule::RegisterExportTable(xe::cpu::ExportResolver* export_resolver) {
assert_not_null(export_resolver);
if (!export_resolver) {
@ -43,7 +42,7 @@ void XamModule::RegisterExportTable(ExportResolver* export_resolver) {
// Build the export table used for resolution.
#include "xenia/kernel/util/export_table_pre.inc"
static KernelExport xam_export_table[] = {
static xe::cpu::KernelExport xam_export_table[] = {
#include "xenia/kernel/xam_table.inc"
};
#include "xenia/kernel/util/export_table_post.inc"

View File

@ -10,7 +10,7 @@
#ifndef XENIA_KERNEL_XAM_H_
#define XENIA_KERNEL_XAM_H_
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/objects/xkernel_module.h"
#include "xenia/kernel/xam_ordinals.h"
@ -22,7 +22,8 @@ class XamModule : public XKernelModule {
XamModule(Emulator* emulator, KernelState* kernel_state);
virtual ~XamModule();
static void RegisterExportTable(ExportResolver* export_resolver);
static void RegisterExportTable(xe::cpu::ExportResolver* export_resolver);
private:
};

View File

@ -117,8 +117,8 @@ SHIM_CALL XMsgCancelIORequest_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterMsgExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterMsgExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XMsgInProcessCall, state);
SHIM_SET_MAPPING("xam.xex", XMsgSystemProcessCall, state);
SHIM_SET_MAPPING("xam.xex", XMsgStartIORequest, state);

View File

@ -389,8 +389,8 @@ SHIM_CALL NetDll_sendto_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterNetExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterNetExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", NetDll_XNetStartup, state);
SHIM_SET_MAPPING("xam.xex", NetDll_XNetCleanup, state);
SHIM_SET_MAPPING("xam.xex", NetDll_XNetRandom, state);

View File

@ -102,8 +102,8 @@ SHIM_CALL XNotifyPositionUI_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterNotifyExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterNotifyExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamNotifyCreateListener, state);
SHIM_SET_MAPPING("xam.xex", XNotifyGetNext, state);
SHIM_SET_MAPPING("xam.xex", XNotifyDelayUI, state);

View File

@ -10,7 +10,7 @@
#ifndef XENIA_KERNEL_XAM_ORDINALS_H_
#define XENIA_KERNEL_XAM_ORDINALS_H_
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
// Build an ordinal enum to make it easy to lookup ordinals.
#include "xenia/kernel/util/ordinal_table_pre.inc"

View File

@ -10,6 +10,7 @@
#ifndef XENIA_KERNEL_XAM_PRIVATE_H_
#define XENIA_KERNEL_XAM_PRIVATE_H_
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/xam_ordinals.h"
namespace xe {
@ -19,17 +20,26 @@ class KernelState;
namespace xam {
// Registration functions, one per file.
void RegisterContentExports(ExportResolver* export_resolver,
void RegisterContentExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterInfoExports(ExportResolver* export_resolver, KernelState* state);
void RegisterInputExports(ExportResolver* export_resolver, KernelState* state);
void RegisterMsgExports(ExportResolver* export_resolver, KernelState* state);
void RegisterNetExports(ExportResolver* export_resolver, KernelState* state);
void RegisterNotifyExports(ExportResolver* export_resolver, KernelState* state);
void RegisterUIExports(ExportResolver* export_resolver, KernelState* state);
void RegisterUserExports(ExportResolver* export_resolver, KernelState* state);
void RegisterVideoExports(ExportResolver* export_resolver, KernelState* state);
void RegisterVoiceExports(ExportResolver* export_resolver, KernelState* state);
void RegisterInfoExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterInputExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterMsgExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterNetExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterNotifyExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterUIExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterUserExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterVoiceExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
} // namespace xam
} // namespace kernel

View File

@ -61,7 +61,7 @@ SHIM_CALL XamShowMessageBoxUI_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterUIExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterUIExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamShowMessageBoxUI, state);
}

View File

@ -442,8 +442,8 @@ SHIM_CALL XamSessionRefObjByHandle_shim(PPCContext* ppc_state, KernelState* stat
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterUserExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterUserExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamUserGetXUID, state);
SHIM_SET_MAPPING("xam.xex", XamUserGetSigninState, state);
SHIM_SET_MAPPING("xam.xex", XamUserGetSigninInfo, state);

View File

@ -26,7 +26,7 @@ SHIM_CALL XGetVideoMode_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterVideoExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterVideoExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XGetVideoMode, state);
}

View File

@ -50,8 +50,8 @@ SHIM_CALL XamVoiceHeadsetPresent_shim(PPCContext* ppc_state,
} // namespace kernel
} // namespace xe
void xe::kernel::xam::RegisterVoiceExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xam::RegisterVoiceExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xam.xex", XamVoiceCreate, state);
SHIM_SET_MAPPING("xam.xex", XamVoiceClose, state);
SHIM_SET_MAPPING("xam.xex", XamVoiceHeadsetPresent, state);

View File

@ -126,8 +126,8 @@ SHIM_CALL XAudioSubmitRenderDriverFrame_shim(PPCContext* ppc_state,
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterAudioExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterAudioExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
// Additional XMA* methods are in xboxkrnl_audio_xma.cc.
SHIM_SET_MAPPING("xboxkrnl.exe", XAudioGetSpeakerConfig, state);

View File

@ -468,7 +468,7 @@ SHIM_CALL XMABlockWhileInUse_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace xe
void xe::kernel::xboxkrnl::RegisterAudioXmaExports(
ExportResolver* export_resolver, KernelState* state) {
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
// Used for both XMA* methods and direct register access.
SHIM_SET_MAPPING("xboxkrnl.exe", XMACreateContext, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XMAReleaseContext, state);

View File

@ -283,8 +283,8 @@ SHIM_CALL KeBugCheckEx_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterDebugExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterDebugExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", DbgPrint, state);
SHIM_SET_MAPPING("xboxkrnl.exe", DbgBreakPoint, state);
SHIM_SET_MAPPING("xboxkrnl.exe", RtlRaiseException, state);

View File

@ -36,7 +36,7 @@ SHIM_CALL HalReturnToFirmware_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterHalExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterHalExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", HalReturnToFirmware, state);
}

View File

@ -740,8 +740,8 @@ SHIM_CALL FscSetCacheElementCount_shim(PPCContext* ppc_state,
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterIoExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterIoExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", NtCreateFile, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtOpenFile, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtReadFile, state);

View File

@ -451,7 +451,7 @@ SHIM_CALL KeUnlockL2_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace xe
void xe::kernel::xboxkrnl::RegisterMemoryExports(
ExportResolver* export_resolver, KernelState* state) {
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", NtAllocateVirtualMemory, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtFreeVirtualMemory, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtQueryVirtualMemory, state);

View File

@ -27,7 +27,7 @@ SHIM_CALL KeEnableFpuExceptions_shim(PPCContext* ppc_state,
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterMiscExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterMiscExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", KeEnableFpuExceptions, state);
}

View File

@ -12,7 +12,6 @@
#include <gflags/gflags.h>
#include "poly/math.h"
#include "xenia/emulator.h"
#include "xenia/export_resolver.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xboxkrnl_private.h"
#include "xenia/kernel/objects/xuser_module.h"
@ -149,7 +148,8 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state)
WT_EXECUTEINTIMERTHREAD);
}
void XboxkrnlModule::RegisterExportTable(ExportResolver* export_resolver) {
void XboxkrnlModule::RegisterExportTable(
xe::cpu::ExportResolver* export_resolver) {
assert_not_null(export_resolver);
if (!export_resolver) {
@ -158,7 +158,7 @@ void XboxkrnlModule::RegisterExportTable(ExportResolver* export_resolver) {
// Build the export table used for resolution.
#include "xenia/kernel/util/export_table_pre.inc"
static KernelExport xboxkrnl_export_table[] = {
static xe::cpu::KernelExport xboxkrnl_export_table[] = {
#include "xenia/kernel/xboxkrnl_table.inc"
};
#include "xenia/kernel/util/export_table_post.inc"

View File

@ -10,7 +10,7 @@
#ifndef XENIA_KERNEL_XBOXKRNL_MODULE_H_
#define XENIA_KERNEL_XBOXKRNL_MODULE_H_
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/objects/xkernel_module.h"
#include "xenia/kernel/xboxkrnl_ordinals.h"
@ -27,7 +27,7 @@ class XboxkrnlModule : public XKernelModule {
XboxkrnlModule(Emulator* emulator, KernelState* kernel_state);
virtual ~XboxkrnlModule();
static void RegisterExportTable(ExportResolver* export_resolver);
static void RegisterExportTable(xe::cpu::ExportResolver* export_resolver);
int LaunchModule(const char* path);

View File

@ -301,7 +301,7 @@ SHIM_CALL ExRegisterTitleTerminateNotification_shim(PPCContext* ppc_state,
} // namespace xe
void xe::kernel::xboxkrnl::RegisterModuleExports(
ExportResolver* export_resolver, KernelState* state) {
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", ExGetXConfigSetting, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XexCheckExecutablePrivilege, state);

View File

@ -157,8 +157,8 @@ SHIM_CALL NtClose_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterObExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterObExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", ObOpenObjectByName, state);
SHIM_SET_MAPPING("xboxkrnl.exe", ObReferenceObjectByHandle, state);
SHIM_SET_MAPPING("xboxkrnl.exe", ObDereferenceObject, state);

View File

@ -10,7 +10,7 @@
#ifndef XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
#define XENIA_KERNEL_XBOXKRNL_ORDINALS_H_
#include "xenia/export_resolver.h"
#include "xenia/cpu/export_resolver.h"
// Build an ordinal enum to make it easy to lookup ordinals.
#include "xenia/kernel/util/ordinal_table_pre.inc"

View File

@ -19,22 +19,34 @@ class KernelState;
namespace xboxkrnl {
// Registration functions, one per file.
void RegisterAudioExports(ExportResolver* export_resolver, KernelState* state);
void RegisterAudioXmaExports(ExportResolver* export_resolver,
void RegisterAudioExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterAudioXmaExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterDebugExports(ExportResolver* export_resolver, KernelState* state);
void RegisterHalExports(ExportResolver* export_resolver, KernelState* state);
void RegisterIoExports(ExportResolver* export_resolver, KernelState* state);
void RegisterMemoryExports(ExportResolver* export_resolver, KernelState* state);
void RegisterMiscExports(ExportResolver* export_resolver, KernelState* state);
void RegisterModuleExports(ExportResolver* export_resolver, KernelState* state);
void RegisterObExports(ExportResolver* export_resolver, KernelState* state);
void RegisterRtlExports(ExportResolver* export_resolver, KernelState* state);
void RegisterStringExports(ExportResolver* export_resolver, KernelState* state);
void RegisterThreadingExports(ExportResolver* export_resolver,
void RegisterDebugExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterHalExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterIoExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterMemoryExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterModuleExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterObExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterRtlExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterStringExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterThreadingExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterUsbcamExports(ExportResolver* export_resolver, KernelState* state);
void RegisterVideoExports(ExportResolver* export_resolver, KernelState* state);
void RegisterUsbcamExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver,
KernelState* state);
} // namespace xboxkrnl
} // namespace kernel

View File

@ -682,8 +682,8 @@ SHIM_CALL RtlTimeFieldsToTime_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterRtlExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterRtlExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", RtlCompareMemory, state);
SHIM_SET_MAPPING("xboxkrnl.exe", RtlCompareMemoryUlong, state);
SHIM_SET_MAPPING("xboxkrnl.exe", RtlFillMemoryUlong, state);

View File

@ -834,7 +834,7 @@ SHIM_CALL _vscwprintf_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace xe
void xe::kernel::xboxkrnl::RegisterStringExports(
ExportResolver* export_resolver, KernelState* state) {
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", sprintf, state);
SHIM_SET_MAPPING("xboxkrnl.exe", vsprintf, state);
SHIM_SET_MAPPING("xboxkrnl.exe", _vsnprintf, state);

View File

@ -1282,7 +1282,7 @@ SHIM_CALL KeRemoveQueueDpc_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace xe
void xe::kernel::xboxkrnl::RegisterThreadingExports(
ExportResolver* export_resolver, KernelState* state) {
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", ExCreateThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", ExTerminateThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtResumeThread, state);

View File

@ -37,7 +37,7 @@ SHIM_CALL XUsbcamGetState_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace xe
void xe::kernel::xboxkrnl::RegisterUsbcamExports(
ExportResolver* export_resolver, KernelState* state) {
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", XUsbcamCreate, state);
SHIM_SET_MAPPING("xboxkrnl.exe", XUsbcamGetState, state);
}

View File

@ -433,8 +433,8 @@ SHIM_CALL VdSwap_shim(PPCContext* ppc_state, KernelState* state) {
} // namespace kernel
} // namespace xe
void xe::kernel::xboxkrnl::RegisterVideoExports(ExportResolver* export_resolver,
KernelState* state) {
void xe::kernel::xboxkrnl::RegisterVideoExports(
xe::cpu::ExportResolver* export_resolver, KernelState* state) {
SHIM_SET_MAPPING("xboxkrnl.exe", VdGetCurrentDisplayGamma, state);
SHIM_SET_MAPPING("xboxkrnl.exe", VdGetCurrentDisplayInformation, state);
SHIM_SET_MAPPING("xboxkrnl.exe", VdQueryVideoFlags, state);

View File

@ -5,8 +5,6 @@
'debug_agent.h',
'emulator.cc',
'emulator.h',
'export_resolver.cc',
'export_resolver.h',
'logging.cc',
'logging.h',
'memory.cc',

View File

@ -31,7 +31,7 @@ apiscanner_loader::apiscanner_loader()
: export_resolver(nullptr)
, memory_(nullptr)
{
export_resolver = std::make_unique<ExportResolver>();
export_resolver = std::make_unique<xe::cpu::ExportResolver>();
kernel::XamModule::RegisterExportTable(export_resolver.get());
kernel::XboxkrnlModule::RegisterExportTable(export_resolver.get());
@ -167,11 +167,12 @@ bool apiscanner_loader::ExtractImports(const void* addr, const size_t length,
for (size_t m = 0; m < import_info_count; m++) {
const xe_xex2_import_info_t* import_info = &import_infos[m];
KernelExport* kernel_export = export_resolver->GetExportByOrdinal(
library->name, import_info->ordinal);
auto kernel_export = export_resolver->GetExportByOrdinal(
library->name, import_info->ordinal);
if ((kernel_export && kernel_export->type == KernelExport::Variable)
|| import_info->thunk_address) {
if ((kernel_export &&
kernel_export->type == xe::cpu::KernelExport::Variable) ||
import_info->thunk_address) {
const std::string named(kernel_export ? kernel_export->name : "");
info.imports.push_back(named);
}

View File

@ -7,21 +7,18 @@
******************************************************************************
*/
#include "poly/main.h"
#include "poly/string.h"
#include "poly/math.h"
#include "xenia/kernel/fs/filesystem.h"
#include "xenia/memory.h"
#include "xenia/kernel/objects/xfile.h"
#include "xenia/export_resolver.h"
#include "xenia/kernel/util/xex2.h"
#include "xenia/xbox.h"
#include <vector>
#include "poly/main.h"
#include "poly/math.h"
#include "poly/string.h"
#include "xenia/cpu/export_resolver.h"
#include "xenia/kernel/fs/filesystem.h"
#include "xenia/kernel/objects/xfile.h"
#include "xenia/kernel/util/xex2.h"
#include "xenia/memory.h"
#include "xenia/xbox.h"
namespace xe {
namespace tools {
@ -42,7 +39,8 @@ namespace tools {
kernel::fs::FileSystem file_system;
apiscanner_logger log;
std::unique_ptr<Memory> memory_;
std::unique_ptr<ExportResolver> export_resolver;
std::unique_ptr<xe::cpu::ExportResolver> export_resolver;
public:
apiscanner_loader();
~apiscanner_loader();