Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp163100rdb; Sat, 16 Dec 2023 04:16:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQY/DyggCfljdvudy9BclnnYdJa72+n+mT5DTkbfyHUg+didNlc1iqNRsV6NZzRN/0QIrI X-Received: by 2002:a05:6808:1805:b0:3b9:e2a5:d654 with SMTP id bh5-20020a056808180500b003b9e2a5d654mr15377520oib.28.1702728960641; Sat, 16 Dec 2023 04:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702728960; cv=none; d=google.com; s=arc-20160816; b=pWNudcQ1QuIaqSjbFUOvITyD9rhLHgbQpXVvhz288D6vh5ItoPTqUt/TNFC42hcncz YBPxHVyGuXdUmFtu2vJrASsYfKXvVv0B+hKF2CnML6WWmz9rWKsHIpAwmvlDqUPMc7YF rpDQKUogD7azGznPEBEnO4gQjHKSI42Ei9hBs92d6OFguszJ8yLnDi2AxTdrQzW9KslV RY5jjzAxEGZGkoHRyH3iJM1Y4YUgqZ8rSw16MpWF25DbifZ+b0Gluj4xkY7Wdnp31EFe adOBafdG1PvgI502s71Q5AAJlaQMoiYm0lSOmXDMhd6c5vB1mWQIMCoTntWOx/ydeenY H3ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Bn8is9GVKhldU/kxPrASEu34CnDYLSjp1JhUXvbT6sc=; fh=iBkwyquSM07JLmMl38kkUDLDrMhTS2ZRArZtrpQgES4=; b=vfWGGQSJXy3zz5cG/m2q5MRv8j8LUzIP2V86tJarcXEsGsUZFWa94+u6sGkLVag9Tu zwTO1dq4hKOr4OhxzAMrA+JwYSxEuRcjmXq8tAS+XUEm+1ag84uTHmIuE87JJj2oG8z8 cGEBb17Td/o74VNg76C9VhehC3DYsheHjv+cwhzUHudYkbMN61b5KQDTslfEDgXllUey z2ejnMZCbqXM2Gc0sKFUocUD84TKjlsnWgy7st0LES6niTVa1jenGhP6M5Vi+F7TQCuM 3R7f8n7JETtDoNUDv5yOkMIMo+qxA68mArnV4J17nLM/TH1WsNtPPBqZccyWAtryW4jB 6n0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n909PnMs; spf=pass (google.com: domain of linux-kernel+bounces-2173-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b31-20020a631b5f000000b005c658c16acesi14332717pgm.232.2023.12.16.04.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 04:16:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2173-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n909PnMs; spf=pass (google.com: domain of linux-kernel+bounces-2173-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8DE9DB2361C for ; Sat, 16 Dec 2023 12:15:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D13AD30108; Sat, 16 Dec 2023 12:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n909PnMs" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1013B2E83D for ; Sat, 16 Dec 2023 12:15:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89C83C433C7 for ; Sat, 16 Dec 2023 12:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702728935; bh=zWnJphzweoz7F+QrRhD2anzikZZpOjRmcdAuPKKE6YY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=n909PnMsEAebADQStAwNBVmYruNwK9Y0UwtzcfdVKrJwASESID/SiUEdEylDqvPo+ 25mTano9Cop824JBZbUTwSDw/sVPq2Xdqmirt4uOXNZDc3cLiE2eEIm4xUJHytwZOE F5taDiHf560qSOY33/i5/pfXRX/9Ao4RIDyJjCnrKSF5YXO8S0iIpRsl2fyDMUZ5Xa DLhPl0TKsIWNxLmqLSDR+oaBhQQrpxDzk1JZtosxQFIDJMuxxHTE3vybXpnRix5poI GkIATXDZSpBz2Y9V9ziT86YEABgwsSkYSZGrpJWwyvezeQZJk275xm7BReXi4FqJAM mvlOJb4386sOg== Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-551c03ae050so1672811a12.2 for ; Sat, 16 Dec 2023 04:15:35 -0800 (PST) X-Gm-Message-State: AOJu0YzasCh4nzXngeGkAy3nAgPH/CAfHPiGrbEPrcdDAFavsVMOEGJ0 SFfFy98/GkYwZDadnQcKEB8gPgqBqaapZI4o4qQ= X-Received: by 2002:a17:906:dfd0:b0:a19:a19a:eabd with SMTP id jt16-20020a170906dfd000b00a19a19aeabdmr6683403ejc.118.1702728934047; Sat, 16 Dec 2023 04:15:34 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Huacai Chen Date: Sat, 16 Dec 2023 20:15:22 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] scripts/decodecode: Add support for LoongArch To: Youling Tang Cc: Andrew Morton , linux-kernel@vger.kernel.org, Youling Tang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Acked-by: Huacai Chen On Sat, Dec 16, 2023 at 2:58=E2=80=AFPM Youling Tang wrote: > > From: Youling Tang > > An example how to invoke decodecode for loongarch64: > $ echo 'Code: 380839f6 380831f9 28412bae <24000ca6> > 004081ad 0014cb50 004083e8 02bff34c 58008e91' | \ > ARCH=3Dloongarch CROSS_COMPILE=3Dloongarch64-linux-gnu- \ > ./scripts/decodecode > Code: 380839f6 380831f9 28412bae <24000ca6> 004081ad 0014cb50 004083e8 02= bff34c 58008e91 > All code > =3D=3D=3D=3D=3D=3D=3D=3D > 0: 380839f6 ldx.w $fp, $t3, $t2 > 4: 380831f9 ldx.w $s2, $t3, $t0 > 8: 28412bae ld.h $t2, $s6, 74(0x4a) > c:* 24000ca6 ldptr.w $a2, $a1, 12(0xc) <= -- trapping instruction > 10: 004081ad slli.w $t1, $t1, 0x0 > 14: 0014cb50 and $t4, $s3, $t6 > 18: 004083e8 slli.w $a4, $s8, 0x0 > 1c: 02bff34c addi.w $t0, $s3, -4(0xffc) > 20: 58008e91 beq $t8, $t5, 140(0x8c) # 0xac > > Code starting with the faulting instruction > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 0: 24000ca6 ldptr.w $a2, $a1, 12(0xc) > 4: 004081ad slli.w $t1, $t1, 0x0 > 8: 0014cb50 and $t4, $s3, $t6 > c: 004083e8 slli.w $a4, $s8, 0x0 > 10: 02bff34c addi.w $t0, $s3, -4(0xffc) > 14: 58008e91 beq $t8, $t5, 140(0x8c) # 0xa0 > > Signed-off-by: Youling Tang > --- > scripts/decodecode | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/scripts/decodecode b/scripts/decodecode > index 8fe71c292381..6364218b2178 100755 > --- a/scripts/decodecode > +++ b/scripts/decodecode > @@ -67,6 +67,7 @@ if [ -z "$ARCH" ]; then > case `uname -m` in > aarch64*) ARCH=3Darm64 ;; > arm*) ARCH=3Darm ;; > + loongarch*) ARCH=3Dloongarch ;; > esac > fi > > @@ -98,6 +99,10 @@ disas() { > ${CROSS_COMPILE}strip $t.o > fi > > + if [ "$ARCH" =3D "loongarch" ]; then > + ${CROSS_COMPILE}strip $t.o > + fi > + > if [ $pc_sub -ne 0 ]; then > if [ $PC ]; then > adj_vma=3D$(( $PC - $pc_sub )) > -- > 2.40.0 >