Add more wrapper functions to ppc_context_t in kernel, want to switch…
… over to referencing state through ppc_context as much as possible, it'll make implementing things like kernel processes much easier in the future Move forward definitions of kernel types into kernel_fwd.h Stub implementation of XamLoaderGetMediaInfoEx Partially implement XamSetDashContext implement XamGetDashContext Stub implementation of XamUserIsUnsafeProgrammingAllowed Stub implementation of XamUserGetSubscriptionType Expanded the supported object types for ObReferenceObjectByHandle and wrapped the logic for encoding the type in a constexpr function ObReferenceObjectByName was taking lpstring_t for first param, but the function actually takes X_ANSI_STRING ptr NtReleaseMutant actually does not return anything from KeReleaseMutant, it just checks the handle and returns whether it was invalid. Changed the raise/lower irql functions to just set the irql on the pcr instead of setting it on field of Processor, processor is a shared object and irql is per-thread Semi-stub implementation of KeGetImagePageTableEntry. I locked at it in the HV and got it so the values are in the same range the HV returns + actually reflect the page & memory range, but i doubt its equal to the values the hv returns on real hw. Used by modern dashboards, don't know for what. Log error message for ObDereferenceObject w/ null ptr. Allocate a special fixed page that dashboards reference, currently don't know what the data on that page is supposed to be. Add current_irql field to X_KPCR Added Device object member of XObject::Type enum Added some notes about other gpu registers, found a table of register names and indices in xam
This commit is contained in:
@@ -83,12 +83,25 @@ dword_result_t ObLookupThreadByThreadId_entry(dword_t thread_id,
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(ObLookupThreadByThreadId, kNone, kImplemented);
|
||||
|
||||
template <uint32_t ordinal>
|
||||
static constexpr uint32_t object_type_id_for_ordinal_v =
|
||||
0xD000BEEF | (ordinal << 16);
|
||||
// These values come from how Xenia handles uninitialized kernel data exports.
|
||||
// D###BEEF where ### is the ordinal.
|
||||
const static std::unordered_map<XObject::Type, uint32_t> object_types = {
|
||||
{XObject::Type::Event, 0xD00EBEEF},
|
||||
{XObject::Type::Semaphore, 0xD017BEEF},
|
||||
{XObject::Type::Thread, 0xD01BBEEF}};
|
||||
{XObject::Type::Event,
|
||||
object_type_id_for_ordinal_v<ordinals::ExEventObjectType>},
|
||||
{XObject::Type::Semaphore,
|
||||
object_type_id_for_ordinal_v<ordinals::ExSemaphoreObjectType>},
|
||||
{XObject::Type::Thread,
|
||||
object_type_id_for_ordinal_v<ordinals::ExThreadObjectType>},
|
||||
{XObject::Type::File,
|
||||
object_type_id_for_ordinal_v<ordinals::IoFileObjectType>},
|
||||
{XObject::Type::Mutant,
|
||||
object_type_id_for_ordinal_v<ordinals::ExMutantObjectType>},
|
||||
{XObject::Type::Device,
|
||||
object_type_id_for_ordinal_v<ordinals::IoDeviceObjectType>}};
|
||||
dword_result_t ObReferenceObjectByHandle_entry(dword_t handle,
|
||||
dword_t object_type_ptr,
|
||||
lpdword_t out_object_ptr) {
|
||||
@@ -113,6 +126,8 @@ dword_result_t ObReferenceObjectByHandle_entry(dword_t handle,
|
||||
// Caller takes the reference.
|
||||
// It's released in ObDereferenceObject.
|
||||
object->RetainHandle();
|
||||
|
||||
xenia_assert(native_ptr != 0);
|
||||
if (out_object_ptr.guest_address()) {
|
||||
*out_object_ptr = native_ptr;
|
||||
}
|
||||
@@ -120,14 +135,17 @@ dword_result_t ObReferenceObjectByHandle_entry(dword_t handle,
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(ObReferenceObjectByHandle, kNone, kImplemented);
|
||||
|
||||
dword_result_t ObReferenceObjectByName_entry(lpstring_t name,
|
||||
dword_result_t ObReferenceObjectByName_entry(pointer_t<X_ANSI_STRING> name,
|
||||
dword_t attributes,
|
||||
dword_t object_type_ptr,
|
||||
lpvoid_t parse_context,
|
||||
lpdword_t out_object_ptr) {
|
||||
lpdword_t out_object_ptr,
|
||||
const ppc_context_t& ctx) {
|
||||
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
|
||||
|
||||
char* name_str = ctx.TranslateVirtual<char*>(name->pointer);
|
||||
X_STATUS result =
|
||||
kernel_state()->object_table()->GetObjectByName(name.value(), &handle);
|
||||
kernel_state()->object_table()->GetObjectByName(name_str, &handle);
|
||||
if (XSUCCEEDED(result)) {
|
||||
return ObReferenceObjectByHandle_entry(handle, object_type_ptr,
|
||||
out_object_ptr);
|
||||
@@ -142,6 +160,10 @@ void ObDereferenceObject_entry(dword_t native_ptr, const ppc_context_t& ctx) {
|
||||
if (native_ptr == 0xDEADF00D) {
|
||||
return;
|
||||
}
|
||||
if (!native_ptr) {
|
||||
XELOGE("Null native ptr in ObDereferenceObject!");
|
||||
return;
|
||||
}
|
||||
|
||||
auto object = XObject::GetNativeObject<XObject>(
|
||||
kernel_state(), kernel_memory()->TranslateVirtual(native_ptr));
|
||||
|
||||
Reference in New Issue
Block a user