From ce30eac25f54e73aeaf19dc576a45a7f48d63bcd Mon Sep 17 00:00:00 2001 From: Mark Charney Date: Thu, 30 Jul 2020 14:54:15 -0400 Subject: [PATCH] fix offset width when disassembling far pointers in 16/32b mode * using eosz instead of just the 64b mode indicator * ~16 year old bug... * https://github.com/intelxed/xed/issues/233 (cherry picked from commit 932bbd537986d804ec96e5ae18f56589fe61555a) --- src/dec/xed-disas.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/dec/xed-disas.c b/src/dec/xed-disas.c index ee22c474..34509c2c 100644 --- a/src/dec/xed-disas.c +++ b/src/dec/xed-disas.c @@ -962,10 +962,8 @@ static void xed_print_operand( xed_print_info_t* pi ) unsigned int disp =(unsigned int) xed_operand_values_get_branch_displacement_int32(ov); - xed_bool_t long_mode = xed_operand_values_get_long_mode( - xed_decoded_inst_operands_const(pi->p)); - - xed_uint_t bits_to_print = long_mode ? 8*8 :4*8; + xed_uint_t bits_to_print = xed_operand_values_get_effective_operand_width(ov); + if (pi->format_options.xml_a) xed_pi_strcat(pi,""); @@ -1420,11 +1418,8 @@ xed_decoded_inst_dump_att_format_internal( case XED_OPERAND_PTR: { unsigned int disp = xed_decoded_inst_get_branch_displacement(pi->p); - xed_bool_t long_mode = - xed_operand_values_get_long_mode( - xed_decoded_inst_operands_const(pi->p)); + xed_uint_t bits_to_print = xed_operand_values_get_effective_operand_width(ov); - xed_uint_t bits_to_print = long_mode ? 8*8 :4*8; xed_pi_strcat(pi,"$0x"); pi->blen = xed_itoa_hex_ul(pi->buf+xed_strlen(pi->buf), disp,