提交 24aeeace 编写于 作者: L Laszlo Ersek 提交者: Luiz Capitulino

dump: select header bitness based on ELF class, not ELF architecture

The specific ELF architecture (d_machine) carries Too Much Information
(TM) for deciding between create_header32() and create_header64(), use
"d_class" instead (ELFCLASS32 vs. ELFCLASS64).

This change adapts write_dump_header() to write_elf_loads(), dump_begin()
etc. that also rely on the ELF class of the target for bitness selection.

Considering the current targets that support dumping, cpu_get_dump_info()
works as follows:
- target-s390x/arch_dump.c: (EM_S390, ELFCLASS64) only
- target-ppc/arch_dump.c (EM_PPC64, ELFCLASS64) only
- target-i386/arch_dump.c: sets (EM_X86_64, ELFCLASS64) vs. (EM_386,
  ELFCLASS32) keying off the same Long Mode Active flag.

Hence no observable change.
Approximately-suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 2f859f80
...@@ -1000,7 +1000,7 @@ out: ...@@ -1000,7 +1000,7 @@ out:
static int write_dump_header(DumpState *s) static int write_dump_header(DumpState *s)
{ {
if (s->dump_info.d_machine == EM_386) { if (s->dump_info.d_class == ELFCLASS32) {
return create_header32(s); return create_header32(s);
} else { } else {
return create_header64(s); return create_header64(s);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册