[Kernel] Scope object type enum.
This commit is contained in:
parent
bdeae25353
commit
164aa8e8ca
|
@ -1454,7 +1454,7 @@ void DebugWindow::UpdateCache() {
|
||||||
// Fetch module listing.
|
// Fetch module listing.
|
||||||
// We hold refs so that none are unloaded.
|
// We hold refs so that none are unloaded.
|
||||||
cache_.modules =
|
cache_.modules =
|
||||||
object_table->GetObjectsByType<XModule>(XObject::Type::kTypeModule);
|
object_table->GetObjectsByType<XModule>(XObject::Type::Module);
|
||||||
|
|
||||||
cache_.thread_debug_infos = processor_->QueryThreadDebugInfos();
|
cache_.thread_debug_infos = processor_->QueryThreadDebugInfos();
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ void Emulator::Pause() {
|
||||||
auto lock = global_critical_region::AcquireDirect();
|
auto lock = global_critical_region::AcquireDirect();
|
||||||
auto threads =
|
auto threads =
|
||||||
kernel_state()->object_table()->GetObjectsByType<kernel::XThread>(
|
kernel_state()->object_table()->GetObjectsByType<kernel::XThread>(
|
||||||
kernel::XObject::kTypeThread);
|
kernel::XObject::Type::Thread);
|
||||||
auto current_thread = kernel::XThread::IsInThread()
|
auto current_thread = kernel::XThread::IsInThread()
|
||||||
? kernel::XThread::GetCurrentThread()
|
? kernel::XThread::GetCurrentThread()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
@ -388,7 +388,7 @@ void Emulator::Resume() {
|
||||||
|
|
||||||
auto threads =
|
auto threads =
|
||||||
kernel_state()->object_table()->GetObjectsByType<kernel::XThread>(
|
kernel_state()->object_table()->GetObjectsByType<kernel::XThread>(
|
||||||
kernel::XObject::kTypeThread);
|
kernel::XObject::Type::Thread);
|
||||||
for (auto thread : threads) {
|
for (auto thread : threads) {
|
||||||
if (!thread->can_debugger_suspend()) {
|
if (!thread->can_debugger_suspend()) {
|
||||||
// Don't pause host threads.
|
// Don't pause host threads.
|
||||||
|
|
|
@ -763,13 +763,13 @@ bool KernelState::Save(ByteStream* stream) {
|
||||||
for (auto object : objects) {
|
for (auto object : objects) {
|
||||||
auto prev_offset = stream->offset();
|
auto prev_offset = stream->offset();
|
||||||
|
|
||||||
if (object->is_host_object() || object->type() == XObject::kTypeThread) {
|
if (object->is_host_object() || object->type() == XObject::Type::Thread) {
|
||||||
// Don't save host objects or save XThreads again
|
// Don't save host objects or save XThreads again
|
||||||
num_objects--;
|
num_objects--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream->Write<uint32_t>(object->type());
|
stream->Write<uint32_t>(static_cast<uint32_t>(object->type()));
|
||||||
if (!object->Save(stream)) {
|
if (!object->Save(stream)) {
|
||||||
XELOGD("Did not save object of type {}", object->type());
|
XELOGD("Did not save object of type {}", object->type());
|
||||||
assert_always();
|
assert_always();
|
||||||
|
@ -804,7 +804,7 @@ bool KernelState::Restore(ByteStream* stream) {
|
||||||
uint32_t num_threads = stream->Read<uint32_t>();
|
uint32_t num_threads = stream->Read<uint32_t>();
|
||||||
XELOGD("Loading {} threads...", num_threads);
|
XELOGD("Loading {} threads...", num_threads);
|
||||||
for (uint32_t i = 0; i < num_threads; i++) {
|
for (uint32_t i = 0; i < num_threads; i++) {
|
||||||
auto thread = XObject::Restore(this, XObject::kTypeThread, stream);
|
auto thread = XObject::Restore(this, XObject::Type::Thread, stream);
|
||||||
if (!thread) {
|
if (!thread) {
|
||||||
// Can't continue the restore or we risk misalignment.
|
// Can't continue the restore or we risk misalignment.
|
||||||
assert_always();
|
assert_always();
|
||||||
|
|
|
@ -51,7 +51,7 @@ class ObjectTable {
|
||||||
object_ref<T> LookupObject(X_HANDLE handle) {
|
object_ref<T> LookupObject(X_HANDLE handle) {
|
||||||
auto object = LookupObject(handle, false);
|
auto object = LookupObject(handle, false);
|
||||||
if (object) {
|
if (object) {
|
||||||
assert_true(object->type() == T::kType);
|
assert_true(object->type() == T::kObjectType);
|
||||||
}
|
}
|
||||||
auto result = object_ref<T>(reinterpret_cast<T*>(object));
|
auto result = object_ref<T>(reinterpret_cast<T*>(object));
|
||||||
return result;
|
return result;
|
||||||
|
@ -72,7 +72,7 @@ class ObjectTable {
|
||||||
std::vector<object_ref<T>> GetObjectsByType() {
|
std::vector<object_ref<T>> GetObjectsByType() {
|
||||||
std::vector<object_ref<T>> results;
|
std::vector<object_ref<T>> results;
|
||||||
GetObjectsByType(
|
GetObjectsByType(
|
||||||
T::kType,
|
T::kObjectType,
|
||||||
reinterpret_cast<std::vector<object_ref<XObject>>*>(&results));
|
reinterpret_cast<std::vector<object_ref<XObject>>*>(&results));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ dword_result_t NtCreateFile(lpdword_t handle_out, dword_t desired_access,
|
||||||
auto root_file = kernel_state()->object_table()->LookupObject<XFile>(
|
auto root_file = kernel_state()->object_table()->LookupObject<XFile>(
|
||||||
object_attrs->root_directory);
|
object_attrs->root_directory);
|
||||||
assert_not_null(root_file);
|
assert_not_null(root_file);
|
||||||
assert_true(root_file->type() == XObject::Type::kTypeFile);
|
assert_true(root_file->type() == XObject::Type::File);
|
||||||
|
|
||||||
root_entry = root_file->entry();
|
root_entry = root_file->entry();
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ dword_result_t NtQueryFullAttributesFile(
|
||||||
root_file = kernel_state()->object_table()->LookupObject<XFile>(
|
root_file = kernel_state()->object_table()->LookupObject<XFile>(
|
||||||
obj_attribs->root_directory);
|
obj_attribs->root_directory);
|
||||||
assert_not_null(root_file);
|
assert_not_null(root_file);
|
||||||
assert_true(root_file->type() == XObject::Type::kTypeFile);
|
assert_true(root_file->type() == XObject::Type::File);
|
||||||
assert_always();
|
assert_always();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,22 +78,21 @@ DECLARE_XBOXKRNL_EXPORT1(ObLookupThreadByThreadId, kNone, kImplemented);
|
||||||
dword_result_t ObReferenceObjectByHandle(dword_t handle,
|
dword_result_t ObReferenceObjectByHandle(dword_t handle,
|
||||||
dword_t object_type_ptr,
|
dword_t object_type_ptr,
|
||||||
lpdword_t out_object_ptr) {
|
lpdword_t out_object_ptr) {
|
||||||
const static std::unordered_map<XObject::Type, uint32_t> obj_type_match = {
|
// These values come from how Xenia handles uninitialized kernel data exports.
|
||||||
{XObject::kTypeEvent, 0xD00EBEEF},
|
// D###BEEF where ### is the ordinal.
|
||||||
{XObject::kTypeSemaphore, 0xD017BEEF},
|
const static std::unordered_map<XObject::Type, uint32_t> object_types = {
|
||||||
{XObject::kTypeThread, 0xD01BBEEF}};
|
{XObject::Type::Event, 0xD00EBEEF},
|
||||||
|
{XObject::Type::Semaphore, 0xD017BEEF},
|
||||||
|
{XObject::Type::Thread, 0xD01BBEEF}};
|
||||||
auto object = kernel_state()->object_table()->LookupObject<XObject>(handle);
|
auto object = kernel_state()->object_table()->LookupObject<XObject>(handle);
|
||||||
|
|
||||||
if (!object) {
|
if (!object) {
|
||||||
return X_STATUS_INVALID_HANDLE;
|
return X_STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t native_ptr = object->guest_object();
|
uint32_t native_ptr = object->guest_object();
|
||||||
auto obj_type = obj_type_match.find(object->type());
|
auto object_type = object_types.find(object->type());
|
||||||
|
if (object_type != object_types.end()) {
|
||||||
if (obj_type != obj_type_match.end()) {
|
if (object_type_ptr && object_type_ptr != object_type->second) {
|
||||||
if (object_type_ptr && object_type_ptr != obj_type->second) {
|
|
||||||
return X_STATUS_OBJECT_TYPE_MISMATCH;
|
return X_STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -432,7 +432,7 @@ dword_result_t NtCreateEvent(lpdword_t handle_ptr,
|
||||||
auto existing_object =
|
auto existing_object =
|
||||||
LookupNamedObject<XEvent>(kernel_state(), obj_attributes_ptr);
|
LookupNamedObject<XEvent>(kernel_state(), obj_attributes_ptr);
|
||||||
if (existing_object) {
|
if (existing_object) {
|
||||||
if (existing_object->type() == XObject::kTypeEvent) {
|
if (existing_object->type() == XObject::Type::Event) {
|
||||||
if (handle_ptr) {
|
if (handle_ptr) {
|
||||||
existing_object->RetainHandle();
|
existing_object->RetainHandle();
|
||||||
*handle_ptr = existing_object->handle();
|
*handle_ptr = existing_object->handle();
|
||||||
|
@ -559,7 +559,7 @@ dword_result_t NtCreateSemaphore(lpdword_t handle_ptr,
|
||||||
auto existing_object =
|
auto existing_object =
|
||||||
LookupNamedObject<XSemaphore>(kernel_state(), obj_attributes_ptr);
|
LookupNamedObject<XSemaphore>(kernel_state(), obj_attributes_ptr);
|
||||||
if (existing_object) {
|
if (existing_object) {
|
||||||
if (existing_object->type() == XObject::kTypeSemaphore) {
|
if (existing_object->type() == XObject::Type::Semaphore) {
|
||||||
if (handle_ptr) {
|
if (handle_ptr) {
|
||||||
existing_object->RetainHandle();
|
existing_object->RetainHandle();
|
||||||
*handle_ptr = existing_object->handle();
|
*handle_ptr = existing_object->handle();
|
||||||
|
@ -613,7 +613,7 @@ dword_result_t NtCreateMutant(lpdword_t handle_out,
|
||||||
auto existing_object = LookupNamedObject<XMutant>(
|
auto existing_object = LookupNamedObject<XMutant>(
|
||||||
kernel_state(), obj_attributes.guest_address());
|
kernel_state(), obj_attributes.guest_address());
|
||||||
if (existing_object) {
|
if (existing_object) {
|
||||||
if (existing_object->type() == XObject::kTypeMutant) {
|
if (existing_object->type() == XObject::Type::Mutant) {
|
||||||
if (handle_out) {
|
if (handle_out) {
|
||||||
existing_object->RetainHandle();
|
existing_object->RetainHandle();
|
||||||
*handle_out = existing_object->handle();
|
*handle_out = existing_object->handle();
|
||||||
|
@ -674,7 +674,7 @@ dword_result_t NtCreateTimer(lpdword_t handle_ptr, lpvoid_t obj_attributes_ptr,
|
||||||
auto existing_object =
|
auto existing_object =
|
||||||
LookupNamedObject<XTimer>(kernel_state(), obj_attributes_ptr);
|
LookupNamedObject<XTimer>(kernel_state(), obj_attributes_ptr);
|
||||||
if (existing_object) {
|
if (existing_object) {
|
||||||
if (existing_object->type() == XObject::kTypeTimer) {
|
if (existing_object->type() == XObject::Type::Timer) {
|
||||||
if (handle_ptr) {
|
if (handle_ptr) {
|
||||||
existing_object->RetainHandle();
|
existing_object->RetainHandle();
|
||||||
*handle_ptr = existing_object->handle();
|
*handle_ptr = existing_object->handle();
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace kernel {
|
||||||
|
|
||||||
XEnumerator::XEnumerator(KernelState* kernel_state, size_t items_per_enumerate,
|
XEnumerator::XEnumerator(KernelState* kernel_state, size_t items_per_enumerate,
|
||||||
size_t item_size)
|
size_t item_size)
|
||||||
: XObject(kernel_state, kType),
|
: XObject(kernel_state, kObjectType),
|
||||||
items_per_enumerate_(items_per_enumerate),
|
items_per_enumerate_(items_per_enumerate),
|
||||||
item_size_(item_size) {}
|
item_size_(item_size) {}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace kernel {
|
||||||
|
|
||||||
class XEnumerator : public XObject {
|
class XEnumerator : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeEnumerator;
|
static const XObject::Type kObjectType = XObject::Type::Enumerator;
|
||||||
|
|
||||||
XEnumerator(KernelState* kernel_state, size_t items_per_enumerate,
|
XEnumerator(KernelState* kernel_state, size_t items_per_enumerate,
|
||||||
size_t item_size);
|
size_t item_size);
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XEvent::XEvent(KernelState* kernel_state) : XObject(kernel_state, kType) {}
|
XEvent::XEvent(KernelState* kernel_state)
|
||||||
|
: XObject(kernel_state, kObjectType) {}
|
||||||
|
|
||||||
XEvent::~XEvent() = default;
|
XEvent::~XEvent() = default;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ static_assert_size(X_KEVENT, 0x10);
|
||||||
|
|
||||||
class XEvent : public XObject {
|
class XEvent : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeEvent;
|
static const XObject::Type kObjectType = XObject::Type::Event;
|
||||||
|
|
||||||
explicit XEvent(KernelState* kernel_state);
|
explicit XEvent(KernelState* kernel_state);
|
||||||
~XEvent() override;
|
~XEvent() override;
|
||||||
|
|
|
@ -22,11 +22,13 @@ namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XFile::XFile(KernelState* kernel_state, vfs::File* file, bool synchronous)
|
XFile::XFile(KernelState* kernel_state, vfs::File* file, bool synchronous)
|
||||||
: XObject(kernel_state, kType), file_(file), is_synchronous_(synchronous) {
|
: XObject(kernel_state, kObjectType),
|
||||||
|
file_(file),
|
||||||
|
is_synchronous_(synchronous) {
|
||||||
async_event_ = threading::Event::CreateAutoResetEvent(false);
|
async_event_ = threading::Event::CreateAutoResetEvent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFile::XFile() : XObject(kType) {
|
XFile::XFile() : XObject(kObjectType) {
|
||||||
async_event_ = threading::Event::CreateAutoResetEvent(false);
|
async_event_ = threading::Event::CreateAutoResetEvent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class X_FILE_DIRECTORY_INFORMATION {
|
||||||
|
|
||||||
class XFile : public XObject {
|
class XFile : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeFile;
|
static const XObject::Type kObjectType = XObject::Type::File;
|
||||||
|
|
||||||
XFile(KernelState* kernel_state, vfs::File* file, bool synchronous);
|
XFile(KernelState* kernel_state, vfs::File* file, bool synchronous);
|
||||||
~XFile() override;
|
~XFile() override;
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XIOCompletion::XIOCompletion(KernelState* kernel_state)
|
XIOCompletion::XIOCompletion(KernelState* kernel_state)
|
||||||
: XObject(kernel_state, kType) {
|
: XObject(kernel_state, kObjectType) {
|
||||||
notification_semaphore_ = threading::Semaphore::Create(0, kMaxNotifications);
|
notification_semaphore_ = threading::Semaphore::Create(0, kMaxNotifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace kernel {
|
||||||
|
|
||||||
class XIOCompletion : public XObject {
|
class XIOCompletion : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeIOCompletion;
|
static const XObject::Type kObjectType = XObject::Type::IOCompletion;
|
||||||
|
|
||||||
explicit XIOCompletion(KernelState* kernel_state);
|
explicit XIOCompletion(KernelState* kernel_state);
|
||||||
~XIOCompletion() override;
|
~XIOCompletion() override;
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XModule::XModule(KernelState* kernel_state, ModuleType module_type)
|
XModule::XModule(KernelState* kernel_state, ModuleType module_type)
|
||||||
: XObject(kernel_state, kType),
|
: XObject(kernel_state, kObjectType),
|
||||||
module_type_(module_type),
|
module_type_(module_type),
|
||||||
processor_module_(nullptr),
|
processor_module_(nullptr),
|
||||||
hmodule_ptr_(0) {
|
hmodule_ptr_(0) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ class XModule : public XObject {
|
||||||
kUserModule = 1,
|
kUserModule = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Type kType = kTypeModule;
|
static const XObject::Type kObjectType = XObject::Type::Module;
|
||||||
|
|
||||||
XModule(KernelState* kernel_state, ModuleType module_type);
|
XModule(KernelState* kernel_state, ModuleType module_type);
|
||||||
virtual ~XModule();
|
virtual ~XModule();
|
||||||
|
|
|
@ -17,9 +17,10 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XMutant::XMutant() : XObject(kType) {}
|
XMutant::XMutant(KernelState* kernel_state)
|
||||||
|
: XObject(kernel_state, kObjectType) {}
|
||||||
|
|
||||||
XMutant::XMutant(KernelState* kernel_state) : XObject(kernel_state, kType) {}
|
XMutant::XMutant() : XObject(kObjectType) {}
|
||||||
|
|
||||||
XMutant::~XMutant() = default;
|
XMutant::~XMutant() = default;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class XThread;
|
||||||
|
|
||||||
class XMutant : public XObject {
|
class XMutant : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeMutant;
|
static const XObject::Type kObjectType = XObject::Type::Mutant;
|
||||||
|
|
||||||
explicit XMutant(KernelState* kernel_state);
|
explicit XMutant(KernelState* kernel_state);
|
||||||
~XMutant() override;
|
~XMutant() override;
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XNotifyListener::XNotifyListener(KernelState* kernel_state)
|
XNotifyListener::XNotifyListener(KernelState* kernel_state)
|
||||||
: XObject(kernel_state, kType) {}
|
: XObject(kernel_state, kObjectType) {}
|
||||||
|
|
||||||
XNotifyListener::~XNotifyListener() {}
|
XNotifyListener::~XNotifyListener() {}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace kernel {
|
||||||
|
|
||||||
class XNotifyListener : public XObject {
|
class XNotifyListener : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeNotifyListener;
|
static const XObject::Type kObjectType = XObject::Type::NotifyListener;
|
||||||
|
|
||||||
explicit XNotifyListener(KernelState* kernel_state);
|
explicit XNotifyListener(KernelState* kernel_state);
|
||||||
~XNotifyListener() override;
|
~XNotifyListener() override;
|
||||||
|
|
|
@ -129,33 +129,33 @@ bool XObject::RestoreObject(ByteStream* stream) {
|
||||||
object_ref<XObject> XObject::Restore(KernelState* kernel_state, Type type,
|
object_ref<XObject> XObject::Restore(KernelState* kernel_state, Type type,
|
||||||
ByteStream* stream) {
|
ByteStream* stream) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kTypeEnumerator:
|
case Type::Enumerator:
|
||||||
break;
|
break;
|
||||||
case kTypeEvent:
|
case Type::Event:
|
||||||
return XEvent::Restore(kernel_state, stream);
|
return XEvent::Restore(kernel_state, stream);
|
||||||
case kTypeFile:
|
case Type::File:
|
||||||
return XFile::Restore(kernel_state, stream);
|
return XFile::Restore(kernel_state, stream);
|
||||||
case kTypeIOCompletion:
|
case Type::IOCompletion:
|
||||||
break;
|
break;
|
||||||
case kTypeModule:
|
case Type::Module:
|
||||||
return XModule::Restore(kernel_state, stream);
|
return XModule::Restore(kernel_state, stream);
|
||||||
case kTypeMutant:
|
case Type::Mutant:
|
||||||
return XMutant::Restore(kernel_state, stream);
|
return XMutant::Restore(kernel_state, stream);
|
||||||
case kTypeNotifyListener:
|
case Type::NotifyListener:
|
||||||
return XNotifyListener::Restore(kernel_state, stream);
|
return XNotifyListener::Restore(kernel_state, stream);
|
||||||
case kTypeSemaphore:
|
case Type::Semaphore:
|
||||||
return XSemaphore::Restore(kernel_state, stream);
|
return XSemaphore::Restore(kernel_state, stream);
|
||||||
case kTypeSession:
|
case Type::Session:
|
||||||
break;
|
break;
|
||||||
case kTypeSocket:
|
case Type::Socket:
|
||||||
break;
|
break;
|
||||||
case kTypeSymbolicLink:
|
case Type::SymbolicLink:
|
||||||
return XSymbolicLink::Restore(kernel_state, stream);
|
return XSymbolicLink::Restore(kernel_state, stream);
|
||||||
case kTypeThread:
|
case Type::Thread:
|
||||||
return XThread::Restore(kernel_state, stream);
|
return XThread::Restore(kernel_state, stream);
|
||||||
case kTypeTimer:
|
case Type::Timer:
|
||||||
break;
|
break;
|
||||||
case kTypeUndefined:
|
case Type::Undefined:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,21 +116,21 @@ class XObject {
|
||||||
// one with 0x8A... which causes crash
|
// one with 0x8A... which causes crash
|
||||||
static constexpr uint32_t kHandleBase = 0xF8000000;
|
static constexpr uint32_t kHandleBase = 0xF8000000;
|
||||||
|
|
||||||
enum Type {
|
enum class Type : uint32_t {
|
||||||
kTypeUndefined,
|
Undefined,
|
||||||
kTypeEnumerator,
|
Enumerator,
|
||||||
kTypeEvent,
|
Event,
|
||||||
kTypeFile,
|
File,
|
||||||
kTypeIOCompletion,
|
IOCompletion,
|
||||||
kTypeModule,
|
Module,
|
||||||
kTypeMutant,
|
Mutant,
|
||||||
kTypeNotifyListener,
|
NotifyListener,
|
||||||
kTypeSemaphore,
|
Semaphore,
|
||||||
kTypeSession,
|
Session,
|
||||||
kTypeSocket,
|
Socket,
|
||||||
kTypeSymbolicLink,
|
SymbolicLink,
|
||||||
kTypeThread,
|
Thread,
|
||||||
kTypeTimer,
|
Timer,
|
||||||
};
|
};
|
||||||
|
|
||||||
XObject(Type type);
|
XObject(Type type);
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XSemaphore::XSemaphore(KernelState* kernel_state)
|
XSemaphore::XSemaphore(KernelState* kernel_state)
|
||||||
: XObject(kernel_state, kTypeSemaphore) {}
|
: XObject(kernel_state, kObjectType) {}
|
||||||
|
|
||||||
XSemaphore::~XSemaphore() = default;
|
XSemaphore::~XSemaphore() = default;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ static_assert_size(X_KSEMAPHORE, 0x14);
|
||||||
|
|
||||||
class XSemaphore : public XObject {
|
class XSemaphore : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeSemaphore;
|
static const XObject::Type kObjectType = XObject::Type::Semaphore;
|
||||||
|
|
||||||
explicit XSemaphore(KernelState* kernel_state);
|
explicit XSemaphore(KernelState* kernel_state);
|
||||||
~XSemaphore() override;
|
~XSemaphore() override;
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XSocket::XSocket(KernelState* kernel_state) : XObject(kernel_state, kType) {}
|
XSocket::XSocket(KernelState* kernel_state)
|
||||||
|
: XObject(kernel_state, kObjectType) {}
|
||||||
|
|
||||||
XSocket::XSocket(KernelState* kernel_state, uint64_t native_handle)
|
XSocket::XSocket(KernelState* kernel_state, uint64_t native_handle)
|
||||||
: XObject(kernel_state, kType), native_handle_(native_handle) {}
|
: XObject(kernel_state, kObjectType), native_handle_(native_handle) {}
|
||||||
|
|
||||||
XSocket::~XSocket() { Close(); }
|
XSocket::~XSocket() { Close(); }
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct N_XSOCKADDR_IN {
|
||||||
|
|
||||||
class XSocket : public XObject {
|
class XSocket : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeSocket;
|
static const XObject::Type kObjectType = XObject::Type::Socket;
|
||||||
|
|
||||||
enum AddressFamily {
|
enum AddressFamily {
|
||||||
AF_INET = 2,
|
AF_INET = 2,
|
||||||
|
|
|
@ -16,9 +16,9 @@ namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XSymbolicLink::XSymbolicLink(KernelState* kernel_state)
|
XSymbolicLink::XSymbolicLink(KernelState* kernel_state)
|
||||||
: XObject(kernel_state, kType), path_(), target_() {}
|
: XObject(kernel_state, kObjectType), path_(), target_() {}
|
||||||
|
|
||||||
XSymbolicLink::XSymbolicLink() : XObject(kType), path_(), target_() {}
|
XSymbolicLink::XSymbolicLink() : XObject(kObjectType), path_(), target_() {}
|
||||||
|
|
||||||
XSymbolicLink::~XSymbolicLink() {}
|
XSymbolicLink::~XSymbolicLink() {}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace kernel {
|
||||||
|
|
||||||
class XSymbolicLink : public XObject {
|
class XSymbolicLink : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeSymbolicLink;
|
static const XObject::Type kObjectType = XObject::Type::SymbolicLink;
|
||||||
|
|
||||||
explicit XSymbolicLink(KernelState* kernel_state);
|
explicit XSymbolicLink(KernelState* kernel_state);
|
||||||
~XSymbolicLink() override;
|
~XSymbolicLink() override;
|
||||||
|
|
|
@ -48,13 +48,13 @@ using xe::cpu::ppc::PPCOpcode;
|
||||||
uint32_t next_xthread_id_ = 0;
|
uint32_t next_xthread_id_ = 0;
|
||||||
|
|
||||||
XThread::XThread(KernelState* kernel_state)
|
XThread::XThread(KernelState* kernel_state)
|
||||||
: XObject(kernel_state, kType), guest_thread_(true) {}
|
: XObject(kernel_state, kObjectType), guest_thread_(true) {}
|
||||||
|
|
||||||
XThread::XThread(KernelState* kernel_state, uint32_t stack_size,
|
XThread::XThread(KernelState* kernel_state, uint32_t stack_size,
|
||||||
uint32_t xapi_thread_startup, uint32_t start_address,
|
uint32_t xapi_thread_startup, uint32_t start_address,
|
||||||
uint32_t start_context, uint32_t creation_flags,
|
uint32_t start_context, uint32_t creation_flags,
|
||||||
bool guest_thread, bool main_thread)
|
bool guest_thread, bool main_thread)
|
||||||
: XObject(kernel_state, kType),
|
: XObject(kernel_state, kObjectType),
|
||||||
thread_id_(++next_xthread_id_),
|
thread_id_(++next_xthread_id_),
|
||||||
guest_thread_(guest_thread),
|
guest_thread_(guest_thread),
|
||||||
main_thread_(main_thread),
|
main_thread_(main_thread),
|
||||||
|
|
|
@ -106,7 +106,7 @@ static_assert_size(X_KTHREAD, 0xAB0);
|
||||||
|
|
||||||
class XThread : public XObject, public cpu::Thread {
|
class XThread : public XObject, public cpu::Thread {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeThread;
|
static const XObject::Type kObjectType = XObject::Type::Thread;
|
||||||
|
|
||||||
struct CreationParams {
|
struct CreationParams {
|
||||||
uint32_t stack_size;
|
uint32_t stack_size;
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
namespace xe {
|
namespace xe {
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
|
||||||
XTimer::XTimer(KernelState* kernel_state) : XObject(kernel_state, kType) {}
|
XTimer::XTimer(KernelState* kernel_state)
|
||||||
|
: XObject(kernel_state, kObjectType) {}
|
||||||
|
|
||||||
XTimer::~XTimer() = default;
|
XTimer::~XTimer() = default;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class XThread;
|
||||||
|
|
||||||
class XTimer : public XObject {
|
class XTimer : public XObject {
|
||||||
public:
|
public:
|
||||||
static const Type kType = kTypeTimer;
|
static const XObject::Type kObjectType = XObject::Type::Timer;
|
||||||
|
|
||||||
explicit XTimer(KernelState* kernel_state);
|
explicit XTimer(KernelState* kernel_state);
|
||||||
~XTimer() override;
|
~XTimer() override;
|
||||||
|
|
Loading…
Reference in New Issue