Skeleton for KeWaitForSingleObject.

Trying to figure out where D3D is getting its object from. It never seems
to create a timer/event/etc.
This commit is contained in:
Ben Vanik 2013-06-30 10:27:51 -07:00
parent 39ef8d8263
commit 1a3fed942d
3 changed files with 40 additions and 5 deletions

View File

@ -307,6 +307,35 @@ SHIM_CALL KeTlsSetValue_shim(
}
X_STATUS xeKeWaitForSingleObject(
void* object_ptr, uint32_t wait_reason, uint32_t processor_mode,
uint32_t alertable, uint64_t* opt_timeout) {
return X_STATUS_NOT_IMPLEMENTED;
}
SHIM_CALL KeWaitForSingleObject_shim(
xe_ppc_state_t* ppc_state, KernelState* state) {
uint32_t object = SHIM_GET_ARG_32(0);
uint32_t wait_reason = SHIM_GET_ARG_32(1);
uint32_t processor_mode = SHIM_GET_ARG_32(2);
uint32_t alertable = SHIM_GET_ARG_32(3);
uint32_t timeout_ptr = SHIM_GET_ARG_32(4);
XELOGD(
"KeWaitForSingleObject(%.8X, %.8X, %.8X, %.1X, %.8X)",
object, wait_reason, processor_mode, alertable, timeout_ptr);
void* object_ptr = SHIM_MEM_ADDR(object);
uint64_t timeout = timeout_ptr ? SHIM_MEM_64(timeout_ptr) : 0;
X_STATUS result = xeKeWaitForSingleObject(
object_ptr, wait_reason, processor_mode, alertable,
timeout_ptr ? &timeout : NULL);
SHIM_SET_RETURN(result);
}
} // namespace xboxkrnl
} // namespace kernel
} // namespace xe
@ -322,4 +351,6 @@ void xe::kernel::xboxkrnl::RegisterThreadingExports(
SHIM_SET_MAPPING("xboxkrnl.exe", KeTlsFree, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeTlsGetValue, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeTlsSetValue, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeWaitForSingleObject, state);
}

View File

@ -33,6 +33,10 @@ int KeTlsFree(uint32_t tls_index);
uint32_t xeKeTlsGetValue(uint32_t tls_index);
int xeKeTlsSetValue(uint32_t tls_index, uint32_t tls_value);
X_STATUS xeKeWaitForSingleObject(
void* object_ptr, uint32_t wait_reason, uint32_t processor_mode,
uint32_t alertable, uint64_t* opt_timeout);
} // namespace xboxkrnl
} // namespace kernel

View File

@ -32,9 +32,9 @@ namespace kernel {
#define SHIM_MEM_ADDR(a) (a ? (ppc_state->membase + a) : NULL)
#define SHIM_MEM_16(a) (uint16_t)XEGETUINT16BE(SHIM_MEM_ADDR(a));
#define SHIM_MEM_32(a) (uint32_t)XEGETUINT32BE(SHIM_MEM_ADDR(a));
#define SHIM_MEM_64(a) (uint64_t)XEGETUINT64BE(SHIM_MEM_ADDR(a));
#define SHIM_MEM_16(a) (uint16_t)XEGETUINT16BE(SHIM_MEM_ADDR(a))
#define SHIM_MEM_32(a) (uint32_t)XEGETUINT32BE(SHIM_MEM_ADDR(a))
#define SHIM_MEM_64(a) (uint64_t)XEGETUINT64BE(SHIM_MEM_ADDR(a))
#define SHIM_SET_MEM_16(a, v) (*(uint16_t*)SHIM_MEM_ADDR(a)) = XESWAP16(v)
#define SHIM_SET_MEM_32(a, v) (*(uint32_t*)SHIM_MEM_ADDR(a)) = XESWAP32(v)
#define SHIM_SET_MEM_64(a, v) (*(uint64_t*)SHIM_MEM_ADDR(a)) = XESWAP64(v)
@ -53,8 +53,8 @@ namespace kernel {
#define IMPL_MEM_ADDR(a) (a ? xe_memory_addr(state->memory(), a) : NULL)
#define IMPL_MEM_16(a) (uint16_t)XEGETUINT16BE(IMPL_MEM_ADDR(a));
#define IMPL_MEM_32(a) (uint32_t)XEGETUINT32BE(IMPL_MEM_ADDR(a));
#define IMPL_MEM_16(a) (uint16_t)XEGETUINT16BE(IMPL_MEM_ADDR(a))
#define IMPL_MEM_32(a) (uint32_t)XEGETUINT32BE(IMPL_MEM_ADDR(a))
#define IMPL_SET_MEM_16(a, v) (*(uint16_t*)IMPL_MEM_ADDR(a)) = XESWAP16(v)
#define IMPL_SET_MEM_32(a, v) (*(uint32_t*)IMPL_MEM_ADDR(a)) = XESWAP32(v)