Header cleanups and prep.

This commit is contained in:
Ben Vanik 2015-05-24 20:11:19 -07:00
parent 8ac1f61c64
commit 1104f8e687
13 changed files with 34 additions and 18 deletions

View File

@ -125,7 +125,7 @@ bool XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
kernel_export =
export_resolver->GetExportByOrdinal(library->name, info->ordinal);
} else {
XModule* module = kernel_state_->GetModule(library->name);
auto module = kernel_state_->GetModule(library->name);
if (module) {
user_export_addr = module->GetProcAddressByOrdinal(info->ordinal);
}

View File

@ -25,6 +25,7 @@
#include "xenia/gpu/register_file.h"
#include "xenia/gpu/tracing.h"
#include "xenia/gpu/xenos.h"
#include "xenia/kernel/objects/xthread.h"
#include "xenia/memory.h"
namespace xe {

View File

@ -12,6 +12,7 @@
#include <string>
#include "xenia/base/fs.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xobject.h"
namespace xe {

View File

@ -14,13 +14,13 @@
#include <string>
#include <unordered_map>
#include "xenia/base/mutex.h"
#include "xenia/kernel/xobject.h"
#include "xenia/xbox.h"
namespace xe {
namespace kernel {
class XObject;
class ObjectTable {
public:
ObjectTable();

View File

@ -10,6 +10,8 @@
#ifndef XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
#define XENIA_KERNEL_XBOXKRNL_XENUMERATOR_H_
#include <vector>
#include "xenia/kernel/xobject.h"
#include "xenia/xbox.h"

View File

@ -10,6 +10,7 @@
#ifndef XENIA_KERNEL_XBOXKRNL_XFILE_H_
#define XENIA_KERNEL_XBOXKRNL_XFILE_H_
#include "xenia/kernel/fs/entry.h"
#include "xenia/kernel/xobject.h"
#include "xenia/xbox.h"

View File

@ -10,6 +10,7 @@
#include "xenia/kernel/objects/xmodule.h"
#include "xenia/base/string.h"
#include "xenia/kernel/kernel_state.h"
namespace xe {
namespace kernel {

View File

@ -9,6 +9,8 @@
#include "xenia/kernel/objects/xnotify_listener.h"
#include "xenia/kernel/kernel_state.h"
namespace xe {
namespace kernel {

View File

@ -11,6 +11,7 @@
#define XENIA_KERNEL_XBOXKRNL_XNOTIFY_LISTENER_H_
#include <mutex>
#include <unordered_map>
#include "xenia/kernel/xobject.h"
#include "xenia/xbox.h"

View File

@ -9,10 +9,13 @@
#include "xenia/kernel/objects/xthread.h"
#include <gflags/gflags.h>
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/base/threading.h"
#include "xenia/cpu/cpu.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/native_list.h"
#include "xenia/kernel/objects/xevent.h"
#include "xenia/kernel/objects/xuser_module.h"
@ -153,7 +156,7 @@ X_STATUS XThread::Create() {
// Set native info.
SetNativePointer(thread_state_address_, true);
XUserModule* module = kernel_state()->GetExecutableModule();
auto module = kernel_state()->GetExecutableModule();
// Allocate thread scratch.
// This is used by interrupts/APCs/etc so we can round-trip pointers through.

View File

@ -51,9 +51,6 @@ X_STATUS XUserModule::LoadFromFile(std::string path) {
// Map.
auto mmap = fs_entry->CreateMemoryMapping(fs::Mode::READ, 0, 0);
if (!mmap) {
if (file) {
file->Release();
}
return result;
}
@ -63,9 +60,6 @@ X_STATUS XUserModule::LoadFromFile(std::string path) {
X_FILE_NETWORK_OPEN_INFORMATION file_info;
result = fs_entry->QueryInfo(&file_info);
if (result) {
if (file) {
file->Release();
}
return result;
}
@ -367,8 +361,7 @@ void XUserModule::Dump() {
unimpl_count++;
}
} else {
// User module
XModule* module = kernel_state_->GetModule(library->name);
auto module = kernel_state_->GetModule(library->name);
if (module) {
uint32_t export_addr =
module->GetProcAddressByOrdinal(info->ordinal);
@ -409,7 +402,7 @@ void XUserModule::Dump() {
implemented = kernel_export->is_implemented;
}
} else {
XModule* module = kernel_state_->GetModule(library->name);
auto module = kernel_state_->GetModule(library->name);
if (module && module->GetProcAddressByOrdinal(info->ordinal)) {
// TODO: Name lookup
implemented = true;

View File

@ -9,10 +9,11 @@
#include "xenia/kernel/xobject.h"
#include "xenia/kernel/xboxkrnl_private.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/objects/xevent.h"
#include "xenia/kernel/objects/xmutant.h"
#include "xenia/kernel/objects/xsemaphore.h"
#include "xenia/kernel/xboxkrnl_private.h"
namespace xe {
namespace kernel {
@ -34,6 +35,10 @@ XObject::~XObject() {
assert_zero(pointer_ref_count_);
}
Emulator* XObject::emulator() const { return kernel_state_->emulator_; }
KernelState* XObject::kernel_state() const { return kernel_state_; }
Memory* XObject::memory() const { return kernel_state_->memory(); }
XObject::Type XObject::type() { return type_; }
X_HANDLE XObject::handle() const { return handle_; }

View File

@ -12,12 +12,18 @@
#include <atomic>
#include "xenia/kernel/kernel_state.h"
#include "xenia/xbox.h"
namespace xe {
class Emulator;
class Memory;
} // namespace xe
namespace xe {
namespace kernel {
class KernelState;
// http://www.nirsoft.net/kernel_struct/vista/DISPATCHER_HEADER.html
typedef struct {
xe::be<uint32_t> type_flags;
@ -43,9 +49,9 @@ class XObject {
XObject(KernelState* kernel_state, Type type);
virtual ~XObject();
Emulator* emulator() const { return kernel_state_->emulator_; }
KernelState* kernel_state() const { return kernel_state_; }
Memory* memory() const { return kernel_state_->memory(); }
Emulator* emulator() const;
KernelState* kernel_state() const;
Memory* memory() const;
Type type();
X_HANDLE handle() const;