From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
qemu-ppc@nongnu.org, qemu-riscv@nongnu.org,
"Thomas Huth" <thuth@redhat.com>,
qemu-arm@nongnu.org, qemu-s390x@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v3 10/10] disas: Remove target_words_bigendian() call in initialize_debug_target()
Date: Mon, 10 Feb 2025 23:18:30 +0100 [thread overview]
Message-ID: <20250210221830.69129-11-philmd@linaro.org> (raw)
In-Reply-To: <20250210221830.69129-1-philmd@linaro.org>
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>
---
disas/disas-common.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/disas/disas-common.c b/disas/disas-common.c
index 57505823cb7..21c2f03430b 100644
--- a/disas/disas-common.c
+++ b/disas/disas-common.c
@@ -7,7 +7,6 @@
#include "disas/disas.h"
#include "disas/capstone.h"
#include "hw/core/cpu.h"
-#include "exec/tswap.h"
#include "disas-internal.h"
@@ -61,14 +60,11 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState *cpu)
s->cpu = cpu;
s->info.print_address_func = print_address;
- if (target_words_bigendian()) {
- s->info.endian = BFD_ENDIAN_BIG;
- } else {
- s->info.endian = BFD_ENDIAN_LITTLE;
- }
+ s->info.endian = BFD_ENDIAN_UNKNOWN;
if (cpu->cc->disas_set_info) {
cpu->cc->disas_set_info(cpu, &s->info);
+ g_assert(s->info.endian != BFD_ENDIAN_UNKNOWN);
}
}
--
2.47.1
prev parent reply other threads:[~2025-02-10 22:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 22:18 [PATCH v3 00/10] disas: Have CPUClass::disas_set_info() callback set the endianness Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 01/10] target: Set disassemble_info::endian value for little-endian targets Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 02/10] target: Set disassemble_info::endian value for big-endian targets Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 03/10] target/arm: Set disassemble_info::endian value in disas_set_info() Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 04/10] target/microblaze: Set disassemble_info::endian value in disas_set_info Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 05/10] target/mips: Set disassemble_info::endian value in disas_set_info() Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 06/10] target/ppc: " Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 07/10] target/riscv: " Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 08/10] target/sh4: " Philippe Mathieu-Daudé
2025-02-10 22:18 ` [PATCH v3 09/10] target/xtensa: " Philippe Mathieu-Daudé
2025-02-10 22:18 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250210221830.69129-11-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).