Skip to content

Commit

Permalink
Fix sparc disassembler for big endian hosts ##endian
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored May 13, 2024
1 parent 4ee16e2 commit 05bf34a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion libr/anal/c/tccgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,6 @@ ST_FUNC long long expr_const(TCCState *s1) {
expect (s1, "constant expression");
return 0;
}
return r_read_le64 (&s1->vtop->c.ll);
return s1->vtop->c.ll;
}

Expand Down
6 changes: 5 additions & 1 deletion libr/arch/p/sparc_cs/plugin.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2014-2023 - pancake */
/* radare2 - LGPL - Copyright 2014-2024 - pancake */

#include <r_anal.h>
#include <r_lib.h>
Expand Down Expand Up @@ -136,7 +136,11 @@ performed in big-endian byte order.
if (op->size < 4) {
return false;
}
#if R_SYS_ENDIAN
ut32 lbuf = r_read_ble32 (op->bytes, R_ARCH_CONFIG_IS_BIG_ENDIAN (as->config));
#else
ut32 lbuf = r_read_ble32 (op->bytes, !R_ARCH_CONFIG_IS_BIG_ENDIAN (as->config));
#endif

// capstone-next
int n = cs_disasm (handle, (const ut8*)&lbuf, sizeof (lbuf), addr, 1, &insn);
Expand Down

0 comments on commit 05bf34a

Please sign in to comment.