summaryrefslogtreecommitdiffstats
path: root/arch/x86/tools/test_get_len.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-08-28 18:13:19 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-09-04 18:14:04 +0200
commit50a482fbd96943516b7a2783900e8fe61a6425e7 (patch)
tree78cccda3f21a85d7b409cd39d97cb28f120fc442 /arch/x86/tools/test_get_len.c
parent65e234ec2c4a0659ca22531dc1372a185f088517 (diff)
x86: Allow x86-32 instruction decoder selftest on x86-64
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 <mhiramat@redhat.com> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> LKML-Reference: <20090828221319.8778.88508.stgit@localhost.localdomain> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'arch/x86/tools/test_get_len.c')
-rw-r--r--arch/x86/tools/test_get_len.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/tools/test_get_len.c b/arch/x86/tools/test_get_len.c
index 1e81adb2d8a..a3273f4244d 100644
--- a/arch/x86/tools/test_get_len.c
+++ b/arch/x86/tools/test_get_len.c
@@ -45,7 +45,7 @@ const char *prog;
static void usage(void)
{
fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |"
- " ./test_get_len\n");
+ " %s [y|n](64bit flag)\n", prog);
exit(1);
}
@@ -63,11 +63,15 @@ int main(int argc, char **argv)
unsigned char insn_buf[16];
struct insn insn;
int insns = 0;
+ int x86_64 = 0;
prog = argv[0];
- if (argc > 1)
+ if (argc > 2)
usage();
+ if (argc == 2 && argv[1][0] == 'y')
+ x86_64 = 1;
+
while (fgets(line, BUFSIZE, stdin)) {
char copy[BUFSIZE], *s, *tab1, *tab2;
int nb = 0;
@@ -93,11 +97,7 @@ int main(int argc, char **argv)
break;
}
/* Decode an instruction */
-#ifdef __x86_64__
- insn_init(&insn, insn_buf, 1);
-#else
- insn_init(&insn, insn_buf, 0);
-#endif
+ insn_init(&insn, insn_buf, x86_64);
insn_get_length(&insn);
if (insn.length != nb) {
fprintf(stderr, "Error: %s", line);