diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-08-28 18:13:19 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-09-04 12:14:04 -0400 |
commit | 50a482fbd96943516b7a2783900e8fe61a6425e7 (patch) | |
tree | 78cccda3f21a85d7b409cd39d97cb28f120fc442 /arch/x86/tools | |
parent | 65e234ec2c4a0659ca22531dc1372a185f088517 (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')
-rw-r--r-- | arch/x86/tools/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/tools/test_get_len.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile index 95e9cc4bcd94..1bd006c81564 100644 --- a/arch/x86/tools/Makefile +++ b/arch/x86/tools/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | PHONY += posttest | 1 | PHONY += posttest |
2 | quiet_cmd_posttest = TEST $@ | 2 | quiet_cmd_posttest = TEST $@ |
3 | cmd_posttest = $(OBJDUMP) -d -j .text $(objtree)/vmlinux | awk -f $(srctree)/arch/x86/tools/distill.awk | $(obj)/test_get_len | 3 | cmd_posttest = $(OBJDUMP) -d -j .text $(objtree)/vmlinux | awk -f $(srctree)/arch/x86/tools/distill.awk | $(obj)/test_get_len $(CONFIG_64BIT) |
4 | 4 | ||
5 | posttest: $(obj)/test_get_len vmlinux | 5 | posttest: $(obj)/test_get_len vmlinux |
6 | $(call cmd,posttest) | 6 | $(call cmd,posttest) |
diff --git a/arch/x86/tools/test_get_len.c b/arch/x86/tools/test_get_len.c index 1e81adb2d8a9..a3273f4244d5 100644 --- a/arch/x86/tools/test_get_len.c +++ b/arch/x86/tools/test_get_len.c | |||
@@ -45,7 +45,7 @@ const char *prog; | |||
45 | static void usage(void) | 45 | static void usage(void) |
46 | { | 46 | { |
47 | fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |" | 47 | fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |" |
48 | " ./test_get_len\n"); | 48 | " %s [y|n](64bit flag)\n", prog); |
49 | exit(1); | 49 | exit(1); |
50 | } | 50 | } |
51 | 51 | ||
@@ -63,11 +63,15 @@ int main(int argc, char **argv) | |||
63 | unsigned char insn_buf[16]; | 63 | unsigned char insn_buf[16]; |
64 | struct insn insn; | 64 | struct insn insn; |
65 | int insns = 0; | 65 | int insns = 0; |
66 | int x86_64 = 0; | ||
66 | 67 | ||
67 | prog = argv[0]; | 68 | prog = argv[0]; |
68 | if (argc > 1) | 69 | if (argc > 2) |
69 | usage(); | 70 | usage(); |
70 | 71 | ||
72 | if (argc == 2 && argv[1][0] == 'y') | ||
73 | x86_64 = 1; | ||
74 | |||
71 | while (fgets(line, BUFSIZE, stdin)) { | 75 | while (fgets(line, BUFSIZE, stdin)) { |
72 | char copy[BUFSIZE], *s, *tab1, *tab2; | 76 | char copy[BUFSIZE], *s, *tab1, *tab2; |
73 | int nb = 0; | 77 | int nb = 0; |
@@ -93,11 +97,7 @@ int main(int argc, char **argv) | |||
93 | break; | 97 | break; |
94 | } | 98 | } |
95 | /* Decode an instruction */ | 99 | /* Decode an instruction */ |
96 | #ifdef __x86_64__ | 100 | insn_init(&insn, insn_buf, x86_64); |
97 | insn_init(&insn, insn_buf, 1); | ||
98 | #else | ||
99 | insn_init(&insn, insn_buf, 0); | ||
100 | #endif | ||
101 | insn_get_length(&insn); | 101 | insn_get_length(&insn); |
102 | if (insn.length != nb) { | 102 | if (insn.length != nb) { |
103 | fprintf(stderr, "Error: %s", line); | 103 | fprintf(stderr, "Error: %s", line); |