05 Dec, 2011
5 commits
-
Add instruction dump mode to insn_sanity tool for
checking decoder really decoded instructions.This mode is enabled when passing double -v (-vv) to
insn_sanity. It is useful for who wants to check whether
the decoder can decode some instructions correctly.
e.g.
$ echo 0f 73 10 11 | ./insn_sanity -y -vv -i -
Instruction = {
.prefixes = {
.value = 0, bytes[] = {0, 0, 0, 0},
.got = 1, .nbytes = 0},
.rex_prefix = {
.value = 0, bytes[] = {0, 0, 0, 0},
.got = 1, .nbytes = 0},
.vex_prefix = {
.value = 0, bytes[] = {0, 0, 0, 0},
.got = 1, .nbytes = 0},
.opcode = {
.value = 29455, bytes[] = {f, 73, 0, 0},
.got = 1, .nbytes = 2},
.modrm = {
.value = 16, bytes[] = {10, 0, 0, 0},
.got = 1, .nbytes = 1},
.sib = {
.value = 0, bytes[] = {0, 0, 0, 0},
.got = 1, .nbytes = 0},
.displacement = {
.value = 0, bytes[] = {0, 0, 0, 0},
.got = 1, .nbytes = 0},
.immediate1 = {
.value = 17, bytes[] = {11, 0, 0, 0},
.got = 1, .nbytes = 1},
.immediate2 = {
.value = 0, bytes[] = {0, 0, 0, 0},
.got = 0, .nbytes = 0},
.attr = 44800, .opnd_bytes = 4, .addr_bytes = 8,
.length = 4, .x86_64 = 1, .kaddr = 0x7fff0f7d9430}
Success: decoded and checked 1 given instructions with 0 errors (seed:0x0)Signed-off-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20111205120603.15475.91192.stgit@cloud
Signed-off-by: Ingo Molnar -
Since new Intel software developers manual introduces
new format for AVX instruction set (including AVX2),
it is important to update x86-opcode-map.txt to fit
those changes.Signed-off-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20111205120557.15475.13236.stgit@cloud
Signed-off-by: Ingo Molnar -
Fix x86 instruction decoder test to dump all error messages
to stderr and others to stdout.Signed-off-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20111205120550.15475.70149.stgit@cloud
Signed-off-by: Ingo Molnar -
Fix instruction decoder test (insn_sanity), so that
it doesn't show both info and error messages twice on
same instruction. (In that case, show only error message)Signed-off-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20111205120545.15475.7928.stgit@cloud
Signed-off-by: Ingo Molnar -
Fix arch/x86/tools/Makefile to compile both test tools
correctly. This bug leads build error.Signed-off-by: Masami Hiramatsu
Cc: "H. Peter Anvin"
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20111205120533.15475.62047.stgit@cloud
Signed-off-by: Ingo Molnar
10 Nov, 2011
1 commit
-
Add a sanity test of x86 insn decoder against a stream
of randomly generated input, at build time.This test is also able to reproduce any bug that might
trigger by allowing the passing of random-seed and
iteration-number to the test, or by passing input
which has invalid byte code.Changes in V2:
- Code cleanup.
- Show how to reproduce the error by insn_sanity test.Signed-off-by: Masami Hiramatsu
Cc: acme@redhat.com
Cc: ming.m.lin@intel.com
Cc: robert.richter@amd.com
Cc: ravitillo@lbl.gov
Cc: yrl.pp-manager.tt@hitachi.com
Cc: Andi Kleen
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Andi Kleen
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/20111020140109.20938.92572.stgit@localhost.localdomain
Signed-off-by: Ingo Molnar
08 Feb, 2010
1 commit
-
Signed-off-by: Frans Pop
Cc: Avi Kivity
Cc: x86@kernel.org
LKML-Reference:
[ Left out the KVM bits. ]
Signed-off-by: Ingo Molnar
28 Dec, 2009
1 commit
-
…/linux-2.6-iommu into x86/urgent
19 Dec, 2009
1 commit
-
Different version of objdump says its version in different way;
GNU objdump 2.16.1
or
GNU objdump version 2.19.51.0.14-1.fc11 20090722
This patch uses the first argument which starts with a number
as version string.Changes in v2:
- Remove unneeded increment.Signed-off-by: Masami Hiramatsu
LKML-Reference:
Suggested-by: H. Peter Anvin
Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: Andrew Morton
Signed-off-by: H. Peter Anvin
18 Dec, 2009
1 commit
-
It says
Warning: objdump version is older than 2.19
Warning: Skipping posttest.because it used the wrong field from `objdump -v':
akpm:/usr/src/25> /opt/crosstool/gcc-4.0.2-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-objdump -v
GNU objdump 2.16.1
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.Cc: Thomas Gleixner
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
LKML-Reference:
Signed-off-by: H. Peter Anvin
Cc: Masami Hiramatsu
17 Dec, 2009
2 commits
-
Not all awk implementations (including the default awk in Ubuntu 9.10)
support POSIX character classes. Since x86-opcode-map.txt is plain
ASCII, we can just use explicit ranges for lower case, alphabetic, and
alphanumeric characters instead.Signed-off-by: Roland Dreier
Acked-by: Masami Hiramatsu
LKML-Reference:
Signed-off-by: H. Peter Anvin -
…git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Fix kprobes build with non-gawk awk
x86: Split swiotlb initialization into two stages
x86: Regex support and known-movable symbols for relocs, fix _end
x86, msr: Remove incorrect, duplicated code in the MSR driver
x86: Merge kernel_thread()
x86: Sync 32/64-bit kernel_thread
x86, 32-bit: Use same regs as 64-bit for kernel_thread_helper
x86, 64-bit: Use user_mode() to determine new stack pointer in copy_thread()
x86, 64-bit: Move kernel_thread to C
x86-64, paravirt: Call set_iopl_mask() on 64 bits
x86-32: Avoid pipeline serialization in PTREGSCALL1 and 2
x86: Merge sys_clone
x86, 32-bit: Convert sys_vm86 & sys_vm86old
x86: Merge sys_sigaltstack
x86: Merge sys_execve
x86: Merge sys_iopl
x86-32: Add new pt_regs stubs
cpumask: Use modern cpumask style in arch/x86/kernel/cpu/mcheck/mce-inject.c
16 Dec, 2009
1 commit
-
The instruction attribute table generator fails when run by mawk
or original-awk:$ mawk -f arch/x86/tools/gen-insn-attr-x86.awk \
arch/x86/lib/x86-opcode-map.txt > /dev/null
Semantic error at 240: Second IMM error
$ echo $?
1Line 240 contains "c8: ENTER Iw,Ib", which indicates that this
instruction has two immediate operands, the second of which is
one byte. The script loops through the immediate operands using
a for loop.Unfortunately, there is no guarantee in awk that a for (variable
in array) loop will return the indices in increasing order.
Internally, both original-awk and mawk iterate over a hash table
for this purpose, and both implementations happen to produce the
index 2 before 1. The supposed second immediate operand is more
than one byte wide, producing the error.So loop over the indices in increasing order instead. As a
side-effect, with mawk this means the silly two-entry hash table
never has to be built.Signed-off-by: Jonathan Nieder
Acked-by Masami Hiramatsu
Cc: Jim Keniston
Cc: Frederic Weisbecker
LKML-Reference:
Signed-off-by: Ingo Molnar
06 Dec, 2009
1 commit
-
Fix the following warning:
arch/x86/tools/test_get_len.c: In function "main":
arch/x86/tools/test_get_len.c:116: warning: unused variable "c"Signed-off-by: Jean Delvare
Cc: Masami Hiramatsu
Signed-off-by: Ingo Molnar
04 Dec, 2009
1 commit
-
Merge reason: add these fixes to 'perf probe'.
Signed-off-by: Ingo Molnar
21 Nov, 2009
2 commits
-
Check objdump version before using it for insn decoder build test,
because some older objdump can't decode AVX code correctly.Signed-off-by: Masami Hiramatsu
Cc: Ingo Molnar
Cc: Stephen Rothwell
Cc: Randy Dunlap
Cc: Jim Keniston
LKML-Reference:
Signed-off-by: H. Peter Anvin -
Fix postest_verbose to posttest_verbose, and add posttest_64bit option
for CONFIG_64BIT != y, since old command just passed '-' instead
of '-n' when CONFIG_64BIT is not set.Signed-off-by: Masami Hiramatsu
Cc: Ingo Molnar
Cc: Stephen Rothwell
Cc: Randy Dunlap
Cc: Jim Keniston
LKML-Reference:
Signed-off-by: H. Peter Anvin
20 Nov, 2009
1 commit
-
Since some instructions are not decoded correctly by older
versions of objdump, it may cause false positive error in insn
decoder posttest.This changes build error of insn decoder test to build warning.
Signed-off-by: Masami Hiramatsu
Cc: systemtap
Cc: DLE
Cc: Stephen Rothwell
Cc: Randy Dunlap
Cc: Jim Keniston
Cc: Stephen Rothwell
LKML-Reference:
Signed-off-by: Ingo Molnar
17 Nov, 2009
2 commits
-
Show symbol name if insn decoder test find a difference.
This will help us to find out where the issue is.Signed-off-by: Masami Hiramatsu
Cc: systemtap
Cc: DLE
Cc: Stephen Rothwell
Cc: Randy Dunlap
Cc: Jim Keniston
Cc: Stephen Rothwell
LKML-Reference:
Signed-off-by: Ingo Molnar -
Add verbose option to insn decoder test. This dumps decoded
instruction when building kernel with V=1.Signed-off-by: Masami Hiramatsu
Cc: systemtap
Cc: DLE
Cc: Stephen Rothwell
Cc: Randy Dunlap
Cc: Jim Keniston
Cc: Stephen Rothwell
LKML-Reference:
Signed-off-by: Ingo Molnar
29 Oct, 2009
2 commits
-
Add Intel AVX(Advanced Vector Extensions) instruction set
support to x86 instruction decoder. This adds insn.vex_prefix
field for storing VEX prefixes, and introduces some original
tags for expressing opcodes attributes.Signed-off-by: Masami Hiramatsu
Cc: Steven Rostedt
Cc: Jim Keniston
Cc: Ananth N Mavinakayanahalli
Cc: Christoph Hellwig
Cc: Frank Ch. Eigler
Cc: Frederic Weisbecker
Cc: Jason Baron
Cc: K.Prasad
Cc: Peter Zijlstra
Cc: Srikar Dronamraju
LKML-Reference:
Signed-off-by: Ingo Molnar -
Merge INAT_REXPFX into INAT_PFX_* macro and rename it to
INAT_PFX_REX.Signed-off-by: Masami Hiramatsu
Cc: Steven Rostedt
Cc: Jim Keniston
Cc: Ananth N Mavinakayanahalli
Cc: Christoph Hellwig
Cc: Frank Ch. Eigler
Cc: Frederic Weisbecker
Cc: Jason Baron
Cc: K.Prasad
Cc: Peter Zijlstra
Cc: Srikar Dronamraju
LKML-Reference:
Signed-off-by: Ingo Molnar
21 Oct, 2009
1 commit
-
Add the kernel source include file as well to the include files
search path, to fix this build bug:In file included from arch/x86/tools/test_get_len.c:28:
arch/x86/lib/insn.c:21:26: error: linux/string.h: No such file or directoryCc: Masami Hiramatsu
Cc: systemtap
Cc: DLE
Cc: Jim Keniston
Cc: Frederic Weisbecker
LKML-Reference:
Signed-off-by: Ingo Molnar
05 Sep, 2009
2 commits
-
Remove dummy definitions of CONFIG_X86_64 and CONFIG_X86_32 because
those macros are not used in the instruction decoder anymore.Signed-off-by: Masami Hiramatsu
Cc: Jim Keniston
Cc: Ingo Molnar
LKML-Reference:
Signed-off-by: Frederic Weisbecker -
Pass $(CONFIG_64BIT) to the x86 insn decoder selftest in case we are
decoding 32bit code on x86-64, which will happen when building kernel
with ARCH=i386 on x86-64.Signed-off-by: Masami Hiramatsu
Cc: Jim Keniston
Cc: Ingo Molnar
LKML-Reference:
Signed-off-by: Frederic Weisbecker
27 Aug, 2009
4 commits
-
Check some awk mandatory features to generate inat-tables.c
that 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: 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
LKML-Reference:
Signed-off-by: Frederic Weisbecker -
Fix x86 instruction decoder selftest to check only .text because other
sections (e.g. .notes) will have random bytes which don't need to be
checked.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: 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
LKML-Reference:
Signed-off-by: Frederic Weisbecker -
Add a user-space selftest of x86 instruction decoder at kernel build
time.
When CONFIG_X86_DECODER_SELFTEST=y, Kbuild builds a test harness of x86
instruction decoder and performs it after building vmlinux.
The test compares the results of objdump and x86 instruction decoder
code and check there are no differences.Signed-off-by: Masami Hiramatsu
Signed-off-by: Jim Keniston
Cc: Ananth N Mavinakayanahalli
Cc: Avi Kivity
Cc: Andi Kleen
Cc: Christoph Hellwig
Cc: Frank Ch. Eigler
Cc: H. Peter Anvin
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
LKML-Reference:
Signed-off-by: Frederic Weisbecker -
Add x86 instruction decoder to arch-specific libraries. This decoder
can decode x86 instructions used in kernel into prefix, opcode, modrm,
sib, displacement and immediates. This can also show the length of
instructions.This version introduces instruction attributes for decoding
instructions.
The instruction attribute tables are generated from the opcode map file
(x86-opcode-map.txt) by the generator script(gen-insn-attr-x86.awk).Currently, the opcode maps are based on opcode maps in Intel(R) 64 and
IA-32 Architectures Software Developers Manual Vol.2: Appendix.A,
and consist of below two types of opcode tables.1-byte/2-bytes/3-bytes opcodes, which has 256 elements, are
written as below;Table: table-name
Referrer: escaped-name
opcode: mnemonic|GrpXXX [operand1[,operand2...]] [(extra1)[,(extra2)...] [| 2nd-mnemonic ...]
(or)
opcode: escape # escaped-name
EndTableGroup opcodes, which has 8 elements, are written as below;
GrpTable: GrpXXX
reg: mnemonic [operand1[,operand2...]] [(extra1)[,(extra2)...] [| 2nd-mnemonic ...]
EndTableThese opcode maps include a few SSE and FP opcodes (for setup), because
those opcodes are used in the kernel.Signed-off-by: Masami Hiramatsu
Signed-off-by: Jim Keniston
Acked-by: H. Peter Anvin
Cc: Ananth N Mavinakayanahalli
Cc: Avi Kivity
Cc: Andi Kleen
Cc: Christoph Hellwig
Cc: Frank Ch. Eigler
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
LKML-Reference:
Signed-off-by: Frederic Weisbecker