Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69d991f3 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Frederic Weisbecker
Browse files

x86: Check awk features before generating inat-tables.c



Check some awk mandatory features to generate inat-tables.c
that old mawk doesn't support.

Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Przemysław Pawełczyk <przemyslaw@pawelczyk.it>
Cc: Roland McGrath <roland@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
LKML-Reference: <20090821194316.12478.57394.stgit@localhost.localdomain>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 8d7d14fb
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -4,7 +4,25 @@
#
#
# Usage: awk -f gen-insn-attr-x86.awk x86-opcode-map.txt > inat-tables.c
# 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 {
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 "/* x86 opcode map generated from x86-opcode-map.txt */"
	print "/* Do not change this code. */"
	print "/* Do not change this code. */"
	ggid = 1
	ggid = 1
@@ -293,6 +311,8 @@ function convert_operands(opnd, i,imm,mod)
}
}


END {
END {
	if (awkchecked != "")
		exit 1
	# print escape opcode map's array
	# print escape opcode map's array
	print "/* Escape opcode map array */"
	print "/* Escape opcode map array */"
	print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \
	print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \