[kernel] Refactor uses of attribute names

This commit is contained in:
Joel Linn 2022-02-24 22:39:49 +01:00 committed by Rick Gibbed
parent 38d589d1e0
commit 91f4954967
2 changed files with 16 additions and 8 deletions
src/xenia/kernel/xboxkrnl

View File

@ -7,6 +7,7 @@
******************************************************************************
*/
#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/util/shim_utils.h"
@ -31,10 +32,15 @@ dword_result_t ObOpenObjectByName_entry(lpunknown_t obj_attributes_ptr,
// r5 = 0
// r6 = out_ptr (handle?)
auto name = util::TranslateAnsiStringAddress(
kernel_memory(),
xe::load_and_swap<uint32_t>(kernel_memory()->TranslateVirtual(
obj_attributes_ptr.guest_address() + 4)));
if (!obj_attributes_ptr) {
return X_STATUS_INVALID_PARAMETER;
}
auto obj_attributes = kernel_memory()->TranslateVirtual<X_OBJECT_ATTRIBUTES*>(
obj_attributes_ptr);
assert_true(obj_attributes->name_ptr != 0);
auto name = util::TranslateAnsiStringAddress(kernel_memory(),
obj_attributes->name_ptr);
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
X_STATUS result =

View File

@ -74,10 +74,12 @@ object_ref<T> LookupNamedObject(KernelState* kernel_state,
if (!obj_attributes_ptr) {
return nullptr;
}
auto name = util::TranslateAnsiStringAddress(
kernel_state->memory(),
xe::load_and_swap<uint32_t>(
kernel_state->memory()->TranslateVirtual(obj_attributes_ptr + 4)));
auto obj_attributes =
kernel_state->memory()->TranslateVirtual<X_OBJECT_ATTRIBUTES*>(
obj_attributes_ptr);
assert_true(obj_attributes->name_ptr != 0);
auto name = util::TranslateAnsiStringAddress(kernel_state->memory(),
obj_attributes->name_ptr);
if (!name.empty()) {
X_HANDLE handle = X_INVALID_HANDLE_VALUE;
X_RESULT result =