[Kernel] - Change OddObj to X_DISPATCH_HEADER
- Change OddObj to X_DISPATCH_HEADER - Add unknown X_KWAIT_REASON flag - Fixed InitializeGuestObject mistake - Replaces unknowns in kthread using nukernel as reference
This commit is contained in:
committed by
Radosław Gliński
parent
c2674b19d2
commit
dc4db67f9c
@@ -676,7 +676,7 @@ struct X_POOL_ALLOC_HEADER {
|
||||
};
|
||||
|
||||
uint32_t xeAllocatePoolTypeWithTag(PPCContext* context, uint32_t size,
|
||||
uint32_t tag, uint32_t zero) {
|
||||
uint32_t tag, uint32_t pool_selector) {
|
||||
if (size <= 0xFD8) {
|
||||
uint32_t adjusted_size = size + sizeof(X_POOL_ALLOC_HEADER);
|
||||
|
||||
@@ -694,9 +694,9 @@ uint32_t xeAllocatePoolTypeWithTag(PPCContext* context, uint32_t size,
|
||||
}
|
||||
|
||||
dword_result_t ExAllocatePoolTypeWithTag_entry(dword_t size, dword_t tag,
|
||||
dword_t zero,
|
||||
dword_t pool_selector,
|
||||
const ppc_context_t& context) {
|
||||
return xeAllocatePoolTypeWithTag(context, size, tag, zero);
|
||||
return xeAllocatePoolTypeWithTag(context, size, tag, pool_selector);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(ExAllocatePoolTypeWithTag, kMemory, kImplemented);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ uint32_t xeMmAllocatePhysicalMemoryEx(uint32_t flags, uint32_t region_size,
|
||||
dword_result_t xeMmQueryStatistics(
|
||||
pointer_t<X_MM_QUERY_STATISTICS_RESULT> stats_ptr);
|
||||
uint32_t xeAllocatePoolTypeWithTag(PPCContext* context, uint32_t size,
|
||||
uint32_t tag, uint32_t zero);
|
||||
uint32_t tag, uint32_t pool_selector);
|
||||
|
||||
void xeFreePool(PPCContext* context, uint32_t base_address);
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ static_assert_size(X_RTL_CRITICAL_SECTION, 28);
|
||||
|
||||
void xeRtlInitializeCriticalSection(X_RTL_CRITICAL_SECTION* cs,
|
||||
uint32_t cs_ptr) {
|
||||
cs->header.type = 1; // EventSynchronizationObject (auto reset)
|
||||
cs->header.type = X_DISPATCHER_FLAGS::DISPATCHER_AUTO_RESET_EVENT;
|
||||
cs->header.absolute = 0; // spin count div 256
|
||||
cs->header.signal_state = 0;
|
||||
cs->lock_count = -1;
|
||||
@@ -567,7 +567,7 @@ X_STATUS xeRtlInitializeCriticalSectionAndSpinCount(X_RTL_CRITICAL_SECTION* cs,
|
||||
spin_count_div_256 = 255;
|
||||
}
|
||||
|
||||
cs->header.type = 1; // EventSynchronizationObject (auto reset)
|
||||
cs->header.type = X_DISPATCHER_FLAGS::DISPATCHER_AUTO_RESET_EVENT;
|
||||
cs->header.absolute = spin_count_div_256;
|
||||
cs->header.signal_state = 0;
|
||||
cs->lock_count = -1;
|
||||
|
||||
@@ -692,12 +692,12 @@ DECLARE_XBOXKRNL_EXPORT2(NtClearEvent, kThreading, kImplemented,
|
||||
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff552150(v=vs.85).aspx
|
||||
void KeInitializeSemaphore_entry(pointer_t<X_KSEMAPHORE> semaphore_ptr,
|
||||
dword_t count, dword_t limit) {
|
||||
semaphore_ptr->header.type = 5; // SemaphoreObject
|
||||
semaphore_ptr->header.type = X_DISPATCHER_FLAGS::DISPATCHER_SEMAPHORE;
|
||||
semaphore_ptr->header.signal_state = (uint32_t)count;
|
||||
semaphore_ptr->limit = (uint32_t)limit;
|
||||
|
||||
auto sem = XObject::GetNativeObject<XSemaphore>(kernel_state(), semaphore_ptr,
|
||||
5 /* SemaphoreObject */);
|
||||
auto sem = XObject::GetNativeObject<XSemaphore>(
|
||||
kernel_state(), semaphore_ptr, X_DISPATCHER_FLAGS::DISPATCHER_SEMAPHORE);
|
||||
if (!sem) {
|
||||
assert_always();
|
||||
return;
|
||||
@@ -1014,7 +1014,7 @@ dword_result_t KeWaitForMultipleObjects_entry(
|
||||
dword_t count, lpdword_t objects_ptr, dword_t wait_type,
|
||||
dword_t wait_reason, dword_t processor_mode, dword_t alertable,
|
||||
lpqword_t timeout_ptr, lpvoid_t wait_block_array_ptr) {
|
||||
assert_true(wait_type <= 1);
|
||||
assert_true(wait_type <= X_KWAIT_REASON::WaitAny);
|
||||
|
||||
assert_true(count <= 64);
|
||||
object_ref<XObject> objects[64];
|
||||
@@ -1049,7 +1049,7 @@ uint32_t xeNtWaitForMultipleObjectsEx(uint32_t count, xe::be<uint32_t>* handles,
|
||||
uint32_t wait_type, uint32_t wait_mode,
|
||||
uint32_t alertable,
|
||||
uint64_t* timeout_ptr) {
|
||||
assert_true(wait_type <= 1);
|
||||
assert_true(wait_type <= X_KWAIT_REASON::WaitAny);
|
||||
|
||||
assert_true(count <= 64);
|
||||
object_ref<XObject> objects[64];
|
||||
@@ -1091,7 +1091,8 @@ dword_result_t NtWaitForMultipleObjectsEx_entry(
|
||||
dword_t count, lpdword_t handles, dword_t wait_type, dword_t wait_mode,
|
||||
dword_t alertable, lpqword_t timeout_ptr) {
|
||||
uint64_t timeout = timeout_ptr ? static_cast<uint64_t>(*timeout_ptr) : 0u;
|
||||
if (!count || count > 64 || (wait_type != 1 && wait_type)) {
|
||||
if (!count || count > 64 ||
|
||||
(wait_type != X_KWAIT_REASON::WaitAny && wait_type)) {
|
||||
return X_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
return xeNtWaitForMultipleObjectsEx(count, handles, wait_type, wait_mode,
|
||||
@@ -1871,7 +1872,7 @@ dword_result_t KeSetPriorityThread_entry(pointer_t<X_KTHREAD> thread_ptr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (thread_ptr->header.type != 6) {
|
||||
if (thread_ptr->header.type != X_DISPATCHER_FLAGS::DISPATCHER_THREAD) {
|
||||
XELOGW("{}: Invalid object type: {}", __func__, thread_ptr->header.type);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user