{"id":807400,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807400/?format=json","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.0/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<1504066360-30128-9-git-send-email-paulus@ozlabs.org>","date":"2017-08-30T04:12:31","name":"[v3,08/17] powerpc: Add emulation for the addpcis instruction","commit_ref":"958465ee5407dc1b25ba6eb33f0e8bb6179960ee","pull_url":null,"state":"accepted","archived":false,"hash":"b4431b898697144c4accd3895a957829cd16b510","submitter":{"id":67079,"url":"http://patchwork.ozlabs.org/api/1.0/people/67079/?format=json","name":"Paul Mackerras","email":"paulus@ozlabs.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504066360-30128-9-git-send-email-paulus@ozlabs.org/mbox/","series":[{"id":522,"url":"http://patchwork.ozlabs.org/api/1.0/series/522/?format=json","date":"2017-08-30T04:12:25","name":"powerpc: Do alignment fixups using analyse_instr etc.","version":3,"mbox":"http://patchwork.ozlabs.org/series/522/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807400/checks/","tags":{},"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhsvf1rFNz9s9Y\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 14:28:46 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhsvf0RrkzDqHw\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 30 Aug 2017 14:28:46 +1000 (AEST)","from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xhsYH3LTdzDqGV\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 30 Aug 2017 14:12:51 +1000 (AEST)","by ozlabs.org (Postfix)\n\tid 3xhsYH2jchz9sPt; Wed, 30 Aug 2017 14:12:51 +1000 (AEST)","from authenticated.ozlabs.org (localhost [127.0.0.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPSA id 3xhsYH1dG8z9sP5\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 30 Aug 2017 14:12:51 +1000 (AEST)"],"Authentication-Results":["ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"qabb6+fP\";\n\tdkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"qabb6+fP\";\n\tdkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=ozlabs.org header.i=@ozlabs.org header.b=\"qabb6+fP\"; \n\tdkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; \n\tt=1504066371; bh=aDTv4F2mAhl6ufj0c/USJnYv14ju3IagtRkWwTLYu1I=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=qabb6+fPpm2oQtl6hz/XMlriDSD10lAVxHb7xMdohsDyx8ZYnXy7+ksGDVEY+sPMD\n\tyCcl1EDn8deBs9yNrgwCOIZ024wRllP8nFBxVnLm+526EcOW2XmUwScRNNLqCA/Tn3\n\tFmlB+vjnJCnnlGvagCRi/b25E7ctsqH0+bUicNCKHra6N/tzUYXxlongyF6gAQLFKH\n\tilTPgiuFrO8oXuialgTfbM9Hl6a/fjld7UPT5Uz+2Ulov4UPnugVMOefL2fgHvP+dV\n\txbYr+sWdDJvGEB0hl8lTxljz15jxyKV90pguquIJwp4ZSokvBmgqNaBi3HU3qw9j3k\n\tQOy2pFPkSuwAg==","From":"Paul Mackerras <paulus@ozlabs.org>","To":"linuxppc-dev@ozlabs.org","Subject":"[PATCH v3 08/17] powerpc: Add emulation for the addpcis instruction","Date":"Wed, 30 Aug 2017 14:12:31 +1000","Message-Id":"<1504066360-30128-9-git-send-email-paulus@ozlabs.org>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1504066360-30128-1-git-send-email-paulus@ozlabs.org>","References":"<1504066360-30128-1-git-send-email-paulus@ozlabs.org>","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"The addpcis instruction puts the sum of the next instruction address\nplus a constant into a register.  Since the result depends on the\naddress of the instruction, it will give an incorrect result if it\nis single-stepped out of line, which is what the *probes subsystem\nwill currently do if a probe is placed on an addpcis instruction.\nThis fixes the problem by adding emulation of it to analyse_instr().\n\nSigned-off-by: Paul Mackerras <paulus@ozlabs.org>\n---\n arch/powerpc/lib/sstep.c | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)","diff":"diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c\nindex 114e597..ed2bc4c 100644\n--- a/arch/powerpc/lib/sstep.c\n+++ b/arch/powerpc/lib/sstep.c\n@@ -1021,9 +1021,6 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,\n \t\t\top->ccval = (regs->ccr & ~(1UL << (31 - rd))) |\n \t\t\t\t(val << (31 - rd));\n \t\t\treturn 1;\n-\t\tdefault:\n-\t\t\top->type = UNKNOWN;\n-\t\t\treturn 0;\n \t\t}\n \t\tbreak;\n \tcase 31:\n@@ -1123,6 +1120,17 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,\n \t\top->val = imm;\n \t\tgoto compute_done;\n \n+\tcase 19:\n+\t\tif (((instr >> 1) & 0x1f) == 2) {\n+\t\t\t/* addpcis */\n+\t\t\timm = (short) (instr & 0xffc1);\t/* d0 + d2 fields */\n+\t\t\timm |= (instr >> 15) & 0x3e;\t/* d1 field */\n+\t\t\top->val = regs->nip + (imm << 16) + 4;\n+\t\t\tgoto compute_done;\n+\t\t}\n+\t\top->type = UNKNOWN;\n+\t\treturn 0;\n+\n \tcase 20:\t/* rlwimi */\n \t\tmb = (instr >> 6) & 0x1f;\n \t\tme = (instr >> 1) & 0x1f;\n","prefixes":["v3","08/17"]}