From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbmiR-0000TB-KH for qemu-devel@nongnu.org; Mon, 13 May 2013 02:58:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbmiO-0000PY-Cx for qemu-devel@nongnu.org; Mon, 13 May 2013 02:58:35 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:60949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbmiN-0000NO-Tc for qemu-devel@nongnu.org; Mon, 13 May 2013 02:58:32 -0400 Received: by mail-pd0-f170.google.com with SMTP id 10so4182987pdi.1 for ; Sun, 12 May 2013 23:58:31 -0700 (PDT) From: John Rigby Date: Mon, 13 May 2013 00:57:51 -0600 Message-Id: <1368428278-29299-5-git-send-email-john.rigby@linaro.org> In-Reply-To: <1368428278-29299-1-git-send-email-john.rigby@linaro.org> References: <1368428278-29299-1-git-send-email-john.rigby@linaro.org> Subject: [Qemu-devel] [PATCH v3 resend 04/11] 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 --- Changes in v3: - fix checkpatch.pl issues 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