From nobody Sun Feb 8 18:29:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1561955878; cv=none; d=zoho.com; s=zohoarc; b=X2ulDtuwQ5VGGzrvUIlt+Q25S+WvTq1Yj/Bk+cVBQ2gqyCFBWJ+hG2RRZQ1RHq02kNcLAPSqPnD+016KpO/uW7s5oEq33SgQsqtPwkDQatnYdVLX3UunTvhXKQGP/SEObOM3Eju5zhmuzYsCauGlIHr4cO5s/ESdYOe8v71Yqvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561955878; h=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:ARC-Authentication-Results; bh=LcJuHjY62NJio9do3DWquEyjV/4nLnI3M2tOGcRLLgo=; b=bcTmPYnpUzFZy8DW9QjXi+PfRvbBddL9Kkz5j1A56amlqTEDEGhaxYPfZb+OQVaKNyKPp5GJ9Z7v4YVfpW3V3iL5F0m6P5SwVkvjXGT8jH6k484NDtPlHTvFiP4FPVP/jY8s7rtUbQC9bQDzGmGFfMpAp2YBZ640ecb74zGaBdw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561955878234366.17236629313777; Sun, 30 Jun 2019 21:37:58 -0700 (PDT) Received: from localhost ([::1]:47654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hho4Z-0006aZ-VL for importer@patchew.org; Mon, 01 Jul 2019 00:37:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56628) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hho2p-0004tL-BK for qemu-devel@nongnu.org; Mon, 01 Jul 2019 00:36:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hho2o-0004Uo-4Y for qemu-devel@nongnu.org; Mon, 01 Jul 2019 00:35:59 -0400 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]:35604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hho2o-0004Ue-07 for qemu-devel@nongnu.org; Mon, 01 Jul 2019 00:35:58 -0400 Received: by mail-yb1-xb42.google.com with SMTP id p85so3332590yba.2 for ; Sun, 30 Jun 2019 21:35:57 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id k126sm1108564ywf.36.2019.06.30.21.35.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 21:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LcJuHjY62NJio9do3DWquEyjV/4nLnI3M2tOGcRLLgo=; b=HQT1IvT/VjeAh3Al7jYpzC7EC7MDZ3JVXhtQnkNQyBprEORb39GH6bMFaX+s2bQ9Wu mphtafIp0JjLxSniPui3EQxYnusIwF/Y4iOpJKURsLRjOelwTH1HeYAWbXatEKT4MaL9 pTRAFa849OVexd5uX+gXDLzhcdAvZ8NBXOuosQAqeZvZfx6OmdZzw6jVCvVTe2Qcsr4U OR9wkFXsRs3IWwo+snYx1yqrVtNvfYTgDI2Vkuo7Vdb5PKDd5HRxuPwl78QxklPaBVJw WNTwZyy73q73LshCbl87W718LJh/oea8qT41L1g4tV7VIMc9v493yGV9ie7Rey67aBXn jAXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LcJuHjY62NJio9do3DWquEyjV/4nLnI3M2tOGcRLLgo=; b=pi8BtHuNmYKqXdrzKQLj+oIK6XjPKd+NvxAUZv+REO0rIFUQ2s+2b2oWRs+eR9TUyy 2ofFodCNk5cuWBrAiOi+NFDujJgdV9jtKfGUPFo3IRnO3oMbxhDQcmHoA9ROlBEBgIhD peXn6ThcBsb9uaLXJkVpjSzmuAxzVWln2tKsjoAmNr9cCyEIRD29OrFUTZN4kzHJV1jN SbvdCvQ/tAGeetBrRrZ4W6u4SfZzPa72Q3yjoOMh0lV2Zc1/nti5/ruCFYyTo52vI0s2 /3rZONF5767/+UDiiEeDQmE8XHIUQGF8Z3F/69cqoZSJZV5RJBARidkJUNE+U+62xBIz GZUw== X-Gm-Message-State: APjAAAVmx7m5NPwxFtsUWxFsGaXOChANob6t4jgRAw4A9ht5+6E/To+1 QA9UBylj1UQCTmWzJp4urwJyyLQF X-Google-Smtp-Source: APXvYqyLlOvJwX/sAxOc8IMkXYAK53rtquQjBkoGIHRQ6QU29sUpwmJs7pgAGB8NR1H57hEsT6yEqQ== X-Received: by 2002:a25:d38a:: with SMTP id e132mr2830720ybf.404.1561955757408; Sun, 30 Jun 2019 21:35:57 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Mon, 1 Jul 2019 00:35:25 -0400 Message-Id: <20190701043536.26019-4-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190701043536.26019-1-jan.bobek@gmail.com> References: <20190701043536.26019-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b42 Subject: [Qemu-devel] [RISU RFC PATCH v2 03/14] risugen_x86_emit: add module 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The helper module risugen_x86_emit.pm exports a single function "parse_emitblock", which serves to capture and return instruction constraints described by "emit" blocks in an x86 configuration file. Signed-off-by: Jan Bobek --- risugen | 2 +- risugen_x86_emit.pm | 91 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 risugen_x86_emit.pm diff --git a/risugen b/risugen index e690b18..fe3d00e 100755 --- a/risugen +++ b/risugen @@ -43,7 +43,7 @@ my @pattern_re =3D (); # include pattern my @not_pattern_re =3D (); # exclude pattern =20 # Valid block names (keys in blocks hash) -my %valid_blockname =3D ( constraints =3D> 1, memory =3D> 1 ); +my %valid_blockname =3D ( constraints =3D> 1, memory =3D> 1, emit =3D> 1 ); =20 sub parse_risu_directive($$@) { diff --git a/risugen_x86_emit.pm b/risugen_x86_emit.pm new file mode 100644 index 0000000..127a524 --- /dev/null +++ b/risugen_x86_emit.pm @@ -0,0 +1,91 @@ +#!/usr/bin/perl -w +##########################################################################= ##### +# Copyright (c) 2019 Linaro Limited +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jan Bobek - initial implementation +##########################################################################= ##### + +# risugen_x86_emit -- risugen_x86's helper module for emit blocks +package risugen_x86_emit; + +use strict; +use warnings; + +use risugen_common; +use risugen_x86_asm; + +our @ISA =3D qw(Exporter); +our @EXPORT =3D qw(parse_emitblock); + +my $emit_opts; + +sub rep(%) +{ + my (%opts) =3D @_; + $emit_opts->{rep} =3D \%opts; +} + +sub repne(%) +{ + my (%opts) =3D @_; + $emit_opts->{repne} =3D \%opts; +} + +sub data16(%) +{ + my (%opts) =3D @_; + $emit_opts->{data16} =3D \%opts; +} + +sub rex(%) +{ + my (%opts) =3D @_; + $emit_opts->{rex} =3D \%opts; +} + +sub vex(%) +{ + my (%opts) =3D @_; + $emit_opts->{vex} =3D \%opts; +} + +sub modrm(%) +{ + my (%opts) =3D @_; + $emit_opts->{modrm} =3D \%opts; +} + +sub mem(%) +{ + my (%opts) =3D @_; + $emit_opts->{mem} =3D \%opts; +} + +sub imm(%) +{ + my (%opts) =3D @_; + $emit_opts->{imm} =3D \%opts; +} + +sub parse_emitblock($$) +{ + my ($rec, $insn) =3D @_; + my $insnname =3D $rec->{name}; + my $opcode =3D $insn->{opcode}{value}; + + $emit_opts =3D {}; + + my $emitblock =3D $rec->{blocks}{"emit"}; + if (defined $emitblock) { + eval_with_fields($insnname, $opcode, $rec, "emit", $emitblock); + } + + return $emit_opts; +} + +1; --=20 2.20.1