From 12ec7289893b3121b9bf054c2f3c6059b91af69e Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 9 Jan 2022 13:29:47 -0600 Subject: [PATCH] [Kernel] Use tables for export groups. --- src/xenia/kernel/util/shim_utils.h | 14 +++++++++ src/xenia/kernel/xam/xam_avatar.cc | 2 ++ src/xenia/kernel/xam/xam_content.cc | 5 ++- src/xenia/kernel/xam/xam_content_aggregate.cc | 5 ++- src/xenia/kernel/xam/xam_content_device.cc | 5 ++- src/xenia/kernel/xam/xam_enum.cc | 5 ++- src/xenia/kernel/xam/xam_info.cc | 5 ++- src/xenia/kernel/xam/xam_input.cc | 5 ++- src/xenia/kernel/xam/xam_locale.cc | 3 +- src/xenia/kernel/xam/xam_module.cc | 1 + src/xenia/kernel/xam/xam_msg.cc | 5 ++- src/xenia/kernel/xam/xam_net.cc | 5 ++- src/xenia/kernel/xam/xam_notify.cc | 7 ++--- src/xenia/kernel/xam/xam_nui.cc | 5 ++- src/xenia/kernel/xam/xam_party.cc | 4 +-- src/xenia/kernel/xam/xam_task.cc | 5 ++- src/xenia/kernel/xam/xam_ui.cc | 5 ++- src/xenia/kernel/xam/xam_user.cc | 3 +- src/xenia/kernel/xam/xam_video.cc | 5 ++- src/xenia/kernel/xam/xam_voice.cc | 5 ++- src/xenia/kernel/xbdm/xbdm_misc.cc | 5 ++- src/xenia/kernel/xbdm/xbdm_module.cc | 7 +++-- .../kernel/xbdm/xbdm_module_export_groups.inc | 13 ++++++++ src/xenia/kernel/xbdm/xbdm_private.h | 9 ++++-- src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc | 7 ++--- .../kernel/xboxkrnl/xboxkrnl_audio_xma.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_hid.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc | 7 ++--- src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc | 23 +++----------- .../xboxkrnl_module_export_groups.inc | 31 +++++++++++++++++++ src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_private.h | 28 +++-------------- src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc | 5 ++- .../kernel/xboxkrnl/xboxkrnl_threading.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc | 5 ++- src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc | 5 ++- 44 files changed, 151 insertions(+), 153 deletions(-) create mode 100644 src/xenia/kernel/xbdm/xbdm_module_export_groups.inc create mode 100644 src/xenia/kernel/xboxkrnl/xboxkrnl_module_export_groups.inc diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index e9e287fbc..3e05ad0aa 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -564,6 +564,11 @@ using xe::cpu::ExportTag; xe::cpu::ExportCategory::category) \ << xe::cpu::ExportTag::CategoryShift))); +#define DECLARE_EMPTY_REGISTER_EXPORTS(module_name, group_name) \ + void xe::kernel::module_name::Register##group_name##Exports( \ + xe::cpu::ExportResolver* export_resolver, \ + xe::kernel::KernelState* kernel_state) {} + #define DECLARE_XAM_EXPORT_(name, category, tags) \ DECLARE_EXPORT(xam, name, category, tags) #define DECLARE_XAM_EXPORT1(name, category, tag) \ @@ -572,11 +577,17 @@ using xe::cpu::ExportTag; DECLARE_EXPORT(xam, name, category, \ xe::cpu::ExportTag::tag1 | xe::cpu::ExportTag::tag2) +#define DECLARE_XAM_EMPTY_REGISTER_EXPORTS(group_name) \ + DECLARE_EMPTY_REGISTER_EXPORTS(xam, group_name) + #define DECLARE_XBDM_EXPORT_(name, category, tags) \ DECLARE_EXPORT(xbdm, name, category, tags) #define DECLARE_XBDM_EXPORT1(name, category, tag) \ DECLARE_EXPORT(xbdm, name, category, xe::cpu::ExportTag::tag) +#define DECLARE_XBDM_EMPTY_REGISTER_EXPORTS(group_name) \ + DECLARE_EMPTY_REGISTER_EXPORTS(xbdm, group_name) + #define DECLARE_XBOXKRNL_EXPORT_(name, category, tags) \ DECLARE_EXPORT(xboxkrnl, name, category, tags) #define DECLARE_XBOXKRNL_EXPORT1(name, category, tag) \ @@ -593,6 +604,9 @@ using xe::cpu::ExportTag; xe::cpu::ExportTag::tag1 | xe::cpu::ExportTag::tag2 | \ xe::cpu::ExportTag::tag3 | xe::cpu::ExportTag::tag4) +#define DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(group_name) \ + DECLARE_EMPTY_REGISTER_EXPORTS(xboxkrnl, group_name) + } // namespace kernel } // namespace xe diff --git a/src/xenia/kernel/xam/xam_avatar.cc b/src/xenia/kernel/xam/xam_avatar.cc index c105aaefe..0beabc37b 100644 --- a/src/xenia/kernel/xam/xam_avatar.cc +++ b/src/xenia/kernel/xam/xam_avatar.cc @@ -41,3 +41,5 @@ void RegisterAvatarExports(xe::cpu::ExportResolver* export_resolver, } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Avatar); diff --git a/src/xenia/kernel/xam/xam_content.cc b/src/xenia/kernel/xam/xam_content.cc index 5f4c12111..11a9cf52b 100644 --- a/src/xenia/kernel/xam/xam_content.cc +++ b/src/xenia/kernel/xam/xam_content.cc @@ -420,9 +420,8 @@ dword_result_t XamContentDeleteInternal_entry(lpvoid_t content_data_ptr, } DECLARE_XAM_EXPORT1(XamContentDeleteInternal, kContent, kImplemented); -void RegisterContentExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Content); diff --git a/src/xenia/kernel/xam/xam_content_aggregate.cc b/src/xenia/kernel/xam/xam_content_aggregate.cc index 970d80652..eb41c29f7 100644 --- a/src/xenia/kernel/xam/xam_content_aggregate.cc +++ b/src/xenia/kernel/xam/xam_content_aggregate.cc @@ -139,9 +139,8 @@ dword_result_t XamContentAggregateCreateEnumerator_entry(qword_t xuid, } DECLARE_XAM_EXPORT1(XamContentAggregateCreateEnumerator, kContent, kStub); -void RegisterContentAggregateExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(ContentAggregate); diff --git a/src/xenia/kernel/xam/xam_content_device.cc b/src/xenia/kernel/xam/xam_content_device.cc index 04bf93326..7abe02123 100644 --- a/src/xenia/kernel/xam/xam_content_device.cc +++ b/src/xenia/kernel/xam/xam_content_device.cc @@ -167,9 +167,8 @@ dword_result_t XamContentCreateDeviceEnumerator_entry(dword_t content_type, } DECLARE_XAM_EXPORT1(XamContentCreateDeviceEnumerator, kNone, kImplemented); -void RegisterContentDeviceExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(ContentDevice); diff --git a/src/xenia/kernel/xam/xam_enum.cc b/src/xenia/kernel/xam/xam_enum.cc index eacec3630..9f5c08bb4 100644 --- a/src/xenia/kernel/xam/xam_enum.cc +++ b/src/xenia/kernel/xam/xam_enum.cc @@ -110,9 +110,8 @@ dword_result_t XamGetPrivateEnumStructureFromHandle_entry( } DECLARE_XAM_EXPORT1(XamGetPrivateEnumStructureFromHandle, kNone, kStub); -void RegisterEnumExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Enum); diff --git a/src/xenia/kernel/xam/xam_info.cc b/src/xenia/kernel/xam/xam_info.cc index 76d749841..0bfe7c97b 100644 --- a/src/xenia/kernel/xam/xam_info.cc +++ b/src/xenia/kernel/xam/xam_info.cc @@ -342,9 +342,8 @@ dword_result_t XamQueryLiveHiveW_entry(lpu16string_t name, lpvoid_t out_buf, } DECLARE_XAM_EXPORT1(XamQueryLiveHiveW, kNone, kStub); -void RegisterInfoExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Info); diff --git a/src/xenia/kernel/xam/xam_input.cc b/src/xenia/kernel/xam/xam_input.cc index 413b797a0..2d177e98b 100644 --- a/src/xenia/kernel/xam/xam_input.cc +++ b/src/xenia/kernel/xam/xam_input.cc @@ -194,9 +194,8 @@ X_HRESULT_result_t XamUserGetDeviceContext_entry(dword_t user_index, } DECLARE_XAM_EXPORT1(XamUserGetDeviceContext, kInput, kStub); -void RegisterInputExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Input); diff --git a/src/xenia/kernel/xam/xam_locale.cc b/src/xenia/kernel/xam/xam_locale.cc index 573b41086..e45c771ad 100644 --- a/src/xenia/kernel/xam/xam_locale.cc +++ b/src/xenia/kernel/xam/xam_locale.cc @@ -436,5 +436,4 @@ DECLARE_XAM_EXPORT1(XamGetLocaleEx, kLocale, kImplemented); } // namespace kernel } // namespace xe -void xe::kernel::xam::RegisterLocaleExports( - xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {} +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Locale); diff --git a/src/xenia/kernel/xam/xam_module.cc b/src/xenia/kernel/xam/xam_module.cc index 7689d3bf8..a94b1d6ef 100644 --- a/src/xenia/kernel/xam/xam_module.cc +++ b/src/xenia/kernel/xam/xam_module.cc @@ -27,6 +27,7 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) : KernelModule(kernel_state, "xe:\\xam.xex"), loader_data_() { RegisterExportTable(export_resolver_); + // Register all exported functions. #define XE_MODULE_EXPORT_GROUP(m, n) \ Register##n##Exports(export_resolver_, kernel_state_); #include "xam_module_export_groups.inc" diff --git a/src/xenia/kernel/xam/xam_msg.cc b/src/xenia/kernel/xam/xam_msg.cc index 3251b0d05..3be2f7ed1 100644 --- a/src/xenia/kernel/xam/xam_msg.cc +++ b/src/xenia/kernel/xam/xam_msg.cc @@ -135,9 +135,8 @@ dword_result_t XamGetOverlappedResult_entry( } DECLARE_XAM_EXPORT2(XamGetOverlappedResult, kNone, kImplemented, kSketchy); -void RegisterMsgExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Msg); diff --git a/src/xenia/kernel/xam/xam_net.cc b/src/xenia/kernel/xam/xam_net.cc index 67af4622c..a331f139d 100644 --- a/src/xenia/kernel/xam/xam_net.cc +++ b/src/xenia/kernel/xam/xam_net.cc @@ -1031,9 +1031,8 @@ void NetDll_WSASetLastError_entry(dword_t error_code) { } DECLARE_XAM_EXPORT1(NetDll_WSASetLastError, kNetworking, kImplemented); -void RegisterNetExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Net); diff --git a/src/xenia/kernel/xam/xam_notify.cc b/src/xenia/kernel/xam/xam_notify.cc index dc28466e9..71bc59807 100644 --- a/src/xenia/kernel/xam/xam_notify.cc +++ b/src/xenia/kernel/xam/xam_notify.cc @@ -102,9 +102,8 @@ void XNotifyPositionUI_entry(dword_t position) { } DECLARE_XAM_EXPORT1(XNotifyPositionUI, kNone, kStub); -void RegisterNotifyExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel -} // namespace xe \ No newline at end of file +} // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Notify); diff --git a/src/xenia/kernel/xam/xam_nui.cc b/src/xenia/kernel/xam/xam_nui.cc index 725517111..48ab0d946 100644 --- a/src/xenia/kernel/xam/xam_nui.cc +++ b/src/xenia/kernel/xam/xam_nui.cc @@ -66,9 +66,8 @@ dword_result_t XamShowNuiTroubleshooterUI_entry(unknown_t unk1, unknown_t unk2, } DECLARE_XAM_EXPORT1(XamShowNuiTroubleshooterUI, kNone, kStub); -void RegisterNUIExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(NUI); diff --git a/src/xenia/kernel/xam/xam_party.cc b/src/xenia/kernel/xam/xam_party.cc index 5e74dca02..d278be996 100644 --- a/src/xenia/kernel/xam/xam_party.cc +++ b/src/xenia/kernel/xam/xam_party.cc @@ -40,8 +40,8 @@ dword_result_t XamPartyGetBandwidth_entry(dword_t r3, dword_t r4) { } DECLARE_XAM_EXPORT1(XamPartyGetBandwidth, kNone, kStub); -void RegisterPartyExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Party); diff --git a/src/xenia/kernel/xam/xam_task.cc b/src/xenia/kernel/xam/xam_task.cc index 82ae23025..7fe6eb4d3 100644 --- a/src/xenia/kernel/xam/xam_task.cc +++ b/src/xenia/kernel/xam/xam_task.cc @@ -72,9 +72,8 @@ DECLARE_XAM_EXPORT2(XamTaskSchedule, kNone, kImplemented, kSketchy); dword_result_t XamTaskShouldExit_entry(dword_t r3) { return 0; } DECLARE_XAM_EXPORT2(XamTaskShouldExit, kNone, kStub, kSketchy); -void RegisterTaskExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Task); diff --git a/src/xenia/kernel/xam/xam_ui.cc b/src/xenia/kernel/xam/xam_ui.cc index 4fc28fd7d..2762facf3 100644 --- a/src/xenia/kernel/xam/xam_ui.cc +++ b/src/xenia/kernel/xam/xam_ui.cc @@ -503,9 +503,8 @@ dword_result_t XamShowCommunitySessionsUI_entry(unknown_t r3, unknown_t r4) { } DECLARE_XAM_EXPORT1(XamShowCommunitySessionsUI, kNone, kStub); -void RegisterUIExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(UI); diff --git a/src/xenia/kernel/xam/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc index 6da2d1635..625b977cd 100644 --- a/src/xenia/kernel/xam/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -788,5 +788,4 @@ DECLARE_XAM_EXPORT1(XamSessionRefObjByHandle, kUserProfiles, kStub); } // namespace kernel } // namespace xe -void xe::kernel::xam::RegisterUserExports( - xe::cpu::ExportResolver* export_resolver, KernelState* kernel_state) {} +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(User); diff --git a/src/xenia/kernel/xam/xam_video.cc b/src/xenia/kernel/xam/xam_video.cc index 06a1d0029..37c9d6948 100644 --- a/src/xenia/kernel/xam/xam_video.cc +++ b/src/xenia/kernel/xam/xam_video.cc @@ -27,9 +27,8 @@ DECLARE_XAM_EXPORT1(XGetVideoMode, kVideo, ExportTag::kSketchy); dword_result_t XGetVideoCapabilities_entry() { return 0; } DECLARE_XAM_EXPORT1(XGetVideoCapabilities, kVideo, kStub); -void RegisterVideoExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Video); diff --git a/src/xenia/kernel/xam/xam_voice.cc b/src/xenia/kernel/xam/xam_voice.cc index 3d3379424..dbe87db3d 100644 --- a/src/xenia/kernel/xam/xam_voice.cc +++ b/src/xenia/kernel/xam/xam_voice.cc @@ -38,9 +38,8 @@ DECLARE_XAM_EXPORT1(XamVoiceClose, kNone, kStub); dword_result_t XamVoiceHeadsetPresent_entry(lpunknown_t voice_ptr) { return 0; } DECLARE_XAM_EXPORT1(XamVoiceHeadsetPresent, kNone, kStub); -void RegisterVoiceExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xam } // namespace kernel } // namespace xe + +DECLARE_XAM_EMPTY_REGISTER_EXPORTS(Voice); diff --git a/src/xenia/kernel/xbdm/xbdm_misc.cc b/src/xenia/kernel/xbdm/xbdm_misc.cc index 8db457c70..7f2b9f960 100644 --- a/src/xenia/kernel/xbdm/xbdm_misc.cc +++ b/src/xenia/kernel/xbdm/xbdm_misc.cc @@ -86,9 +86,8 @@ dword_result_t DmFindPdbSignature_entry(lpdword_t unk0_ptr, } DECLARE_XBDM_EXPORT1(DmFindPdbSignature, kDebug, kStub); -void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xbdm } // namespace kernel } // namespace xe + +DECLARE_XBDM_EMPTY_REGISTER_EXPORTS(Misc); diff --git a/src/xenia/kernel/xbdm/xbdm_module.cc b/src/xenia/kernel/xbdm/xbdm_module.cc index 5e22aae43..c744e4b68 100644 --- a/src/xenia/kernel/xbdm/xbdm_module.cc +++ b/src/xenia/kernel/xbdm/xbdm_module.cc @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * + * Copyright 2022 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -24,7 +24,10 @@ XbdmModule::XbdmModule(Emulator* emulator, KernelState* kernel_state) RegisterExportTable(export_resolver_); // Register all exported functions. - RegisterMiscExports(export_resolver_, kernel_state_); +#define XE_MODULE_EXPORT_GROUP(m, n) \ + Register##n##Exports(export_resolver_, kernel_state_); +#include "xbdm_module_export_groups.inc" +#undef XE_MODULE_EXPORT_GROUP } std::vector xbdm_exports(4096); diff --git a/src/xenia/kernel/xbdm/xbdm_module_export_groups.inc b/src/xenia/kernel/xbdm/xbdm_module_export_groups.inc new file mode 100644 index 000000000..f47842d3d --- /dev/null +++ b/src/xenia/kernel/xbdm/xbdm_module_export_groups.inc @@ -0,0 +1,13 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2022 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +// This is a partial file designed to be included by other files when +// constructing various tables. + +XE_MODULE_EXPORT_GROUP(xbdm, Misc) diff --git a/src/xenia/kernel/xbdm/xbdm_private.h b/src/xenia/kernel/xbdm/xbdm_private.h index 3f8619204..9c2e70515 100644 --- a/src/xenia/kernel/xbdm/xbdm_private.h +++ b/src/xenia/kernel/xbdm/xbdm_private.h @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * + * Copyright 2022 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -21,8 +21,11 @@ namespace xbdm { xe::cpu::Export* RegisterExport_xbdm(xe::cpu::Export* export_entry); // Registration functions, one per file. -void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state); +#define XE_MODULE_EXPORT_GROUP(m, n) \ + void Register##n##Exports(xe::cpu::ExportResolver* export_resolver, \ + KernelState* kernel_state); +#include "xbdm_module_export_groups.inc" +#undef XE_MODULE_EXPORT_GROUP } // namespace xbdm } // namespace kernel diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc index cbf7e3d64..3e9c39cbd 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio.cc @@ -96,11 +96,8 @@ dword_result_t XAudioSubmitRenderDriverFrame_entry(lpunknown_t driver_ptr, DECLARE_XBOXKRNL_EXPORT2(XAudioSubmitRenderDriverFrame, kAudio, kImplemented, kHighFrequency); -void RegisterAudioExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) { - // Additional XMA* methods are in xboxkrnl_audio_xma.cc. -} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Audio); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc index f0b264778..66e988ea0 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_audio_xma.cc @@ -392,9 +392,8 @@ dword_result_t XMABlockWhileInUse_entry(lpvoid_t context_ptr) { DECLARE_XBOXKRNL_EXPORT2(XMABlockWhileInUse, kAudio, kImplemented, kHighFrequency); -void RegisterAudioXmaExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(AudioXma); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc index 64961fb3a..6d98bc01d 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_crypt.cc @@ -686,9 +686,8 @@ dword_result_t XeKeysHmacShaUsingKey_entry(lpvoid_t obscured_key, } DECLARE_XBOXKRNL_EXPORT1(XeKeysHmacShaUsingKey, kNone, kImplemented); -void RegisterCryptExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Crypt); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc index 0eeb8f8f7..4470cd36e 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc @@ -154,9 +154,8 @@ DECLARE_XBOXKRNL_EXPORT2(KeBugCheckEx, kDebug, kStub, kImportant); void KeBugCheck_entry(dword_t code) { KeBugCheckEx_entry(code, 0, 0, 0, 0); } DECLARE_XBOXKRNL_EXPORT2(KeBugCheck, kDebug, kImplemented, kImportant); -void RegisterDebugExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Debug); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc index f1f9938d1..c3c9ddb11 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_error.cc @@ -1017,9 +1017,8 @@ dword_result_t RtlNtStatusToDosError_entry(dword_t source_status) { DECLARE_XBOXKRNL_EXPORT3(RtlNtStatusToDosError, kNone, kImportant, kHighFrequency, kLogResult); -void RegisterErrorExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Error); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc index 8cf3a1cbb..b173fd304 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_hal.cc @@ -31,9 +31,8 @@ void HalReturnToFirmware_entry(dword_t routine) { } DECLARE_XBOXKRNL_EXPORT2(HalReturnToFirmware, kNone, kStub, kImportant); -void RegisterHalExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Hal); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_hid.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_hid.cc index 0234ee062..15e60161e 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_hid.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_hid.cc @@ -32,9 +32,8 @@ dword_result_t HidReadKeys_entry(dword_t unk1, unknown_t unk2, unknown_t unk3) { } DECLARE_XBOXKRNL_EXPORT1(HidReadKeys, kInput, kStub); -void RegisterHidExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Hid); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc index 010dcf22b..2e2022bc6 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc @@ -735,9 +735,8 @@ dword_result_t IoCreateDevice_entry(dword_t device_struct, dword_t r4, } DECLARE_XBOXKRNL_EXPORT1(IoCreateDevice, kFileSystem, kStub); -void RegisterIoExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Io); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc index 2b9c9832b..1ace11c97 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc @@ -357,9 +357,8 @@ dword_result_t NtQueryVolumeInformationFile_entry( DECLARE_XBOXKRNL_EXPORT1(NtQueryVolumeInformationFile, kFileSystem, kImplemented); -void RegisterIoInfoExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(IoInfo); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc index 97c2875d7..7d72b3215 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc @@ -649,9 +649,8 @@ dword_result_t MmDeleteKernelStack_entry(lpvoid_t stack_base, } DECLARE_XBOXKRNL_EXPORT1(MmDeleteKernelStack, kMemory, kImplemented); -void RegisterMemoryExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel -} // namespace xe \ No newline at end of file +} // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Memory); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc index 9f80c9d6d..7a100665a 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_misc.cc @@ -23,9 +23,8 @@ void KeEnableFpuExceptions_entry(dword_t enabled) { } DECLARE_XBOXKRNL_EXPORT1(KeEnableFpuExceptions, kNone, kStub); -void RegisterMiscExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Misc); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc index f6b9846e0..f70f30bd0 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_module.cc @@ -83,25 +83,10 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) RegisterExportTable(export_resolver_); // Register all exported functions. - RegisterAudioExports(export_resolver_, kernel_state_); - RegisterAudioXmaExports(export_resolver_, kernel_state_); - RegisterCryptExports(export_resolver_, kernel_state_); - RegisterDebugExports(export_resolver_, kernel_state_); - RegisterErrorExports(export_resolver_, kernel_state_); - RegisterHalExports(export_resolver_, kernel_state_); - RegisterHidExports(export_resolver_, kernel_state_); - RegisterIoExports(export_resolver_, kernel_state_); - RegisterIoInfoExports(export_resolver_, kernel_state_); - RegisterMemoryExports(export_resolver_, kernel_state_); - RegisterMiscExports(export_resolver_, kernel_state_); - RegisterModuleExports(export_resolver_, kernel_state_); - RegisterObExports(export_resolver_, kernel_state_); - RegisterRtlExports(export_resolver_, kernel_state_); - RegisterStringExports(export_resolver_, kernel_state_); - RegisterThreadingExports(export_resolver_, kernel_state_); - RegisterUsbcamExports(export_resolver_, kernel_state_); - RegisterVideoExports(export_resolver_, kernel_state_); - RegisterXConfigExports(export_resolver_, kernel_state_); +#define XE_MODULE_EXPORT_GROUP(m, n) \ + Register##n##Exports(export_resolver_, kernel_state_); +#include "xboxkrnl_module_export_groups.inc" +#undef XE_MODULE_EXPORT_GROUP // KeDebugMonitorData (?*) // Set to a valid value when a remote debugger is attached. diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_module_export_groups.inc b/src/xenia/kernel/xboxkrnl/xboxkrnl_module_export_groups.inc new file mode 100644 index 000000000..2506c9004 --- /dev/null +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_module_export_groups.inc @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2022 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +// This is a partial file designed to be included by other files when +// constructing various tables. + +XE_MODULE_EXPORT_GROUP(xboxkrnl, Audio) +XE_MODULE_EXPORT_GROUP(xboxkrnl, AudioXma) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Crypt) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Debug) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Error) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Hal) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Hid) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Io) +XE_MODULE_EXPORT_GROUP(xboxkrnl, IoInfo) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Memory) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Misc) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Module) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Ob) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Rtl) +XE_MODULE_EXPORT_GROUP(xboxkrnl, String) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Threading) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Usbcam) +XE_MODULE_EXPORT_GROUP(xboxkrnl, Video) +XE_MODULE_EXPORT_GROUP(xboxkrnl, XConfig) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc index 02380283d..b17e4b2a2 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc @@ -199,9 +199,8 @@ void ExRegisterTitleTerminateNotification_entry( DECLARE_XBOXKRNL_EXPORT1(ExRegisterTitleTerminateNotification, kModules, kImplemented); -void RegisterModuleExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Module); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc index 1937d85af..1eec0e430 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_ob.cc @@ -201,9 +201,8 @@ dword_result_t NtClose_entry(dword_t handle) { } DECLARE_XBOXKRNL_EXPORT1(NtClose, kNone, kImplemented); -void RegisterObExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Ob); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_private.h b/src/xenia/kernel/xboxkrnl/xboxkrnl_private.h index d1f081518..379577176 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_private.h +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_private.h @@ -2,7 +2,7 @@ ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** - * Copyright 2020 Ben Vanik. All rights reserved. * + * Copyright 2022 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ @@ -21,29 +21,11 @@ namespace xboxkrnl { xe::cpu::Export* RegisterExport_xboxkrnl(xe::cpu::Export* export_entry); // Registration functions, one per file. -#define DECLARE_REGISTER_EXPORTS(n) \ +#define XE_MODULE_EXPORT_GROUP(m, n) \ void Register##n##Exports(xe::cpu::ExportResolver* export_resolver, \ - KernelState* kernel_state) -DECLARE_REGISTER_EXPORTS(Audio); -DECLARE_REGISTER_EXPORTS(AudioXma); -DECLARE_REGISTER_EXPORTS(Crypt); -DECLARE_REGISTER_EXPORTS(Debug); -DECLARE_REGISTER_EXPORTS(Error); -DECLARE_REGISTER_EXPORTS(Hal); -DECLARE_REGISTER_EXPORTS(Hid); -DECLARE_REGISTER_EXPORTS(Io); -DECLARE_REGISTER_EXPORTS(IoInfo); -DECLARE_REGISTER_EXPORTS(Memory); -DECLARE_REGISTER_EXPORTS(Misc); -DECLARE_REGISTER_EXPORTS(Module); -DECLARE_REGISTER_EXPORTS(Ob); -DECLARE_REGISTER_EXPORTS(Rtl); -DECLARE_REGISTER_EXPORTS(String); -DECLARE_REGISTER_EXPORTS(Threading); -DECLARE_REGISTER_EXPORTS(Usbcam); -DECLARE_REGISTER_EXPORTS(Video); -DECLARE_REGISTER_EXPORTS(XConfig); -#undef DECLARE_REGISTER_EXPORTS + KernelState* kernel_state); +#include "xboxkrnl_module_export_groups.inc" +#undef XE_MODULE_EXPORT_GROUP } // namespace xboxkrnl } // namespace kernel diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc index e23acb234..adb07c81b 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc @@ -624,9 +624,8 @@ dword_result_t RtlComputeCrc32_entry(dword_t seed, lpvoid_t buffer, } DECLARE_XBOXKRNL_EXPORT1(RtlComputeCrc32, kNone, kImplemented); -void RegisterRtlExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Rtl); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc index c2c968218..f913643eb 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc @@ -1383,9 +1383,8 @@ pointer_result_t InterlockedFlushSList_entry( } DECLARE_XBOXKRNL_EXPORT1(InterlockedFlushSList, kThreading, kImplemented); -void RegisterThreadingExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Threading); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc index 671c20105..2fc29e5ed 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_usbcam.cc @@ -37,9 +37,8 @@ dword_result_t XUsbcamGetState_entry() { } DECLARE_XBOXKRNL_EXPORT1(XUsbcamGetState, kNone, kStub); -void RegisterUsbcamExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(Usbcam); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc index afde2b82b..8c8b009c7 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_xconfig.cc @@ -138,9 +138,8 @@ dword_result_t ExGetXConfigSetting_entry(word_t category, word_t setting, } DECLARE_XBOXKRNL_EXPORT1(ExGetXConfigSetting, kModules, kImplemented); -void RegisterXConfigExports(xe::cpu::ExportResolver* export_resolver, - KernelState* kernel_state) {} - } // namespace xboxkrnl } // namespace kernel } // namespace xe + +DECLARE_XBOXKRNL_EMPTY_REGISTER_EXPORTS(XConfig);