From patchwork Fri Feb 24 17:35:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 94497 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp796515qgi; Fri, 24 Feb 2017 09:44:38 -0800 (PST) X-Received: by 10.55.148.1 with SMTP id w1mr3696340qkd.186.1487958277981; Fri, 24 Feb 2017 09:44:37 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 3si6105968qkr.154.2017.02.24.09.44.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 24 Feb 2017 09:44:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJv1-0002Lc-K9 for patch@linaro.org; Fri, 24 Feb 2017 12:44:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1chJmM-0003rr-DG for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:35:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1chJmL-0004nt-DA for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:35:38 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:48641) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1chJmL-0004Og-5R for qemu-devel@nongnu.org; Fri, 24 Feb 2017 12:35:37 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1chJmD-0008KT-Nu; Fri, 24 Feb 2017 17:35:29 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 24 Feb 2017 17:35:20 +0000 Message-Id: <1487957728-8354-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487957728-8354-1-git-send-email-peter.maydell@linaro.org> References: <1487957728-8354-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH risu 1/9] Drop the weird modification of a ucontext in the ppc reginfo_is_eq() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Nikunj A Dadhania Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The PPC reginfo_is_eq() has some weird code which tries to modify a ucontext_t in the middle of comparing the two registers. I don't understand this, but this is definitely not the right place to do anything like this. Drop the weird code. Signed-off-by: Peter Maydell --- risu_ppc64le.c | 4 ++-- risu_reginfo_ppc64le.c | 10 +--------- risu_reginfo_ppc64le.h | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/risu_ppc64le.c b/risu_ppc64le.c index 9c1fafd..1c986a9 100644 --- a/risu_ppc64le.c +++ b/risu_ppc64le.c @@ -89,7 +89,7 @@ int recv_and_compare_register_info(int sock, void *uc) if (recv_data_pkt(sock, &apprentice_ri, sizeof(apprentice_ri))) { packet_mismatch = 1; resp = 2; - } else if (!reginfo_is_eq(&master_ri, &apprentice_ri, uc)) { + } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { resp = 2; } else if (op == OP_TESTEND) { @@ -134,7 +134,7 @@ int report_match_status(void) fprintf(stderr, "master reginfo:\n"); reginfo_dump(&master_ri, 0); } - if (!reginfo_is_eq(&master_ri, &apprentice_ri, NULL)) { + if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { fprintf(stderr, "mismatch on regs!\n"); resp = 1; } diff --git a/risu_reginfo_ppc64le.c b/risu_reginfo_ppc64le.c index e6bc0e0..585d8b7 100644 --- a/risu_reginfo_ppc64le.c +++ b/risu_reginfo_ppc64le.c @@ -50,7 +50,7 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) } /* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ -int reginfo_is_eq(struct reginfo *m, struct reginfo *a, ucontext_t *uc) +int reginfo_is_eq(struct reginfo *m, struct reginfo *a) { int i; for (i = 0; i < 32; i++) { @@ -86,14 +86,6 @@ int reginfo_is_eq(struct reginfo *m, struct reginfo *a, ucontext_t *uc) m->vrregs.vrregs[i][1] != a->vrregs.vrregs[i][1] || m->vrregs.vrregs[i][2] != a->vrregs.vrregs[i][2] || m->vrregs.vrregs[i][3] != a->vrregs.vrregs[i][3]) { - - if (uc != NULL && (m->gregs[CCR] & 0x10)) { - uc->uc_mcontext.v_regs->vrregs[i][0] = a->vrregs.vrregs[i][0]; - uc->uc_mcontext.v_regs->vrregs[i][1] = a->vrregs.vrregs[i][1]; - uc->uc_mcontext.v_regs->vrregs[i][2] = a->vrregs.vrregs[i][2]; - uc->uc_mcontext.v_regs->vrregs[i][3] = a->vrregs.vrregs[i][3]; - return 1; - } return 0; } } diff --git a/risu_reginfo_ppc64le.h b/risu_reginfo_ppc64le.h index abe6002..49bb1aa 100644 --- a/risu_reginfo_ppc64le.h +++ b/risu_reginfo_ppc64le.h @@ -29,7 +29,7 @@ struct reginfo void reginfo_init(struct reginfo *ri, ucontext_t *uc); /* return 1 if structs are equal, 0 otherwise. */ -int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2, ucontext_t *uc); +int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2); /* print reginfo state to a stream */ void reginfo_dump(struct reginfo *ri, int is_master);