From bcd16a4f29d91f7c71d32e2451b43ebd77726c32 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Wed, 23 Oct 2024 11:07:51 -0700 Subject: [PATCH] only plug in jumping immediates to jump_dest_vaddr paths in stepping; ctrl flow info analysis path stops when it has to read memory or registers --- src/dasm_cache/dasm_cache.c | 9 ++++++++- src/task_system/task_system.c | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dasm_cache/dasm_cache.c b/src/dasm_cache/dasm_cache.c index 5ed5ef15..f0c6a411 100644 --- a/src/dasm_cache/dasm_cache.c +++ b/src/dasm_cache/dasm_cache.c @@ -41,7 +41,14 @@ dasm_inst_from_code(Arena *arena, Arch arch, U64 vaddr, String8 code, DASM_Synta ZydisDecodedOperand *first_visible_op = (zinst.info.operand_count_visible > 0 ? &zinst.operands[0] : 0); ZydisDecodedOperand *first_op = (zinst.info.operand_count > 0 ? &zinst.operands[0] : 0); ZydisDecodedOperand *second_op = (zinst.info.operand_count > 1 ? &zinst.operands[1] : 0); - if(first_visible_op != 0) + if(first_visible_op != 0 && + (first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM8 || + first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM16 || + first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM32 || + first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM64 || + first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM16_32_64 || + first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM32_32_64 || + first_visible_op->encoding == ZYDIS_OPERAND_ENCODING_JIMM16_32_32)) { ZydisCalcAbsoluteAddress(&zinst.info, first_visible_op, vaddr, &jump_dest_vaddr); } diff --git a/src/task_system/task_system.c b/src/task_system/task_system.c index 30b97cf7..bbc0d5af 100644 --- a/src/task_system/task_system.c +++ b/src/task_system/task_system.c @@ -1,3 +1,6 @@ +// Copyright (c) 2024 Epic Games Tools +// Licensed under the MIT license (https://opensource.org/license/mit/) + //////////////////////////////// //~ rjf: Basic Type Functions