Linux tweaks.

This commit is contained in:
Ben Vanik
2015-08-18 14:18:00 -07:00
parent 19299fad4b
commit 8b0d4fb51c
37 changed files with 200 additions and 111 deletions

View File

@@ -44,15 +44,9 @@ struct X_LDR_DATA_TABLE_ENTRY {
xe::be<uint32_t> time_date_stamp; // 0x50
xe::be<uint32_t> loaded_imports; // 0x54
xe::be<uint32_t> xex_header_base; // 0x58
union {
X_ANSI_STRING load_file_name; // 0x5C
struct {
xe::be<uint32_t> closure_root; // 0x5C
xe::be<uint32_t> traversal_parent; // 0x60
};
};
// X_ANSI_STRING load_file_name; // 0x5C
xe::be<uint32_t> closure_root; // 0x5C
xe::be<uint32_t> traversal_parent; // 0x60
};
class XModule : public XObject {

View File

@@ -189,7 +189,7 @@ class XThread : public XObject {
int32_t priority_ = 0;
uint32_t affinity_ = 0;
std::atomic<uint32_t> irql_ = 0;
std::atomic<uint32_t> irql_ = {0};
xe::mutex apc_lock_;
NativeList* apc_list_ = nullptr;
};

View File

@@ -405,7 +405,7 @@ struct xe_xex2_loader_info_t {
xe_xex2_media_flags media_flags;
};
enum xe_xex2_section_type : uint32_t {
enum xe_xex2_section_type {
XEX_SECTION_CODE = 1,
XEX_SECTION_DATA = 2,
XEX_SECTION_READONLY_DATA = 3,

View File

@@ -12,6 +12,7 @@
#include <algorithm>
#include <atomic>
#include <cstddef>
#include <string>
#include "xenia/base/threading.h"
@@ -162,10 +163,7 @@ class XObject {
int32_t as_type = -1);
template <typename T>
static object_ref<T> GetNativeObject(KernelState* kernel_state,
void* native_ptr, int32_t as_type = -1) {
return object_ref<T>(reinterpret_cast<T*>(
GetNativeObject(kernel_state, native_ptr, as_type).release()));
}
void* native_ptr, int32_t as_type = -1);
virtual xe::threading::WaitHandle* GetWaitHandle() { return nullptr; }
@@ -208,9 +206,9 @@ template <typename T>
class object_ref {
public:
object_ref() noexcept : value_(nullptr) {}
object_ref(nullptr_t) noexcept // NOLINT(runtime/explicit)
object_ref(std::nullptr_t) noexcept // NOLINT(runtime/explicit)
: value_(nullptr) {}
object_ref& operator=(nullptr_t) noexcept {
object_ref& operator=(std::nullptr_t) noexcept {
reset();
return (*this);
}
@@ -250,9 +248,7 @@ class object_ref {
return (*this);
}
void swap(object_ref& right) noexcept {
std::_Swap_adl(value_, right.value_);
}
void swap(object_ref& right) noexcept { std::swap(value_, right.value_); }
~object_ref() noexcept {
if (value_) {
@@ -298,22 +294,22 @@ class object_ref {
};
template <class _Ty>
bool operator==(const object_ref<_Ty>& _Left, nullptr_t) noexcept {
bool operator==(const object_ref<_Ty>& _Left, std::nullptr_t) noexcept {
return (_Left.get() == reinterpret_cast<_Ty*>(0));
}
template <class _Ty>
bool operator==(nullptr_t, const object_ref<_Ty>& _Right) noexcept {
bool operator==(std::nullptr_t, const object_ref<_Ty>& _Right) noexcept {
return (reinterpret_cast<_Ty*>(0) == _Right.get());
}
template <class _Ty>
bool operator!=(const object_ref<_Ty>& _Left, nullptr_t _Right) noexcept {
bool operator!=(const object_ref<_Ty>& _Left, std::nullptr_t _Right) noexcept {
return (!(_Left == _Right));
}
template <class _Ty>
bool operator!=(nullptr_t _Left, const object_ref<_Ty>& _Right) noexcept {
bool operator!=(std::nullptr_t _Left, const object_ref<_Ty>& _Right) noexcept {
return (!(_Left == _Right));
}
@@ -323,6 +319,13 @@ object_ref<T> retain_object(T* ptr) {
return object_ref<T>(ptr);
}
template <typename T>
object_ref<T> XObject::GetNativeObject(KernelState* kernel_state,
void* native_ptr, int32_t as_type) {
return object_ref<T>(reinterpret_cast<T*>(
GetNativeObject(kernel_state, native_ptr, as_type).release()));
}
} // namespace kernel
} // namespace xe