Add aach64 (ARMv8) support to the ELF parser

This commit is contained in:
pancake 2013-02-26 15:35:24 +01:00
parent 57503ff1fe
commit a7925a8a4f
4 changed files with 7 additions and 5 deletions

View File

@ -305,7 +305,6 @@ int main(int argc, char **argv) {
RCoreBinFilter filter;
const char *op = NULL;
int c, bits = 0;
ut64 offset;
RCore core;
r_core_init (&core);
@ -475,7 +474,7 @@ int main(int argc, char **argv) {
filter.offset = at;
filter.name = name;
offset = r_bin_get_offset (bin);
// ut64 offset = r_bin_get_offset (bin);
r_cons_new ()->is_interactive = R_FALSE;
#define isradjson rad==R_CORE_BIN_JSON&&actions>1

View File

@ -426,6 +426,7 @@ char* Elf_(r_bin_elf_get_arch)(struct Elf_(r_bin_elf_obj_t) *bin) {
case EM_MIPS_X:
return strdup ("mips");
case EM_ARM:
case EM_AARCH64:
return strdup ("arm");
case EM_SPARC:
case EM_SPARC32PLUS:
@ -516,6 +517,7 @@ char* Elf_(r_bin_elf_get_machine_name)(struct Elf_(r_bin_elf_obj_t) *bin) {
case EM_OPENRISC: return strdup ("OpenRISC 32-bit embedded processor");
case EM_ARC_A5: return strdup ("ARC Cores Tangent-A5");
case EM_XTENSA: return strdup ("Tensilica Xtensa Architecture");
case EM_AARCH64: return strdup ("ARM aarch64");
default: return r_str_dup_printf ("<unknown>: 0x%x", bin->ehdr.e_machine);
}
}

View File

@ -285,6 +285,7 @@ typedef struct
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
#define EM_NUM 95
#define EM_AARCH64 183 /* ARMv8 */
/* If it is necessary to assign new unofficial EM_* values, please
pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the

View File

@ -975,7 +975,7 @@ R_API char *r_str_uri_encode (const char *s) {
// TODO: merge print inside rutil
/* hack from print */
R_API int r_print_format_length (const char *fmt) {
int nargs, i, j, idx, times, otimes, endian;
int nargs, i, j, idx, times, endian;
char *args, *bracket, tmp, last = 0;
const char *arg = fmt;
const char *argend = arg+strlen (fmt);
@ -985,7 +985,7 @@ R_API int r_print_format_length (const char *fmt) {
while (*arg && iswhitechar (*arg)) arg++;
/* get times */
otimes = times = atoi (arg);
times = atoi (arg);
if (times > 0)
while ((*arg>='0'&&*arg<='9')) arg++;
bracket = strchr (arg,'{');
@ -1022,7 +1022,7 @@ R_API int r_print_format_length (const char *fmt) {
/* go format */
i = 0;
if (!times) otimes = times = 1;
if (!times) times = 1;
for (; times; times--) { // repeat N times
const char * orig = arg;
idx = 0;