mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
disas/nios2: Simplify endianess conversion
Since commit 12b6e9b27d
("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é <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210807110939.95853-3-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
ed899ac77d
commit
dcc99bd833
3 changed files with 5 additions and 26 deletions
|
@ -3478,9 +3478,7 @@ nios2_disassemble (bfd_vma address, unsigned long opcode,
|
|||
instruction word at the address given, and prints the disassembled
|
||||
instruction on the stream info->stream using info->fprintf_func. */
|
||||
|
||||
static int
|
||||
print_insn_nios2 (bfd_vma address, disassemble_info *info,
|
||||
enum bfd_endian endianness)
|
||||
int print_insn_nios2(bfd_vma address, disassemble_info *info)
|
||||
{
|
||||
bfd_byte buffer[INSNLEN];
|
||||
int status;
|
||||
|
@ -3488,7 +3486,7 @@ print_insn_nios2 (bfd_vma address, disassemble_info *info,
|
|||
status = (*info->read_memory_func)(address, buffer, INSNLEN, info);
|
||||
if (status == 0) {
|
||||
unsigned long insn;
|
||||
if (endianness == BFD_ENDIAN_BIG) {
|
||||
if (info->endian == BFD_ENDIAN_BIG) {
|
||||
insn = (unsigned long) bfd_getb32(buffer);
|
||||
} else {
|
||||
insn = (unsigned long) bfd_getl32(buffer);
|
||||
|
@ -3501,7 +3499,7 @@ print_insn_nios2 (bfd_vma address, disassemble_info *info,
|
|||
status = (*info->read_memory_func)(address, buffer, 2, info);
|
||||
if (status == 0) {
|
||||
unsigned long insn;
|
||||
if (endianness == BFD_ENDIAN_BIG) {
|
||||
if (info->endian == BFD_ENDIAN_BIG) {
|
||||
insn = (unsigned long) bfd_getb16(buffer);
|
||||
} else {
|
||||
insn = (unsigned long) bfd_getl16(buffer);
|
||||
|
@ -3514,17 +3512,3 @@ print_insn_nios2 (bfd_vma address, disassemble_info *info,
|
|||
(*info->memory_error_func)(status, address, info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* These two functions are the main entry points, accessed from
|
||||
disassemble.c. */
|
||||
int
|
||||
print_insn_big_nios2 (bfd_vma address, disassemble_info *info)
|
||||
{
|
||||
return print_insn_nios2 (address, info, BFD_ENDIAN_BIG);
|
||||
}
|
||||
|
||||
int
|
||||
print_insn_little_nios2 (bfd_vma address, disassemble_info *info)
|
||||
{
|
||||
return print_insn_nios2 (address, info, BFD_ENDIAN_LITTLE);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue