#include "server.h"
#include "linux-low.h"
#include "nat/aarch64-linux-hw-point.h"
+#include "linux-aarch32-low.h"
#include "elf/common.h"
#include <signal.h>
struct aarch64_debug_reg_state debug_reg_state;
};
+/* Return true if the size of register 0 is 8 byte. */
+
+static int
+is_64bit_tdesc (void)
+{
+ struct regcache *regcache = get_thread_regcache (current_thread, 0);
+
+ return register_size (regcache->tdesc, 0) == 8;
+}
+
/* Implementation of linux_target_ops method "cannot_store_register". */
static int
}
}
+/* Return the right target description according to the ELF file of
+ current thread. */
+
+static const struct target_desc *
+aarch64_linux_read_description (void)
+{
+ unsigned int machine;
+ int is_elf64;
+ int tid;
+
+ tid = lwpid_of (current_thread);
+
+ is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
+
+ if (is_elf64)
+ return tdesc_aarch64;
+ else
+ return tdesc_arm_with_neon;
+}
+
/* Implementation of linux_target_ops method "arch_setup". */
static void
aarch64_arch_setup (void)
{
- current_process ()->tdesc = tdesc_aarch64;
+ current_process ()->tdesc = aarch64_linux_read_description ();
aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
}
NULL, /* disabled_regsets */
};
-static struct regs_info regs_info =
+static struct regs_info regs_info_aarch64 =
{
NULL, /* regset_bitmap */
NULL, /* usrregs */
static const struct regs_info *
aarch64_regs_info (void)
{
- return ®s_info;
+ if (is_64bit_tdesc ())
+ return ®s_info_aarch64;
+ else
+ return ®s_info_aarch32;
}
/* Implementation of linux_target_ops method "supports_tracepoints". */
{
init_registers_aarch64 ();
+ initialize_low_arch_aarch32 ();
+
initialize_regsets_info (&aarch64_regsets_info);
}