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

Commit 50a482fb authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Frederic Weisbecker
Browse files

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: default avatarMasami 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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 65e234ec
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
PHONY += posttest
PHONY += posttest
quiet_cmd_posttest = TEST    $@
quiet_cmd_posttest = TEST    $@
      cmd_posttest = $(OBJDUMP) -d -j .text $(objtree)/vmlinux | awk -f $(srctree)/arch/x86/tools/distill.awk | $(obj)/test_get_len
      cmd_posttest = $(OBJDUMP) -d -j .text $(objtree)/vmlinux | awk -f $(srctree)/arch/x86/tools/distill.awk | $(obj)/test_get_len $(CONFIG_64BIT)


posttest: $(obj)/test_get_len vmlinux
posttest: $(obj)/test_get_len vmlinux
	$(call cmd,posttest)
	$(call cmd,posttest)
+7 −7
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ const char *prog;
static void usage(void)
static void usage(void)
{
{
	fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |"
	fprintf(stderr, "Usage: objdump -d a.out | awk -f distill.awk |"
		" ./test_get_len\n");
		" %s [y|n](64bit flag)\n", prog);
	exit(1);
	exit(1);
}
}


@@ -63,11 +63,15 @@ int main(int argc, char **argv)
	unsigned char insn_buf[16];
	unsigned char insn_buf[16];
	struct insn insn;
	struct insn insn;
	int insns = 0;
	int insns = 0;
	int x86_64 = 0;


	prog = argv[0];
	prog = argv[0];
	if (argc > 1)
	if (argc > 2)
		usage();
		usage();


	if (argc == 2 && argv[1][0] == 'y')
		x86_64 = 1;

	while (fgets(line, BUFSIZE, stdin)) {
	while (fgets(line, BUFSIZE, stdin)) {
		char copy[BUFSIZE], *s, *tab1, *tab2;
		char copy[BUFSIZE], *s, *tab1, *tab2;
		int nb = 0;
		int nb = 0;
@@ -93,11 +97,7 @@ int main(int argc, char **argv)
				break;
				break;
		}
		}
		/* Decode an instruction */
		/* Decode an instruction */
#ifdef __x86_64__
		insn_init(&insn, insn_buf, x86_64);
		insn_init(&insn, insn_buf, 1);
#else
		insn_init(&insn, insn_buf, 0);
#endif
		insn_get_length(&insn);
		insn_get_length(&insn);
		if (insn.length != nb) {
		if (insn.length != nb) {
			fprintf(stderr, "Error: %s", line);
			fprintf(stderr, "Error: %s", line);