From 8d58dade1a3255aa86832c58ca9d8a83dce1f67d Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Fri, 16 Dec 2016 04:47:29 +0000 Subject: [PATCH] Fix disassembly by adding back some deleted lines. When importing for r309309, as part of conflict resolution, too much extra was removed, resulting in bad disassembly for branches. Correct this. Also re-apply the 0->NULL change from r298052. X-MFC-With: r309309 --- sys/powerpc/powerpc/db_disasm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/powerpc/powerpc/db_disasm.c b/sys/powerpc/powerpc/db_disasm.c index 88c03276259..29d74629c12 100644 --- a/sys/powerpc/powerpc/db_disasm.c +++ b/sys/powerpc/powerpc/db_disasm.c @@ -871,8 +871,11 @@ disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, func &= ~Op_crbB; } if (func & Op_LI) { - u_int LI; + int LI; LI = extract_field(instr, 31 - 29, 24); + LI = LI << 8; + LI = LI >> 6; + LI += loc; APP_PSTR("0x%x", LI); func &= ~Op_LI; } @@ -897,8 +900,11 @@ disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, ; } if (func & Op_BD) { - u_int BD; + int BD; BD = extract_field(instr, 31 - 29, 14); + BD = BD << 18; + BD = BD >> 16; + BD += loc; /* Need to sign extend and shift up 2, then add addr */ APP_PSTR("0x%x", BD); func &= ~Op_BD; @@ -968,9 +974,9 @@ disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, reg = "tbu"; break; default: - reg = 0; + reg = NULL; } - if (reg == 0) + if (reg == NULL) APP_PSTR(", [unknown tbr %d ]", tbr); else APP_PSTR(", %s", reg);