On 8/9/21 8:12 AM, Thomas Huth wrote:
> On 07/08/2021 13.09, Philippe Mathieu-Daudé wrote:
>> Since commit 12b6e9b27d4 ("disas: Clean up CPUDebug initialization")
>> the disassemble_info->bfd_endian enum is set for all targets in
>> target_disas(). We can directly call print_insn_nios2() and simplify.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
>> ---
>>   include/disas/dis-asm.h |  3 +--
>>   disas/nios2.c           | 22 +++-------------------
>>   target/nios2/cpu.c      |  6 +-----
>>   3 files changed, 5 insertions(+), 26 deletions(-)
> [...]
>> diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
>> index 5e37defef80..5b503b5bb99 100644
>> --- a/target/nios2/cpu.c
>> +++ b/target/nios2/cpu.c
>> @@ -146,11 +146,7 @@ static void nios2_cpu_disas_set_info(CPUState
>> *cpu, disassemble_info *info)
>>   {
>>       /* NOTE: NiosII R2 is not supported yet. */
>>       info->mach = bfd_arch_nios2;
>> -#ifdef TARGET_WORDS_BIGENDIAN
>> -    info->print_insn = print_insn_big_nios2;
>> -#else
>> -    info->print_insn = print_insn_little_nios2;
>> -#endif
>> +    info->print_insn = print_insn_nios2;
>>   }
> 
> Oh, wow, I didn't even know that nios2 could be compiled with different
> endianness? I mean, we only have a "nios2-softmmu" target, not something
> like "nios2be-softmmu" and "nios2le-softmmu" ?

$ git grep ENDIAN configs/targets/nios2-*
$

We only build little-endian targets, but looking at commit
b7862564880 ("nios2: Add Altera 10M50 GHRD emulation")
hw/nios2/boot.c is ready to load big-endian ELF if we were
building the big-endian targets.

> Anyway, your patch makes a lot of sense to clean this up.
> 
> Reviewed-by: Thomas Huth <th...@redhat.com>
> 
> 

Reply via email to