From nobody Tue Feb 10 05:45:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1619544196; cv=none; d=zohomail.com; s=zohoarc; b=YAENhgOF6DBR/YkxDwM7W6CPOpslFBehTv2IqQb5arVOi3dJ7HBVD+MajHafn5vnXts4ikmCZ8IrYP24zHGcNPOPbsn/JAjiGraNwoHpL9iSlQz4XASybRCiVHU8dTK5mHG3MExFf7PSxLzvEltcKyVJElNwhIC0PYLfI+L4KZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619544196; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wvg9WjX7UAO8KXTCCv7ywlSMjmb3tOgzFJrxv4AFZHA=; b=ks9yFzc3jDjOkJOWtMERg5yamE7A3C0D/9rN4QO6fEBuqQbVegIcuJqxF5Mv2xT2lmmNzFhA/omWtg/ycCg5kqOo0HPTKIS0MvsxW78kZau7wXtLgyeVGvxlL5QyCQ1n1FhWl52ESIXEcijsxX3bUnMrciJoDvAuS29AORswMhY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619544196845339.71152832315806; Tue, 27 Apr 2021 10:23:16 -0700 (PDT) Received: from localhost ([::1]:43106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRQZ-00048y-M9 for importer@patchew.org; Tue, 27 Apr 2021 13:23:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbRLa-0001Gx-FR; Tue, 27 Apr 2021 13:18:06 -0400 Received: from [201.28.113.2] (port=48284 helo=outlook.eldorado.org.br) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbRLY-00023I-SP; Tue, 27 Apr 2021 13:18:06 -0400 Received: from power9a ([10.10.71.235]) by outlook.eldorado.org.br with Microsoft SMTPSVC(8.5.9600.16384); Tue, 27 Apr 2021 14:16:52 -0300 Received: from eldorado.org.br (unknown [10.10.70.45]) by power9a (Postfix) with ESMTP id 166EC8013BA; Tue, 27 Apr 2021 14:16:52 -0300 (-03) From: Luis Pires To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH v2 01/15] decodetree: Add support for 64-bit instructions Date: Tue, 27 Apr 2021 14:16:35 -0300 Message-Id: <20210427171649.364699-2-luis.pires@eldorado.org.br> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427171649.364699-1-luis.pires@eldorado.org.br> References: <20210427171649.364699-1-luis.pires@eldorado.org.br> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 27 Apr 2021 17:16:52.0277 (UTC) FILETIME=[1D889E50:01D73B89] X-Host-Lookup-Failed: Reverse DNS lookup failed for 201.28.113.2 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=201.28.113.2; envelope-from=luis.pires@eldorado.org.br; helo=outlook.eldorado.org.br X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, f4bug@amsat.org, Luis Pires , lagarcia@br.ibm.com, bruno.larsen@eldorado.org.br, matheus.ferst@eldorado.org.br, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Allow '64' to be specified for the instruction width command line params and use the appropriate insn/field data types, mask, extract and deposit functions in that case. This will be used to implement the new 64-bit Power ISA 3.1 instructions. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Luis Pires Message-Id: Signed-off-by: Richard Henderson --- docs/devel/decodetree.rst | 5 +++-- scripts/decodetree.py | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst index 74f66bf46e..d776dae14f 100644 --- a/docs/devel/decodetree.rst +++ b/docs/devel/decodetree.rst @@ -40,8 +40,9 @@ and returns an integral value extracted from there. =20 A field with no ``unnamed_fields`` and no ``!function`` is in error. =20 -FIXME: the fields of the structure into which this result will be stored -is restricted to ``int``. Which means that we cannot expand 64-bit items. +The fields of the structure into which this result will be stored are +defined as ``int`` when the instruction size is set to 16 or 32 bits +and as ``int64_t`` when the instruction size is set to 64 bits. =20 Field examples: =20 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 4637b633e7..26156dfc36 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -42,6 +42,10 @@ output_fd =3D None insntype =3D 'uint32_t' decode_function =3D 'decode' +field_data_type =3D 'int' +extract_function =3D 'extract32' +sextract_function =3D 'sextract32' +deposit_function =3D 'deposit32' =20 # An identifier for C. re_C_ident =3D '[a-zA-Z][a-zA-Z0-9_]*' @@ -185,9 +189,9 @@ def __str__(self): =20 def str_extract(self): if self.sign: - extr =3D 'sextract32' + extr =3D sextract_function else: - extr =3D 'extract32' + extr =3D extract_function return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len) =20 def __eq__(self, other): @@ -215,8 +219,9 @@ def str_extract(self): if pos =3D=3D 0: ret =3D f.str_extract() else: - ret =3D 'deposit32({0}, {1}, {2}, {3})' \ - .format(ret, pos, 32 - pos, f.str_extract()) + ret =3D '{4}({0}, {1}, {2}, {3})' \ + .format(ret, pos, insnwidth - pos, + f.str_extract(), deposit_function) pos +=3D f.len return ret =20 @@ -311,7 +316,7 @@ def output_def(self): if not self.extern: output('typedef struct {\n') for n in self.fields: - output(' int ', n, ';\n') + output(' ', field_data_type, ' ', n, ';\n') output('} ', self.struct_name(), ';\n\n') # end Arguments =20 @@ -1264,6 +1269,10 @@ def main(): global insntype global insnmask global decode_function + global extract_function + global sextract_function + global deposit_function + global field_data_type global variablewidth global anyextern =20 @@ -1293,6 +1302,13 @@ def main(): if insnwidth =3D=3D 16: insntype =3D 'uint16_t' insnmask =3D 0xffff + elif insnwidth =3D=3D 64: + insntype =3D 'uint64_t' + insnmask =3D 0xffffffffffffffff + field_data_type =3D 'int64_t' + extract_function =3D 'extract64' + sextract_function =3D 'sextract64' + deposit_function =3D 'deposit64' elif insnwidth !=3D 32: error(0, 'cannot handle insns of width', insnwidth) else: --=20 2.25.1