Skip to content

Commit ae24e13

Browse files
committed
disas: Remove target_words_bigendian() call in initialize_debug_target()
All CPUClass implementating disas_set_info() must set the disassemble_info::endian value. Ensure that by setting %endian to BFD_ENDIAN_UNKNOWN before calling the CPUClass::disas_set_info() handler, then asserting %endian is not BFD_ENDIAN_UNKNOWN after the call. This allows removing the target_words_bigendian() call in disas/. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20250210212931.62401-11-philmd@linaro.org>
1 parent 059eb60 commit ae24e13

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

disas/disas-common.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "disas/disas.h"
88
#include "disas/capstone.h"
99
#include "hw/core/cpu.h"
10-
#include "exec/tswap.h"
1110
#include "disas-internal.h"
1211

1312

@@ -61,15 +60,12 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu)
6160

6261
s->cpu = cpu;
6362
s->info.print_address_func = print_address;
64-
if (target_words_bigendian()) {
65-
s->info.endian = BFD_ENDIAN_BIG;
66-
} else {
67-
s->info.endian = BFD_ENDIAN_LITTLE;
68-
}
63+
s->info.endian = BFD_ENDIAN_UNKNOWN;
6964

7065
CPUClass *cc = CPU_GET_CLASS(cpu);
7166
if (cc->disas_set_info) {
7267
cc->disas_set_info(cpu, &s->info);
68+
g_assert(s->info.endian != BFD_ENDIAN_UNKNOWN);
7369
}
7470
}
7571

0 commit comments

Comments
 (0)