Cleaning up kernel namespaces.

This commit is contained in:
Ben Vanik 2014-08-16 00:25:13 -07:00
parent bf48e9fbbd
commit c84fcc70a4
31 changed files with 76 additions and 174 deletions

View File

@ -13,9 +13,8 @@
#include <xenia/kernel/objects/xevent.h> #include <xenia/kernel/objects/xevent.h>
using namespace std; namespace xe {
using namespace xe; namespace kernel {
using namespace xe::kernel;
XAsyncRequest::XAsyncRequest( XAsyncRequest::XAsyncRequest(
@ -28,8 +27,7 @@ XAsyncRequest::XAsyncRequest(
} }
XAsyncRequest::~XAsyncRequest() { XAsyncRequest::~XAsyncRequest() {
for (vector<XEvent*>::iterator it = wait_events_.begin(); for (auto it = wait_events_.begin(); it != wait_events_.end(); ++it) {
it != wait_events_.end(); ++it) {
(*it)->Release(); (*it)->Release();
} }
object_->Release(); object_->Release();
@ -39,3 +37,6 @@ void XAsyncRequest::AddWaitEvent(XEvent* ev) {
ev->Retain(); ev->Retain();
wait_events_.push_back(ev); wait_events_.push_back(ev);
} }
} // namespace kernel
} // namespace xe

View File

@ -13,8 +13,8 @@
#include <xenia/kernel/native_list.h> #include <xenia/kernel/native_list.h>
using namespace xe; namespace xe {
using namespace xe::kernel; namespace kernel {
Dispatcher::Dispatcher(KernelState* kernel_state) : Dispatcher::Dispatcher(KernelState* kernel_state) :
@ -35,3 +35,6 @@ void Dispatcher::Lock() {
void Dispatcher::Unlock() { void Dispatcher::Unlock() {
xe_mutex_unlock(lock_); xe_mutex_unlock(lock_);
} }
} // namespace kernel
} // namespace xe

View File

@ -23,18 +23,15 @@
#include <xenia/kernel/objects/xuser_module.h> #include <xenia/kernel/objects/xuser_module.h>
using namespace xe; namespace xe {
using namespace xe::kernel; namespace kernel {
// This is a global object initialized with the XboxkrnlModule. // This is a global object initialized with the XboxkrnlModule.
// It references the current kernel state object that all kernel methods should // It references the current kernel state object that all kernel methods should
// be using to stash their variables. // be using to stash their variables.
namespace xe {
namespace kernel {
KernelState* shared_kernel_state_ = nullptr; KernelState* shared_kernel_state_ = nullptr;
} // namespace kernel
} // namespace xe
KernelState::KernelState(Emulator* emulator) : KernelState::KernelState(Emulator* emulator) :
emulator_(emulator), memory_(emulator->memory()), emulator_(emulator), memory_(emulator->memory()),
@ -213,3 +210,6 @@ void KernelState::CompleteOverlappedImmediate(uint32_t overlapped_ptr, X_RESULT
XThread::GetCurrentThreadHandle()); XThread::GetCurrentThreadHandle());
CompleteOverlapped(overlapped_ptr, result, length); CompleteOverlapped(overlapped_ptr, result, length);
} }
} // namespace kernel
} // namespace xe

View File

@ -10,8 +10,8 @@
#include <xenia/kernel/native_list.h> #include <xenia/kernel/native_list.h>
using namespace xe; namespace xe {
using namespace xe::kernel; namespace kernel {
NativeList::NativeList(Memory* memory) : NativeList::NativeList(Memory* memory) :
@ -70,3 +70,6 @@ uint32_t NativeList::Shift() {
bool NativeList::HasPending() { bool NativeList::HasPending() {
return head_ != kInvalidPointer; return head_ != kInvalidPointer;
} }
} // namespace kernel
} // namespace xe

View File

@ -13,8 +13,8 @@
#include <xenia/kernel/objects/xthread.h> #include <xenia/kernel/objects/xthread.h>
using namespace xe; namespace xe {
using namespace xe::kernel; namespace kernel {
ObjectTable::ObjectTable() : ObjectTable::ObjectTable() :
@ -206,3 +206,6 @@ X_HANDLE ObjectTable::TranslateHandle(X_HANDLE handle) {
return handle; return handle;
} }
} }
} // namespace kernel
} // namespace xe

View File

@ -15,11 +15,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -17,11 +17,6 @@
#include <xenia/kernel/util/xex2.h> #include <xenia/kernel/util/xex2.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -17,15 +17,11 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::hid;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {
using xe::hid::InputSystem;
SHIM_CALL XamResetInactivity_shim( SHIM_CALL XamResetInactivity_shim(
PPCContext* ppc_state, KernelState* state) { PPCContext* ppc_state, KernelState* state) {

View File

@ -14,9 +14,8 @@
#include <xenia/kernel/xam_private.h> #include <xenia/kernel/xam_private.h>
using namespace xe; namespace xe {
using namespace xe::kernel; namespace kernel {
using namespace xe::kernel::xam;
XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) : XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) :
@ -31,17 +30,20 @@ XamModule::XamModule(Emulator* emulator, KernelState* kernel_state) :
"xam.xex", xam_export_table, XECOUNT(xam_export_table)); "xam.xex", xam_export_table, XECOUNT(xam_export_table));
// Register all exported functions. // Register all exported functions.
RegisterContentExports(export_resolver_, kernel_state); xam::RegisterContentExports(export_resolver_, kernel_state);
RegisterInfoExports(export_resolver_, kernel_state); xam::RegisterInfoExports(export_resolver_, kernel_state);
RegisterInputExports(export_resolver_, kernel_state); xam::RegisterInputExports(export_resolver_, kernel_state);
RegisterMsgExports(export_resolver_, kernel_state); xam::RegisterMsgExports(export_resolver_, kernel_state);
RegisterNetExports(export_resolver_, kernel_state); xam::RegisterNetExports(export_resolver_, kernel_state);
RegisterNotifyExports(export_resolver_, kernel_state); xam::RegisterNotifyExports(export_resolver_, kernel_state);
RegisterUIExports(export_resolver_, kernel_state); xam::RegisterUIExports(export_resolver_, kernel_state);
RegisterUserExports(export_resolver_, kernel_state); xam::RegisterUserExports(export_resolver_, kernel_state);
RegisterVideoExports(export_resolver_, kernel_state); xam::RegisterVideoExports(export_resolver_, kernel_state);
RegisterVoiceExports(export_resolver_, kernel_state); xam::RegisterVoiceExports(export_resolver_, kernel_state);
} }
XamModule::~XamModule() { XamModule::~XamModule() {
} }
} // namespace kernel
} // namespace xe

View File

@ -16,11 +16,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -17,11 +17,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -16,11 +16,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -15,11 +15,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -17,11 +17,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -15,11 +15,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -16,12 +16,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::hid;
using namespace xe::kernel;
using namespace xe::kernel::xam;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -17,12 +17,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::apu;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -16,11 +16,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -15,11 +15,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -18,14 +18,11 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::fs;
namespace xe { namespace xe {
namespace kernel { namespace kernel {
using namespace xe::kernel::fs;
SHIM_CALL NtCreateFile_shim( SHIM_CALL NtCreateFile_shim(
PPCContext* ppc_state, KernelState* state) { PPCContext* ppc_state, KernelState* state) {

View File

@ -15,12 +15,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace alloy;
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {
@ -268,7 +262,7 @@ SHIM_CALL MmAllocatePhysicalMemoryEx_shim(
assert_true(max_addr_range == 0xFFFFFFFF); assert_true(max_addr_range == 0xFFFFFFFF);
// Allocate. // Allocate.
uint32_t flags = MEMORY_FLAG_PHYSICAL; uint32_t flags = alloy::MEMORY_FLAG_PHYSICAL;
uint32_t base_address = (uint32_t)state->memory()->HeapAlloc( uint32_t base_address = (uint32_t)state->memory()->HeapAlloc(
0, adjusted_size, flags, adjusted_alignment); 0, adjusted_size, flags, adjusted_alignment);
if (!base_address) { if (!base_address) {
@ -445,7 +439,7 @@ SHIM_CALL ExAllocatePoolTypeWithTag_shim(
} }
uint32_t addr = (uint32_t)state->memory()->HeapAlloc( uint32_t addr = (uint32_t)state->memory()->HeapAlloc(
0, adjusted_size, MEMORY_FLAG_ZERO, alignment); 0, adjusted_size, alloy::MEMORY_FLAG_ZERO, alignment);
SHIM_SET_RETURN_32(addr); SHIM_SET_RETURN_32(addr);
} }

View File

@ -16,11 +16,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -18,15 +18,14 @@
#include <xenia/kernel/objects/xuser_module.h> #include <xenia/kernel/objects/xuser_module.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
DEFINE_bool(abort_before_entry, false, DEFINE_bool(abort_before_entry, false,
"Abort execution right before launching the module."); "Abort execution right before launching the module.");
namespace xe {
namespace kernel {
XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) : XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) :
XKernelModule(kernel_state, "xe:\\xboxkrnl.exe") { XKernelModule(kernel_state, "xe:\\xboxkrnl.exe") {
// Build the export table used for resolution. // Build the export table used for resolution.
@ -39,19 +38,19 @@ XboxkrnlModule::XboxkrnlModule(Emulator* emulator, KernelState* kernel_state) :
"xboxkrnl.exe", xboxkrnl_export_table, XECOUNT(xboxkrnl_export_table)); "xboxkrnl.exe", xboxkrnl_export_table, XECOUNT(xboxkrnl_export_table));
// Register all exported functions. // Register all exported functions.
RegisterAudioExports(export_resolver_, kernel_state); xboxkrnl::RegisterAudioExports(export_resolver_, kernel_state);
RegisterDebugExports(export_resolver_, kernel_state); xboxkrnl::RegisterDebugExports(export_resolver_, kernel_state);
RegisterHalExports(export_resolver_, kernel_state); xboxkrnl::RegisterHalExports(export_resolver_, kernel_state);
RegisterIoExports(export_resolver_, kernel_state); xboxkrnl::RegisterIoExports(export_resolver_, kernel_state);
RegisterMemoryExports(export_resolver_, kernel_state); xboxkrnl::RegisterMemoryExports(export_resolver_, kernel_state);
RegisterMiscExports(export_resolver_, kernel_state); xboxkrnl::RegisterMiscExports(export_resolver_, kernel_state);
RegisterModuleExports(export_resolver_, kernel_state); xboxkrnl::RegisterModuleExports(export_resolver_, kernel_state);
RegisterObExports(export_resolver_, kernel_state); xboxkrnl::RegisterObExports(export_resolver_, kernel_state);
RegisterRtlExports(export_resolver_, kernel_state_); xboxkrnl::RegisterRtlExports(export_resolver_, kernel_state_);
RegisterStringExports(export_resolver_, kernel_state_); xboxkrnl::RegisterStringExports(export_resolver_, kernel_state_);
RegisterThreadingExports(export_resolver_, kernel_state); xboxkrnl::RegisterThreadingExports(export_resolver_, kernel_state);
RegisterUsbcamExports(export_resolver_, kernel_state); xboxkrnl::RegisterUsbcamExports(export_resolver_, kernel_state);
RegisterVideoExports(export_resolver_, kernel_state); xboxkrnl::RegisterVideoExports(export_resolver_, kernel_state);
uint8_t* mem = memory_->membase(); uint8_t* mem = memory_->membase();
@ -177,3 +176,6 @@ int XboxkrnlModule::LaunchModule(const char* path) {
return 0; return 0;
} }
} // namespace kernel
} // namespace xe

View File

@ -17,11 +17,6 @@
#include <xenia/kernel/util/xex2.h> #include <xenia/kernel/util/xex2.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -17,11 +17,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -18,11 +18,6 @@
#include <xenia/kernel/util/xex2.h> #include <xenia/kernel/util/xex2.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -18,11 +18,6 @@
#include <xenia/kernel/util/xex2.h> #include <xenia/kernel/util/xex2.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -23,11 +23,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -15,11 +15,6 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {

View File

@ -20,15 +20,11 @@
#include <xenia/kernel/util/shim_utils.h> #include <xenia/kernel/util/shim_utils.h>
using namespace xe;
using namespace xe::gpu;
using namespace xe::kernel;
using namespace xe::kernel::xboxkrnl;
namespace xe { namespace xe {
namespace kernel { namespace kernel {
using xe::gpu::GraphicsSystem;
// http://www.tweakoz.com/orkid/ // http://www.tweakoz.com/orkid/
// http://www.tweakoz.com/orkid/dox/d3/d52/xb360init_8cpp_source.html // http://www.tweakoz.com/orkid/dox/d3/d52/xb360init_8cpp_source.html
@ -376,7 +372,7 @@ SHIM_CALL VdSwap_shim(
auto dwords = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(unk0)); auto dwords = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(unk0));
dwords[0] = poly::byte_swap((0x03 << 30) | dwords[0] = poly::byte_swap((0x03 << 30) |
((1 - 1) << 16) | ((1 - 1) << 16) |
(xenos::PM4_XE_SWAP << 8)); (xe::gpu::xenos::PM4_XE_SWAP << 8));
SHIM_SET_RETURN_64(0); SHIM_SET_RETURN_64(0);
} }

View File

@ -15,9 +15,8 @@
#include <xenia/kernel/objects/xsemaphore.h> #include <xenia/kernel/objects/xsemaphore.h>
using namespace xe; namespace xe {
using namespace xe::kernel; namespace kernel {
using namespace xe::kernel::xboxkrnl;
XObject::XObject(KernelState* kernel_state, Type type) : XObject::XObject(KernelState* kernel_state, Type type) :
@ -267,3 +266,6 @@ XObject* XObject::GetObject(KernelState* kernel_state, void* native_ptr,
return object; return object;
} }
} }
} // namespace kernel
} // namespace xe