diff options
-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); |