From nobody Tue Nov 11 03:16:16 2025 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=1560920873; cv=none; d=zoho.com; s=zohoarc; b=Q0GPBwg9esDwyFEEf+eeBoqN5QHHxJiVJKZ+tZZEvs0Vcqw3ta46Mpxn1oqMK4bKcfcdRCcd7qFZ2OgH/CMfF6hWx6vjy62aLNADRHQPVQalBEQSjlisTKVSj0TX1LMMw5N/c15ArA8VomJL/kiKCHUkYfNT8Z++8MfI5RqV2iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560920873; 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=2AL1b+nMXBf7cujyRtXqMsJ+EqszwrRf6hdCVJcNcgk=; b=hq0FXtDtoRPvUS3w8G6dX4vhEa/1/S/vmgl8wCrK1ArW3jTl0ZqZ9sot2bhBGZ5oZMSnmwkyd3/aNvHPoB4IADVWB3swyoDDQcOsGoils6WGGTFD7wAHc0Gj/A79p6Yoi40Tw6saZgNWhcWc3A1s2Z55Jh2UBInEe6V5YWXwri8= 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 1560920873216207.00794574370946; Tue, 18 Jun 2019 22:07:53 -0700 (PDT) Received: from localhost ([::1]:35160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdSox-0005vu-R1 for importer@patchew.org; Wed, 19 Jun 2019 01:07:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34420) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdSmT-0003uC-Ie for qemu-devel@nongnu.org; Wed, 19 Jun 2019 01:05:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdSmR-0001eo-Lv for qemu-devel@nongnu.org; Wed, 19 Jun 2019 01:05:09 -0400 Received: from mail-yb1-xb44.google.com ([2607:f8b0:4864:20::b44]:45565) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hdSmP-0001dC-Ob for qemu-devel@nongnu.org; Wed, 19 Jun 2019 01:05:05 -0400 Received: by mail-yb1-xb44.google.com with SMTP id v104so7061841ybi.12 for ; Tue, 18 Jun 2019 22:05:05 -0700 (PDT) Received: from localhost.localdomain (67-9-99-67.biz.bhn.net. [67.9.99.67]) by smtp.gmail.com with ESMTPSA id e12sm1714426ywe.85.2019.06.18.22.05.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 22:05:04 -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=2AL1b+nMXBf7cujyRtXqMsJ+EqszwrRf6hdCVJcNcgk=; b=aMb2IimZL2r6VQHh2dR+iKTXQXASyiRNX6y/XDqg2TNVsOxrjyONpkUGNZm37+cW3V Kchl5gvfDBwfDF8ZkQR0Nqiv5Mpvc7yo4OmYX+//t92yQGEjkCOeYJbjv2SiSKDnBJtA Rv/t85GnGnZfWVem42i7OxUkr/WRvjgwUFv9phAea6mMC09lLTKiTHQRdq8vETYw2xF5 Ej2JI1366Rf1zoQIzjkS+XRbvLW9yt2ncHvN0JU1p7rk9g6a7acetr3hxcB4ipEq5icB Rl49pH5zCKcc88P4ljuNyfv5p5k4Fd/cVjoEMilCHeNKv+IFl4bpTHGUVJKeqHELcccL 0dyA== 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=2AL1b+nMXBf7cujyRtXqMsJ+EqszwrRf6hdCVJcNcgk=; b=U6p/oz2Ej0QxvgtTOtL2c8CvBaF5dTpzpmLrMHHjx2Q+yJT5AN203KjsA59FZE6NUH 5MGsMGdezWZvVZIhEr1F93ph8C88V9aImxm+qr75yj6lKduynnnoO/TA8HamBE6xSi5H 5c+4L3fpB0fwyiMPhCn6LPoOxUx1WPs8w7vLcmcndkdxbzAQzsf8QCv8ou43oMkw/XSO rYtpvvRZBz9Iw4u95aXIjFU/5mhTsw07ogCwibUdeVBykj70LsoNIjIlUf+ukE00FtYl WoUP3fDiIf+JTayZOjq1/PZXkfdVQWiBinsochjLvPwbBHWBVc3+vaRAD3NdgJv/s9EA Am6Q== X-Gm-Message-State: APjAAAVuCcRGysE4/xpJaocF+W0Xg0IFyMeoGRi2UKMpQBVhrR9f8J2q p0n4gW57kwLYNkLRCS9XK0GIVq3q X-Google-Smtp-Source: APXvYqyGrJIzp0FKOlN6d7zRMGMNPeugaKgK1XCn5WVhk2jJxDCOyr1DapNBNmvQiB3/oHx2ah2T1w== X-Received: by 2002:a25:e80b:: with SMTP id k11mr4060163ybd.434.1560920704814; Tue, 18 Jun 2019 22:05:04 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 01:04:43 -0400 Message-Id: <20190619050447.22201-4-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619050447.22201-1-jan.bobek@gmail.com> References: <20190619050447.22201-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::b44 Subject: [Qemu-devel] [RISU RFC PATCH v1 3/7] 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 | 85 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 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..0e3cc1c --- /dev/null +++ b/risugen_x86_emit.pm @@ -0,0 +1,85 @@ +#!/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 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