From patchwork Tue Jun 2 05:27:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1302086 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgfF62Hzz9sSc for ; Tue, 2 Jun 2020 15:32:21 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LFJt1y7T; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49bgfF3Hn9zDqZk for ; Tue, 2 Jun 2020 15:32:21 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49bgXx2mYwzDqSw for ; Tue, 2 Jun 2020 15:27:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LFJt1y7T; dkim-atps=neutral Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by bilbo.ozlabs.org (Postfix) with ESMTP id 49bgXv6x1hz8tRw for ; Tue, 2 Jun 2020 15:27:43 +1000 (AEST) Received: by ozlabs.org (Postfix) id 49bgXv662jz9sSy; Tue, 2 Jun 2020 15:27:43 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::441; helo=mail-wr1-x441.google.com; envelope-from=jniethe5@gmail.com; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=LFJt1y7T; dkim-atps=neutral Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgXv5BQDz9sSg for ; Tue, 2 Jun 2020 15:27:43 +1000 (AEST) Received: by mail-wr1-x441.google.com with SMTP id q11so1986580wrp.3 for ; Mon, 01 Jun 2020 22:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EiKVuFVvR1kzcWp0pO+XluerRBoW/f/kBeVZgtUljuI=; b=LFJt1y7T55q8Ut+ZOUEMbb9XkqBoThtbGIrFRE1OYVEU+QJGbiuO6JpPAgTBZct/9W V8LuTiZY6ZNhXEmhCqTLWBTkDfscAoYyiHnLTnDKFuuWHPlZzafZi7JWYU517eJVSYVD 1E7oukfMG7cHHsvmhNtCINRlDnKNvj4ulPgcx9MRcqTnGlS4Yir9ZNh2f7P3SM3Xv301 7kL55nVqKpkf+U3pNi95tdLsjW4FnPN0YLF2d+wj6wglgsWtmXP9BqcRca7extOrosrj 3+HfFUeF9A7fb+/xDn5vQdWDT6SHyGWkQ7pepNdtGnZks6mS1IjiHNCzNU/Vr4tVUHjG 86TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EiKVuFVvR1kzcWp0pO+XluerRBoW/f/kBeVZgtUljuI=; b=Ssx97Yhe4roTtuJOWOCMyXNiB3xa4uIM+3hl+iJwNKE0FxQteeGXNpX46MLDvS0s/o qJamxFG11MSLNdfjmh4FLvcc4nIlqUwzUQ5GMbLo9ZqsCRwJXppc1XgN6kPzqPGGt38i UW5pnkBJ3pDOODqrfcDHaI6TBMHAfsJhE54uAzeA3O+naAsZmmpufb9O59dG3qdqe3/z T7XPl4uy02WnVkcbXsEPskXDKK/vsdCsxO8o+nOiyKMSHKNxkMkRtioD3j+NyRGOzJHc 6u+fJfw/19t3SNy2rPyrwK2NIe+MZq9FbUEtAfWa7ioJ6CpWylT1FXLLdE+l+4Y4jrwb BALg== X-Gm-Message-State: AOAM532jukJFNckwsBs/tu8l7Dt9JHT8aruBO2Ez/bZtVCo3yCQsU3Jd dghxNiVU5zquHRAfELnM4wlyJM8S X-Google-Smtp-Source: ABdhPJyhS1s9ew6Lv2b2Fkx0zrNzpVSsiSLZbhJOnQUw6VBlOP+3VsdzCQ+scaJqnAJ1Sfp5FedatA== X-Received: by 2002:adf:d84a:: with SMTP id k10mr24348730wrl.336.1591075658516; Mon, 01 Jun 2020 22:27:38 -0700 (PDT) Received: from localhost.localdomain (180-150-65-4.b49641.syd.nbn.aussiebb.net. [180.150.65.4]) by smtp.gmail.com with ESMTPSA id a124sm1831336wmh.4.2020.06.01.22.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 22:27:37 -0700 (PDT) From: Jordan Niethe To: linuxppc-dev@ozlabs.org Subject: [PATCH 1/4] powerpc: Add a ppc_inst_as_str() helper Date: Tue, 2 Jun 2020 15:27:25 +1000 Message-Id: <20200602052728.18227-1-jniethe5@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Niethe , alistair@popple.id.au Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" There are quite a few places where instructions are printed, this is done using a '%x' format specifier. With the introduction of prefixed instructions, this does not work well. Currently in these places, ppc_inst_val() is used for the value for %x so only the first word of prefixed instructions are printed. When the instructions are word instructions, only a single word should be printed. For prefixed instructions both the prefix and suffix should be printed. To accommodate both of these situations, instead of a '%x' specifier use '%s' and introduce a helper, __ppc_inst_as_str() which returns a char *. The char * __ppc_inst_as_str() returns is buffer that is passed to it by the caller. It is cumbersome to require every caller of __ppc_inst_as_str() to now declare a buffer. To make it more convenient to use __ppc_inst_as_str(), wrap it in a macro that uses a compound statement to allocate a buffer on the caller's stack before calling it. Signed-off-by: Jordan Niethe Reviewed-by: Joel Stanley Acked-by: Segher Boessenkool --- arch/powerpc/include/asm/inst.h | 19 +++++++++++++++++++ arch/powerpc/kernel/kprobes.c | 2 +- arch/powerpc/kernel/trace/ftrace.c | 26 +++++++++++++------------- arch/powerpc/lib/test_emulate_step.c | 4 ++-- arch/powerpc/xmon/xmon.c | 2 +- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h index 45f3ec868258..3df7806e6dc3 100644 --- a/arch/powerpc/include/asm/inst.h +++ b/arch/powerpc/include/asm/inst.h @@ -122,6 +122,25 @@ static inline u64 ppc_inst_as_u64(struct ppc_inst x) #endif } +#define PPC_INST_STR_LEN sizeof("0x00000000 0x00000000") + +static inline char *__ppc_inst_as_str(char str[PPC_INST_STR_LEN], struct ppc_inst x) +{ + if (ppc_inst_prefixed(x)) + sprintf(str, "0x%08x 0x%08x", ppc_inst_val(x), ppc_inst_suffix(x)); + else + sprintf(str, "0x%08x", ppc_inst_val(x)); + + return str; +} + +#define ppc_inst_as_str(x) \ +({ \ + char __str[PPC_INST_STR_LEN]; \ + __ppc_inst_as_str(__str, x); \ + __str; \ +}) + int probe_user_read_inst(struct ppc_inst *inst, struct ppc_inst __user *nip); diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 227510df8c55..d0797171dba3 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -244,7 +244,7 @@ static int try_to_emulate(struct kprobe *p, struct pt_regs *regs) * So, we should never get here... but, its still * good to catch them, just in case... */ - printk("Can't step on instruction %x\n", ppc_inst_val(insn)); + printk("Can't step on instruction %s\n", ppc_inst_as_str(insn)); BUG(); } else { /* diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index 5e399628f51a..da11a26d8213 100644 --- a/arch/powerpc/kernel/trace/ftrace.c +++ b/arch/powerpc/kernel/trace/ftrace.c @@ -73,8 +73,8 @@ ftrace_modify_code(unsigned long ip, struct ppc_inst old, struct ppc_inst new) /* Make sure it is what we expect it to be */ if (!ppc_inst_equal(replaced, old)) { - pr_err("%p: replaced (%#x) != old (%#x)", - (void *)ip, ppc_inst_val(replaced), ppc_inst_val(old)); + pr_err("%p: replaced (%s) != old (%s)", + (void *)ip, ppc_inst_as_str(replaced), ppc_inst_as_str(old)); return -EINVAL; } @@ -137,7 +137,7 @@ __ftrace_make_nop(struct module *mod, /* Make sure that that this is still a 24bit jump */ if (!is_bl_op(op)) { - pr_err("Not expected bl: opcode is %x\n", ppc_inst_val(op)); + pr_err("Not expected bl: opcode is %s\n", ppc_inst_as_str(op)); return -EINVAL; } @@ -172,8 +172,8 @@ __ftrace_make_nop(struct module *mod, /* We expect either a mflr r0, or a std r0, LRSAVE(r1) */ if (!ppc_inst_equal(op, ppc_inst(PPC_INST_MFLR)) && !ppc_inst_equal(op, ppc_inst(PPC_INST_STD_LR))) { - pr_err("Unexpected instruction %08x around bl _mcount\n", - ppc_inst_val(op)); + pr_err("Unexpected instruction %s around bl _mcount\n", + ppc_inst_as_str(op)); return -EINVAL; } #else @@ -203,7 +203,7 @@ __ftrace_make_nop(struct module *mod, } if (!ppc_inst_equal(op, ppc_inst(PPC_INST_LD_TOC))) { - pr_err("Expected %08x found %08x\n", PPC_INST_LD_TOC, ppc_inst_val(op)); + pr_err("Expected %08x found %s\n", PPC_INST_LD_TOC, ppc_inst_as_str(op)); return -EINVAL; } #endif /* CONFIG_MPROFILE_KERNEL */ @@ -231,7 +231,7 @@ __ftrace_make_nop(struct module *mod, /* Make sure that that this is still a 24bit jump */ if (!is_bl_op(op)) { - pr_err("Not expected bl: opcode is %x\n", ppc_inst_val(op)); + pr_err("Not expected bl: opcode is %s\n", ppc_inst_as_str(op)); return -EINVAL; } @@ -406,7 +406,7 @@ static int __ftrace_make_nop_kernel(struct dyn_ftrace *rec, unsigned long addr) /* Make sure that that this is still a 24bit jump */ if (!is_bl_op(op)) { - pr_err("Not expected bl: opcode is %x\n", ppc_inst_val(op)); + pr_err("Not expected bl: opcode is %s\n", ppc_inst_as_str(op)); return -EINVAL; } @@ -533,8 +533,8 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) return -EFAULT; if (!expected_nop_sequence(ip, op[0], op[1])) { - pr_err("Unexpected call sequence at %p: %x %x\n", - ip, ppc_inst_val(op[0]), ppc_inst_val(op[1])); + pr_err("Unexpected call sequence at %p: %s %s\n", + ip, ppc_inst_as_str(op[0]), ppc_inst_as_str(op[1])); return -EINVAL; } @@ -597,7 +597,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) /* It should be pointing to a nop */ if (!ppc_inst_equal(op, ppc_inst(PPC_INST_NOP))) { - pr_err("Expected NOP but have %x\n", ppc_inst_val(op)); + pr_err("Expected NOP but have %s\n", ppc_inst_as_str(op)); return -EINVAL; } @@ -654,7 +654,7 @@ static int __ftrace_make_call_kernel(struct dyn_ftrace *rec, unsigned long addr) } if (!ppc_inst_equal(op, ppc_inst(PPC_INST_NOP))) { - pr_err("Unexpected call sequence at %p: %x\n", ip, ppc_inst_val(op)); + pr_err("Unexpected call sequence at %p: %s\n", ip, ppc_inst_as_str(op)); return -EINVAL; } @@ -733,7 +733,7 @@ __ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, /* Make sure that that this is still a 24bit jump */ if (!is_bl_op(op)) { - pr_err("Not expected bl: opcode is %x\n", ppc_inst_val(op)); + pr_err("Not expected bl: opcode is %s\n", ppc_inst_as_str(op)); return -EINVAL; } diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c index 46af80279ebc..5fb6f5267d70 100644 --- a/arch/powerpc/lib/test_emulate_step.c +++ b/arch/powerpc/lib/test_emulate_step.c @@ -852,7 +852,7 @@ static int __init emulate_compute_instr(struct pt_regs *regs, if (analyse_instr(&op, regs, instr) != 1 || GETTYPE(op.type) != COMPUTE) { - pr_info("emulation failed, instruction = 0x%08x\n", ppc_inst_val(instr)); + pr_info("execution failed, instruction = %s\n", ppc_inst_as_str(instr)); return -EFAULT; } @@ -872,7 +872,7 @@ static int __init execute_compute_instr(struct pt_regs *regs, /* Patch the NOP with the actual instruction */ patch_instruction_site(&patch__exec_instr, instr); if (exec_instr(regs)) { - pr_info("execution failed, instruction = 0x%08x\n", ppc_inst_val(instr)); + pr_info("execution failed, instruction = %s\n", ppc_inst_as_str(instr)); return -EFAULT; } diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 16ee6639a60c..1dd3bf02021b 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -2958,7 +2958,7 @@ generic_inst_dump(unsigned long adr, long count, int praddr, dotted = 0; last_inst = inst; if (praddr) - printf(REG" %.8x", adr, ppc_inst_val(inst)); + printf(REG" %s", adr, ppc_inst_as_str(inst)); printf("\t"); dump_func(ppc_inst_val(inst), adr); printf("\n"); From patchwork Tue Jun 2 05:27:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1302087 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgh1647Hz9sSg for ; Tue, 2 Jun 2020 15:33:53 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mhqy7D4y; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49bgh15CV5zDqkq for ; Tue, 2 Jun 2020 15:33:53 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49bgXy0LYRzDqLB for ; Tue, 2 Jun 2020 15:27:46 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mhqy7D4y; dkim-atps=neutral Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by bilbo.ozlabs.org (Postfix) with ESMTP id 49bgXx4CN1z9BGJ for ; Tue, 2 Jun 2020 15:27:45 +1000 (AEST) Received: by ozlabs.org (Postfix) id 49bgXx3QMWz9sSn; Tue, 2 Jun 2020 15:27:45 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=jniethe5@gmail.com; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mhqy7D4y; dkim-atps=neutral Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgXx1y8Kz9sSy for ; Tue, 2 Jun 2020 15:27:45 +1000 (AEST) Received: by mail-wr1-x442.google.com with SMTP id e1so1975065wrt.5 for ; Mon, 01 Jun 2020 22:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=waOrQVSuIWtBPhBqEQ5/JFl4vCqIg2ZOu6BdG4zPGGU=; b=mhqy7D4y8QSTFAQeydKTXhtbJpjmstnJrfz28gWmiK/GAKx6whd1yoHOw9E+mm1co2 HuLiw4W8CABJlHdkAqAZiZT03Ok1lFMKZ9E9w0a3ByZzBPakxfvFn/La8mWH0qX+pcmt zIst0QuVmeKeXooRIdkDxESEyySJyV2ovzS+Ificv0BdS/1hivN5pThxL6Iy5GNCZFMo eWnDVPVEK5v6PdtAFvh/2INe/Z7w1+TnH0/sea/PUWi9tK8uMwPh8kMvw/370TNdx6RQ XRNhraxCBx8bEMoWEe4Fd1PcqBgss/Dt1fTtOfahA5bwpU3hm5nbZ73rZHHh2Iwuvtis zhqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=waOrQVSuIWtBPhBqEQ5/JFl4vCqIg2ZOu6BdG4zPGGU=; b=UYBmPSyeKQ977yqyu0bqcbyqGAPCLPCqUqknMbDIKHoPol/ONwf1wH/BT2bcut2o9l mlMJaNdxwBu5crlE7dzIcfxFjaHPQRnVlnEfl2DGwTUaDA5a45TB/YXmFelbGyTE0bl5 XMmQLtuUT/L/ovVNSBKXNJ2TLaSrgkZ6QCl191P7+9C0I+yGdjfLmz6HX6a3qeS5lL+x NS0g2dV0xgjX+cpmQ69z+x8SZOGADez202ncLUt3YpOXGXin1iQuZWrmvEOjv60btNyA zRC34I2H3DBNIaPxsorVfkOVqc99ht0BW6Wxucb3RWcLHUKNPyzjQ6LhLbW1J02KtPeP HmIw== X-Gm-Message-State: AOAM533liJdo3x3nBtetu/rFm9Te8P0LMvMrro3AIn364lbvyK7IkJxy lXFAGLoGEpU1w9Fw02Md4WtflEuW X-Google-Smtp-Source: ABdhPJyw/ik1UK5IKACc2TpKGYHyPoOpbdJ8MOhTDbs6KMR0l7+GMNZTyAeM8dfiRFP8mPBjBZAkgw== X-Received: by 2002:adf:fd49:: with SMTP id h9mr25260426wrs.67.1591075661664; Mon, 01 Jun 2020 22:27:41 -0700 (PDT) Received: from localhost.localdomain (180-150-65-4.b49641.syd.nbn.aussiebb.net. [180.150.65.4]) by smtp.gmail.com with ESMTPSA id a124sm1831336wmh.4.2020.06.01.22.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 22:27:41 -0700 (PDT) From: Jordan Niethe To: linuxppc-dev@ozlabs.org Subject: [PATCH 2/4] powerpc/xmon: Improve dumping prefixed instructions Date: Tue, 2 Jun 2020 15:27:26 +1000 Message-Id: <20200602052728.18227-2-jniethe5@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602052728.18227-1-jniethe5@gmail.com> References: <20200602052728.18227-1-jniethe5@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Niethe , alistair@popple.id.au Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently prefixed instructions are dumped as two separate word instructions. Use mread_instr() so that prefixed instructions are read as such and update the incrementor in the loop to take this into account. 'dump_func' is print_insn_powerpc() which comes from ppc-dis.c which is taken from binutils. When this is updated prefixed instructions will be disassembled. Currently dumping prefixed instructions looks like this: 0:mon> di c000000000094168 c000000000094168 0x06000000 .long 0x6000000 c00000000009416c 0x392a0003 addi r9,r10,3 c000000000094170 0x913f0028 stw r9,40(r31) c000000000094174 0xe93f002a lwa r9,40(r31) c000000000094178 0x7d234b78 mr r3,r9 c00000000009417c 0x383f0040 addi r1,r31,64 c000000000094180 0xebe1fff8 ld r31,-8(r1) c000000000094184 0x4e800020 blr c000000000094188 0x60000000 nop ... c000000000094190 0x3c4c0121 addis r2,r12,289 c000000000094194 0x38429670 addi r2,r2,-27024 c000000000094198 0x7c0802a6 mflr r0 c00000000009419c 0x60000000 nop c0000000000941a0 0xe9240100 ld r9,256(r4) c0000000000941a4 0x39400001 li r10,1 After this it looks like: 0:mon> di c000000000094168 c000000000094168 0x06000000 0x392a0003 .long 0x392a000306000000 c000000000094170 0x913f0028 stw r9,40(r31) c000000000094174 0xe93f002a lwa r9,40(r31) c000000000094178 0x7d234b78 mr r3,r9 c00000000009417c 0x383f0040 addi r1,r31,64 c000000000094180 0xebe1fff8 ld r31,-8(r1) c000000000094184 0x4e800020 blr c000000000094188 0x60000000 nop ... c000000000094190 0x3c4c0121 addis r2,r12,289 c000000000094194 0x38429570 addi r2,r2,-27280 c000000000094198 0x7c0802a6 mflr r0 c00000000009419c 0x60000000 nop c0000000000941a0 0xe9240100 ld r9,256(r4) c0000000000941a4 0x39400001 li r10,1 c0000000000941a8 0x3d02000b addis r8,r2,11 Signed-off-by: Jordan Niethe --- arch/powerpc/xmon/xmon.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 1dd3bf02021b..548571536bd1 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -2935,11 +2935,10 @@ generic_inst_dump(unsigned long adr, long count, int praddr, int nr, dotted; unsigned long first_adr; struct ppc_inst inst, last_inst = ppc_inst(0); - unsigned char val[4]; dotted = 0; - for (first_adr = adr; count > 0; --count, adr += 4) { - nr = mread(adr, val, 4); + for (first_adr = adr; count > 0; --count, adr += ppc_inst_len(inst)) { + nr = mread_instr(adr, &inst); if (nr == 0) { if (praddr) { const char *x = fault_chars[fault_type]; @@ -2947,7 +2946,6 @@ generic_inst_dump(unsigned long adr, long count, int praddr, } break; } - inst = ppc_inst(GETWORD(val)); if (adr > first_adr && ppc_inst_equal(inst, last_inst)) { if (!dotted) { printf(" ...\n"); @@ -2960,7 +2958,10 @@ generic_inst_dump(unsigned long adr, long count, int praddr, if (praddr) printf(REG" %s", adr, ppc_inst_as_str(inst)); printf("\t"); - dump_func(ppc_inst_val(inst), adr); + if (!ppc_inst_prefixed(inst)) + dump_func(ppc_inst_val(inst), adr); + else + dump_func(ppc_inst_as_u64(inst), adr); printf("\n"); } return adr - first_adr; From patchwork Tue Jun 2 05:27:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1302088 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgk457Qgz9sSc for ; Tue, 2 Jun 2020 15:35:40 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FL8B4yEP; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49bgk35csrzDqQ0 for ; Tue, 2 Jun 2020 15:35:39 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49bgY21wykzDqSZ for ; Tue, 2 Jun 2020 15:27:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FL8B4yEP; dkim-atps=neutral Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by bilbo.ozlabs.org (Postfix) with ESMTP id 49bgY045jTz8tRw for ; Tue, 2 Jun 2020 15:27:48 +1000 (AEST) Received: by ozlabs.org (Postfix) id 49bgY01yclz9sSy; Tue, 2 Jun 2020 15:27:48 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=jniethe5@gmail.com; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FL8B4yEP; dkim-atps=neutral Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgY00Ss7z9sSg for ; Tue, 2 Jun 2020 15:27:47 +1000 (AEST) Received: by mail-wm1-x344.google.com with SMTP id u26so1388200wmn.1 for ; Mon, 01 Jun 2020 22:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wQ6s0Tonig3IHtEpnRDJ6uo2d5JJKdzwIDpa6lcIIII=; b=FL8B4yEPNcbiK0LgTgjPXnm6spjfNtwZlONYrge4dgDZ9z1S8id2XdZFSgUyGPB3Pg VzB9EHMREfsprDTzMk4/Px30rIYJgHA3xxzIC4q1Nsy4TTrmmgL2JeW2k45kwVgGmnSO OVAZQJ1/TIHrTmLvvWp6nWI+YeF6hmdmHJQwq7W5YdCgTBcYTJq5lKaNE33x0XAl1Fa8 /hpXURwqvF4DIYpu3rMg1DxTiftLS0yzKQoKXlgdXk5kbyKIez4d57XCeHeOFXkBgxL2 jMVB0bVNibwa9z/X7J1VUlq0b/NviMuC6//8oWzrKPpvRi+1/j4hnmU4t2eTiCbY6Y1c kCEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wQ6s0Tonig3IHtEpnRDJ6uo2d5JJKdzwIDpa6lcIIII=; b=bM7+CA/bE87dBP2C2eh7okHo1CXOVQ7X2mgP4qI63Y3Snbh/DMuZcv0dtbG6hMlwLH 7Dh5dRy8D0zWUU1M8pkmwF0cjMYAxrg+xdJ7YKFdDTpPat1Ox7VWdT5UxwwY06IlNyGU 6mAfEBUMtfd15R2uMunw57gvCn2SqjF0ntTj/p+8eqlbvVMI5UbTNCfrm5m8P7tmrfe8 Wx9lzHlJSLJVi/Z/Dtcd3rWroENdwOhpj9iJlP0/6jkEMny+wnS2WBJQrHNNbuc3SQ7z OVzCzx012ija79cb+ISIelXd5jpvDGnF54Rz1WwPUHqUgoUJda9+EEBi75G34izuOIsY oFgQ== X-Gm-Message-State: AOAM531HWiZogIVZ4+kLZdyVcRGEswRWAXKA4LXEqadCZa5RenTFGxsb NvmJsUwAI2FJj6si6g5W/WYMeunD X-Google-Smtp-Source: ABdhPJwpPXqtOP6DRvvqEBmy2Q3FyKOrUK+izXBcOWxRb7jnD9p7UHNmFmRwUh0YykKkJrEleygUug== X-Received: by 2002:a7b:ce01:: with SMTP id m1mr2442986wmc.116.1591075664805; Mon, 01 Jun 2020 22:27:44 -0700 (PDT) Received: from localhost.localdomain (180-150-65-4.b49641.syd.nbn.aussiebb.net. [180.150.65.4]) by smtp.gmail.com with ESMTPSA id a124sm1831336wmh.4.2020.06.01.22.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 22:27:44 -0700 (PDT) From: Jordan Niethe To: linuxppc-dev@ozlabs.org Subject: [PATCH 3/4] powerpc: Handle prefixed instructions in show_user_instructions() Date: Tue, 2 Jun 2020 15:27:27 +1000 Message-Id: <20200602052728.18227-3-jniethe5@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602052728.18227-1-jniethe5@gmail.com> References: <20200602052728.18227-1-jniethe5@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Niethe , alistair@popple.id.au Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently prefixed instructions are treated as two word instructions by show_user_instructions(), treat them as a single instruction. '<' and '>' are placed around the instruction at the NIP, and for prefixed instructions this is placed around the prefix only. Make the '<' and '>' wrap the prefix and suffix. Currently showing a prefixed instruction looks like: fbe1fff8 39200000 06000000 a3e30000 <04000000> f7e40000 ebe1fff8 4e800020 Make it look like: 0xfbe1fff8 0x39200000 0x06000000 0xa3e30000 <0x04000000 0xf7e40000> 0xebe1fff8 0x4e800020 0x00000000 0x00000000 Signed-off-by: Jordan Niethe --- arch/powerpc/kernel/process.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 048d64c4e115..b3f73e398d00 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1292,7 +1292,8 @@ void show_user_instructions(struct pt_regs *regs) unsigned long pc; int n = NR_INSN_TO_PRINT; struct seq_buf s; - char buf[96]; /* enough for 8 times 9 + 2 chars */ + char buf[8 * sizeof("0x00000000 0x00000000") + 2]; + struct ppc_inst instr; pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int)); @@ -1303,14 +1304,15 @@ void show_user_instructions(struct pt_regs *regs) seq_buf_clear(&s); - for (i = 0; i < 8 && n; i++, n--, pc += sizeof(int)) { - int instr; + for (i = 0; i < 8 && n; i++, n--, pc += ppc_inst_len(instr)) { - if (probe_user_read(&instr, (void __user *)pc, sizeof(instr))) { + if (probe_user_read_inst(&instr, (void __user *)pc)) { seq_buf_printf(&s, "XXXXXXXX "); + instr = ppc_inst(PPC_INST_NOP); continue; } - seq_buf_printf(&s, regs->nip == pc ? "<%08x> " : "%08x ", instr); + seq_buf_printf(&s, regs->nip == pc ? "<%s> " : "%s ", + ppc_inst_as_str(instr)); } if (!seq_buf_has_overflowed(&s)) From patchwork Tue Jun 2 05:27:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1302090 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgmy15bvz9sSc for ; Tue, 2 Jun 2020 15:38:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=U2vC+Z5w; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49bgmy0WS6zDqVB for ; Tue, 2 Jun 2020 15:38:10 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49bgY43lb0zDqLY for ; Tue, 2 Jun 2020 15:27:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=U2vC+Z5w; dkim-atps=neutral Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by bilbo.ozlabs.org (Postfix) with ESMTP id 49bgY31yFyz8tRw for ; Tue, 2 Jun 2020 15:27:51 +1000 (AEST) Received: by ozlabs.org (Postfix) id 49bgY270Byz9sSy; Tue, 2 Jun 2020 15:27:50 +1000 (AEST) Delivered-To: linuxppc-dev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=jniethe5@gmail.com; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=U2vC+Z5w; dkim-atps=neutral Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bgY25Tqsz9sSn for ; Tue, 2 Jun 2020 15:27:50 +1000 (AEST) Received: by mail-wm1-x344.google.com with SMTP id l26so1582701wme.3 for ; Mon, 01 Jun 2020 22:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VvZkYrE/ElD8+bLPqa0flL0yq6OinHZAHyvZH+R7fXo=; b=U2vC+Z5w9Dg5miJQ+cwMHr47yPjI5Z5S63UHzPgk0KgIycWdGMFbm2cFXiN0b/cvBT upj4run3EdUnFFHyYTwy++0wfXEFAq6KhFquk0Yl81F0MugryrKqKa9KhD9m1yf9BGWi lOSs9rrp0nS0GuNMlhUmsxDtmjoQMzQFhZfVpth6yQZc4LaNXHpsof+UagHSyjufrLYJ S+67awGwmS6lxamZkrEAjpES1dvvwBPiVTtVMLwlJomvUjV8ZkZiww4dlDAwigHdBnFS cmp/tYklBdCs91YMISiFnm5sg/KOyMivuwbJOqptdG5VYJK2WJxDR0dBq7Tu5nkTTppr AtBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VvZkYrE/ElD8+bLPqa0flL0yq6OinHZAHyvZH+R7fXo=; b=ekd1aIbMzn+fQGM8VlfYZtTOYA6A345HUpX8DyUnuZK4GsvbulEQuewvYkwhDFOj1q HSv+JSC0TSi+UxRYZTPMx8g/lieGVcrNSjAYqHhYb1W2ZlkaEp8LUiwoy9Kgn+p8HQhn ZQ9UvLrVboRE8n4nXA2URQfO/g+IffJz8Sp8Cm9tX6EuP/NfyEt5XqFi/DapqKlkNLK8 Feff2WY492roZmjeSfahtEdhKfsmI4qcOxIXtPIBo+UdNzksu6r8a+4YBaA3/DBDqoRU TkiZ4tswgI0uW/ryAKze2IKCtTqsEKbI1qPq18Zh38NsC6AmvBrCFJrPjT3aRU0UYsht i4Pw== X-Gm-Message-State: AOAM532DkRHdT+MgDCv6jh/VzTKjiVLatTk8jyGQPCAEWPQgPQJ+/DMb HFCAgwPusUE3VQVOgsee9G4DLQLm X-Google-Smtp-Source: ABdhPJxIgaAyfRrECNEy7BrJ9dai6lBFekiJGpQ7Gyvt/wbuBCbATFp5zyBLylcNReaGV5WnYWYBNw== X-Received: by 2002:a1c:bc42:: with SMTP id m63mr2420084wmf.11.1591075667793; Mon, 01 Jun 2020 22:27:47 -0700 (PDT) Received: from localhost.localdomain (180-150-65-4.b49641.syd.nbn.aussiebb.net. [180.150.65.4]) by smtp.gmail.com with ESMTPSA id a124sm1831336wmh.4.2020.06.01.22.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 22:27:47 -0700 (PDT) From: Jordan Niethe To: linuxppc-dev@ozlabs.org Subject: [PATCH 4/4] powerpc: Handle prefixed instructions in show_instructions() Date: Tue, 2 Jun 2020 15:27:28 +1000 Message-Id: <20200602052728.18227-4-jniethe5@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602052728.18227-1-jniethe5@gmail.com> References: <20200602052728.18227-1-jniethe5@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Niethe , alistair@popple.id.au Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently show_instructions() treats prefixed instructions as two separate word instructions. '<' and '>' are placed around the instruction at the NIP, but as a result they only wrap around the prefix. Make '<' and '>' straddle the whole prefixed instruction. Currently showing a prefixed instruction looks like: Instruction dump: 60000000 60000000 60000000 60000000 60000000 60000000 60000000 60000000 60000000 60000000 60000000 60000000 <04000000> 00000000 60000000 60000000 Make it look like: Instruction dump: 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 0x60000000 <0x04000000 0x00000000> 0x60000000 0x60000000 0x60000000 Signed-off-by: Jordan Niethe --- arch/powerpc/kernel/process.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index b3f73e398d00..bcd7277a9395 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1258,7 +1258,7 @@ static void show_instructions(struct pt_regs *regs) printk("Instruction dump:"); for (i = 0; i < NR_INSN_TO_PRINT; i++) { - int instr; + struct ppc_inst instr; if (!(i % 8)) pr_cont("\n"); @@ -1272,16 +1272,17 @@ static void show_instructions(struct pt_regs *regs) #endif if (!__kernel_text_address(pc) || - probe_kernel_address((const void *)pc, instr)) { + probe_kernel_read_inst(&instr, (struct ppc_inst *)pc)) { + instr = ppc_inst(PPC_INST_NOP); pr_cont("XXXXXXXX "); } else { if (regs->nip == pc) - pr_cont("<%08x> ", instr); + pr_cont("<%s> ", ppc_inst_as_str(instr)); else - pr_cont("%08x ", instr); + pr_cont("%s ", ppc_inst_as_str(instr)); } - pc += sizeof(int); + pc += ppc_inst_len(instr); } pr_cont("\n");