From patchwork Sat Oct 29 02:00:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13024456 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 386F0FA3741 for ; Sat, 29 Oct 2022 02:02:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oobAB-00007l-ND; Fri, 28 Oct 2022 22:01:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oobA1-000069-QG for qemu-devel@nongnu.org; Fri, 28 Oct 2022 22:01:22 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oobA0-0002aD-4m for qemu-devel@nongnu.org; Fri, 28 Oct 2022 22:01:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C29833200065; Fri, 28 Oct 2022 22:01:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 28 Oct 2022 22:01:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1667008878; x=1667095278; bh=Kz 7Z7k+bPnmutGT2CzsqAfsbFsWvfGVl+CZZN4GvZxc=; b=pq2lVl4k0FC70fcGSK WqSsc1eMNpKYLue4pEDo51vsMI+cb+1bh1Qh4//vjTe19a0DOYns/Cy+rCYHnz0T B7uoDKqZYswdWncLW5MVrI/N1djxIzse5XSb3DZXMKM4u6OD8nVzsXsaPI6vcoYl RZmSy8pjEy9SzduhSTfHW0Mlcl89475s+ro8sw7BE62UDqGoShVNgkF6wHzFvmLT r3e/8Z25bWgT1q7pXldXnyT/fMOPaTSTR8IdYwwCTOz3P81JzPJahcwTNz9EVNYG 9kIcXEn7jpJ3qsXBYuh33FBSMtxRxyjMCwuEctpGhtv6YbRJNHpDdH09uIACoSrM KSUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1667008878; x=1667095278; bh=Kz7Z7k+bPnmut GT2CzsqAfsbFsWvfGVl+CZZN4GvZxc=; b=tyoPerQz4UBItBBM/x3QxmOm8HlPZ tXhJD68O8xJuNCyMx+ERKscZmhiT5VQUbceCQVuBBCaT4eAoCojBbEXpS6GdI7Xs Gdk4UY/l3iPqO5aVzAzZp61cLdtlkqULDKvwJWfK882+zeIfOY2WnRT7ACBq8oKM sgGd49rk7Ms5w0ah/X03RZQIk5ULOPec39M3OiHDYhmcUPBc4udJws+51YbJmhqL x+IreQmpGa3kcynTbzenyQYB3Rb9Ww5mtmhQu90iCJ8948ZUwx9CsgeAayOadyKQ 7cKIy2hSyMJcL5IYkt5EIeh6lx/xhq9kjWH/aUVMfxfjnRBc/7AcY5vJg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrtdejgdehfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekre dtredttdenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhg sehflhihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpeefledufeehgedvuedvvd egkefgvddttedtleeiiefhgeetudegkefhvdfhjeeftdenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihgh horghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 Oct 2022 22:01:17 -0400 (EDT) From: Jiaxun Yang To: f4bug@amsat.org Cc: qemu-devel@nongnu.org, pavel.dovgalyuk@ispras.ru, Jiaxun Yang Subject: [PATCH 2/3] target/mips: Cast offset field of Octeon BBIT to int16_t Date: Sat, 29 Oct 2022 03:00:29 +0100 Message-Id: <20221029020030.13936-3-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) In-Reply-To: <20221029020030.13936-1-jiaxun.yang@flygoat.com> References: <20221029020030.13936-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=64.147.123.24; envelope-from=jiaxun.yang@flygoat.com; helo=wout1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org As per "Cavium Networks OCTEON Plus CN50XX Hardware Reference Manual" offset field is signed 16 bit value. However arg_BBIT.offset is unsigned. We need to cast it as signed to do address calculation. Signed-off-by: Jiaxun Yang --- target/mips/tcg/octeon_translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/mips/tcg/octeon_translate.c b/target/mips/tcg/octeon_translate.c index 6a207d2e7e..e8f2277c51 100644 --- a/target/mips/tcg/octeon_translate.c +++ b/target/mips/tcg/octeon_translate.c @@ -38,7 +38,7 @@ static bool trans_BBIT(DisasContext *ctx, arg_BBIT *a) } ctx->hflags |= MIPS_HFLAG_BC; - ctx->btarget = ctx->base.pc_next + 4 + a->offset * 4; + ctx->btarget = ctx->base.pc_next + 4 + (int16_t)a->offset * 4; ctx->hflags |= MIPS_HFLAG_BDS32; tcg_temp_free(t0);