From patchwork Fri Aug 21 19:43:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 43197 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7LJhApi026712 for ; Fri, 21 Aug 2009 19:43:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755828AbZHUTlc (ORCPT ); Fri, 21 Aug 2009 15:41:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755823AbZHUTlb (ORCPT ); Fri, 21 Aug 2009 15:41:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755821AbZHUTla (ORCPT ); Fri, 21 Aug 2009 15:41:30 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7LJeXUM024358; Fri, 21 Aug 2009 15:40:33 -0400 Received: from localhost.localdomain (dhcp-100-3-156.bos.redhat.com [10.16.3.156]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7LJeAdf002455; Fri, 21 Aug 2009 15:40:19 -0400 From: Masami Hiramatsu Subject: [PATCH tracing/kprobes 2/4] x86: Check awk features before generating inat-tables.c To: Frederic Weisbecker , Steven Rostedt , lkml Cc: systemtap , kvm , DLE , Masami Hiramatsu , Jim Keniston , "H. Peter Anvin" , Ananth N Mavinakayanahalli , Avi Kivity , Andi Kleen , Christoph Hellwig , "Frank Ch. Eigler" , Frederic Weisbecker , Ingo Molnar , Jason Baron , "K.Prasad" , Lai Jiangshan , Li Zefan , =?utf-8?q?Przemys=C5=82aw?= =?utf-8?q?Pawe=C5=82czyk?= , Roland McGrath , Sam Ravnborg , Srikar Dronamraju , Steven Rostedt , Tom Zanussi , Vegard Nossum Date: Fri, 21 Aug 2009 15:43:16 -0400 Message-ID: <20090821194316.12478.57394.stgit@localhost.localdomain> In-Reply-To: <20090821000108.GC6078@nowhere> References: <20090821000108.GC6078@nowhere> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Check some awk features which old mawk doesn't support. Signed-off-by: Masami Hiramatsu Cc: Jim Keniston Cc: H. Peter Anvin Cc: Ananth N Mavinakayanahalli Cc: Avi Kivity Cc: Andi Kleen Cc: Christoph Hellwig Cc: Frank Ch. Eigler Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jason Baron Cc: K.Prasad Cc: Lai Jiangshan Cc: Li Zefan Cc: Przemysław Pawełczyk Cc: Roland McGrath Cc: Sam Ravnborg Cc: Srikar Dronamraju Cc: Steven Rostedt Cc: Tom Zanussi Cc: Vegard Nossum --- arch/x86/tools/gen-insn-attr-x86.awk | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk index 93b62c9..19ba096 100644 --- a/arch/x86/tools/gen-insn-attr-x86.awk +++ b/arch/x86/tools/gen-insn-attr-x86.awk @@ -4,7 +4,25 @@ # # Usage: awk -f gen-insn-attr-x86.awk x86-opcode-map.txt > inat-tables.c +# Awk implementation sanity check +function check_awk_implement() { + if (!match("abc", "[[:lower:]]+")) + return "Your awk doesn't support charactor-class." + if (sprintf("%x", 0) != "0") + return "Your awk has a printf-format problem." + return "" +} + BEGIN { + # Implementation error checking + awkchecked = check_awk_implement() + if (awkchecked != "") { + print "Error: " awkchecked > "/dev/stderr" + print "Please try to use gawk." > "/dev/stderr" + exit 1 + } + + # Setup generating tables print "/* x86 opcode map generated from x86-opcode-map.txt */" print "/* Do not change this code. */" ggid = 1 @@ -293,6 +311,8 @@ function convert_operands(opnd, i,imm,mod) } END { + if (awkchecked != "") + exit 1 # print escape opcode map's array print "/* Escape opcode map array */" print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \