From 862c322cbcfbd36e05898528750ca9a29e970933 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 1 Jun 2015 23:36:05 -0700 Subject: [PATCH] Fixing stack args and error typo. --- src/xenia/kernel/util/shim_utils.h | 12 ++++++++---- src/xenia/kernel/xboxkrnl_error.cc | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 8c0aecfd2..7b7e5b87a 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -49,28 +49,32 @@ inline uint8_t get_arg_8(PPCContext* ppc_context, uint8_t index) { if (index <= 7) { return (uint8_t)ppc_context->r[3 + index]; } - return SHIM_MEM_8(get_arg_stack_ptr(ppc_context, index - 7)); + uint32_t stack_address = get_arg_stack_ptr(ppc_context, index - 8); + return SHIM_MEM_8(stack_address); } inline uint16_t get_arg_16(PPCContext* ppc_context, uint8_t index) { if (index <= 7) { return (uint16_t)ppc_context->r[3 + index]; } - return SHIM_MEM_16(get_arg_stack_ptr(ppc_context, index - 7)); + uint32_t stack_address = get_arg_stack_ptr(ppc_context, index - 8); + return SHIM_MEM_16(stack_address); } inline uint32_t get_arg_32(PPCContext* ppc_context, uint8_t index) { if (index <= 7) { return (uint32_t)ppc_context->r[3 + index]; } - return SHIM_MEM_32(get_arg_stack_ptr(ppc_context, index - 7)); + uint32_t stack_address = get_arg_stack_ptr(ppc_context, index - 8); + return SHIM_MEM_32(stack_address); } inline uint64_t get_arg_64(PPCContext* ppc_context, uint8_t index) { if (index <= 7) { return ppc_context->r[3 + index]; } - return SHIM_MEM_64(get_arg_stack_ptr(ppc_context, index - 7)); + uint32_t stack_address = get_arg_stack_ptr(ppc_context, index - 8); + return SHIM_MEM_64(stack_address); } } diff --git a/src/xenia/kernel/xboxkrnl_error.cc b/src/xenia/kernel/xboxkrnl_error.cc index d60b8db2b..6e9e6e0ab 100644 --- a/src/xenia/kernel/xboxkrnl_error.cc +++ b/src/xenia/kernel/xboxkrnl_error.cc @@ -796,7 +796,7 @@ const error_lookup_table error_tables[] = { dword_result_t RtlNtStatusToDosError(dword_t source_status) { uint32_t status = source_status; if (!status || (status & 0x20000000)) { - return status & 0xFFFF; + return status; } if ((status >> 16) == 0x8007) {