From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbmGh-00015d-Gu for qemu-devel@nongnu.org; Mon, 13 May 2013 02:29:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbmGe-0008O6-8k for qemu-devel@nongnu.org; Mon, 13 May 2013 02:29:55 -0400 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]:65520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbmGd-0008Nt-To for qemu-devel@nongnu.org; Mon, 13 May 2013 02:29:52 -0400 Received: by mail-pb0-f53.google.com with SMTP id un1so4160508pbc.26 for ; Sun, 12 May 2013 23:29:51 -0700 (PDT) From: John Rigby Date: Mon, 13 May 2013 00:29:09 -0600 Message-Id: <1368426557-27416-5-git-send-email-john.rigby@linaro.org> In-Reply-To: <1368426557-27416-1-git-send-email-john.rigby@linaro.org> References: <1368426557-27416-1-git-send-email-john.rigby@linaro.org> Subject: [Qemu-devel] [PATCH v3 04/12] AArch64: Add gdb stub List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: 'Peter Maydell , John Rigby , Alexander Graf From: Alexander Graf We want to be able to debug AArch64 guests. So let's add the respective gdb stub functions and xml descriptions that allow us to do so. Signed-off-by: Alexander Graf Signed-off-by: John Rigby --- gdb-xml/aarch64-core.xml | 46 ++++++++++++++++++++++++++ gdb-xml/aarch64-fpu.xml | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ gdbstub.c | 53 +++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 gdb-xml/aarch64-core.xml create mode 100644 gdb-xml/aarch64-fpu.xml diff --git a/gdb-xml/aarch64-core.xml b/gdb-xml/aarch64-core.xml new file mode 100644 index 0000000..e1e9dc3 --- /dev/null +++ b/gdb-xml/aarch64-core.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb-xml/aarch64-fpu.xml b/gdb-xml/aarch64-fpu.xml new file mode 100644 index 0000000..997197e --- /dev/null +++ b/gdb-xml/aarch64-fpu.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdbstub.c b/gdbstub.c index e80e1d3..620adf1 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -935,6 +935,59 @@ static int cpu_gdb_write_register(CPUSPARCState *env, uint8_t *mem_buf, int n) return 8; #endif } +#elif defined(TARGET_AARCH64) + +#define NUM_CORE_REGS 34 +#define GDB_CORE_XML "aarch64-core.xml" + +static int cpu_gdb_read_register(CPUARMState *env, uint8_t *mem_buf, int n) +{ + if (n < 31) { + /* Core integer register. */ + GET_REG64(env->xregs[n]); + } + switch (n) { + case 31: + GET_REG64(env->sp); + break; + case 32: + GET_REG64(env->pc); + break; + case 33: + GET_REG32(env->pstate); + break; + } + /* Unknown register. */ + return 0; +} + +static int cpu_gdb_write_register(CPUARMState *env, uint8_t *mem_buf, int n) +{ + uint64_t tmp; + + tmp = ldq_p(mem_buf); + + if (n < 31) { + /* Core integer register. */ + env->xregs[n] = tmp; + return 8; + } + switch (n) { + case 31: + env->sp = tmp; + return 8; + case 32: + env->pc = tmp; + return 8; + case 33: + /* CPSR */ + env->pstate = tmp; + return 4; + } + /* Unknown register. */ + return 0; +} + #elif defined (TARGET_ARM) /* Old gdb always expect FPA registers. Newer (xml-aware) gdb only expect -- 1.8.2.2