Enable Aarch64 SVE for gdbserver

gdbserver/
	* linux-aarch64-ipa.c (get_ipa_tdesc): Add null VQ param.
	(initialize_low_tracepoint): Likewise
	* linux-aarch64-low.c (aarch64_arch_setup): Get VQ.
	* linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Add null VQ
	param.
	* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add VQ
	checks.
	* linux-aarch64-tdesc.h (aarch64_linux_read_description): Add VQ.
This commit is contained in:
Alan Hayward 2018-06-11 10:32:52 +01:00
parent 5a485b3899
commit fefa175e8f
6 changed files with 44 additions and 14 deletions

View File

@ -1,3 +1,14 @@
2018-06-11 Alan Hayward <alan.hayward@arm.com>
* linux-aarch64-ipa.c (get_ipa_tdesc): Add null VQ param.
(initialize_low_tracepoint): Likewise
* linux-aarch64-low.c (aarch64_arch_setup): Get VQ.
* linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Add null VQ
param.
* linux-aarch64-tdesc.c (aarch64_linux_read_description): Add VQ
checks.
* linux-aarch64-tdesc.h (aarch64_linux_read_description): Add VQ.
2018-06-11 Alan Hayward <alan.hayward@arm.com>
* server.h (PBUFSIZ): Increase size

View File

@ -147,12 +147,12 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
/* Return target_desc to use for IPA, given the tdesc index passed by
gdbserver. Index is ignored, since we have only one tdesc
at the moment. */
at the moment. SVE not yet supported. */
const struct target_desc *
get_ipa_tdesc (int idx)
{
return aarch64_linux_read_description ();
return aarch64_linux_read_description (0);
}
/* Allocate buffer for the jump pads. The branch instruction has a reach
@ -204,5 +204,6 @@ alloc_jump_pad_buffer (size_t size)
void
initialize_low_tracepoint (void)
{
aarch64_linux_read_description ();
/* SVE not yet supported. */
aarch64_linux_read_description (0);
}

View File

@ -40,6 +40,7 @@
#include "gdb_proc_service.h"
#include "arch/aarch64.h"
#include "linux-aarch64-tdesc.h"
#include "nat/aarch64-sve-linux-ptrace.h"
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
@ -503,7 +504,10 @@ aarch64_arch_setup (void)
is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine);
if (is_elf64)
current_process ()->tdesc = aarch64_linux_read_description ();
{
uint64_t vq = aarch64_sve_get_vq (tid);
current_process ()->tdesc = aarch64_linux_read_description (vq);
}
else
current_process ()->tdesc = tdesc_arm_with_neon;

View File

@ -29,7 +29,7 @@ namespace tdesc {
static void
aarch64_tdesc_test ()
{
const target_desc *tdesc = aarch64_linux_read_description ();
const target_desc *tdesc = aarch64_linux_read_description (0);
SELF_CHECK (*tdesc == *tdesc_aarch64);
}
}

View File

@ -21,23 +21,37 @@
#include "tdesc.h"
#include "arch/aarch64.h"
#include "linux-aarch32-low.h"
#include <inttypes.h>
/* All possible aarch64 target descriptors. */
struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1];
/* Create the aarch64 target description. */
const target_desc *
aarch64_linux_read_description ()
aarch64_linux_read_description (uint64_t vq)
{
static target_desc *aarch64_tdesc = NULL;
target_desc **tdesc = &aarch64_tdesc;
if (vq > AARCH64_MAX_SVE_VQ)
error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq,
AARCH64_MAX_SVE_VQ);
if (*tdesc == NULL)
struct target_desc *tdesc = tdesc_aarch64_list[vq];
if (tdesc == NULL)
{
/* SVE not yet supported. */
*tdesc = aarch64_create_target_description (0);
tdesc = aarch64_create_target_description (vq);
static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
init_target_desc (*tdesc, expedite_regs_aarch64);
static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc",
"vg", NULL };
if (vq == 0)
init_target_desc (tdesc, expedite_regs_aarch64);
else
init_target_desc (tdesc, expedite_regs_aarch64_sve);
tdesc_aarch64_list[vq] = tdesc;
}
return *tdesc;
return tdesc;
}

View File

@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
const target_desc * aarch64_linux_read_description ();
const target_desc * aarch64_linux_read_description (uint64_t vq);
#if GDB_SELF_TEST
void initialize_low_tdesc ();