* [Qemu-devel] arm vfp support in gdbstub
@ 2008-08-28 5:50 Vladimir Vukicevic
2008-08-28 15:36 ` Paul Brook
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Vukicevic @ 2008-08-28 5:50 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 690 bytes --]
Howdy,
gdb doesn't seem to know what to do with vfp registers on arm, and
qemu wasn't sending them anyway. The attached patch and gdb tdesc
files let you examine fp state via the debugger. What's the right way
to do this? Ideally it would be selectable at runtime in some way,
and gdb should be told what the processor desc is without having to
manually do it. Note that I left the FPA hole because
org.gnu.gdb.arm.core puts cpsr at regnum 25, so there would end up
being a hole there anyway.
To use, load the tdesc in gdb via 'set tdesc filename arm-with-
vfp.xml', then target remote qemuhost:port as normal with a qemu built
with the attached patch.
- Vlad
[-- Attachment #2: qemu-gdbstubs-vfp.patch --]
[-- Type: application/octet-stream, Size: 1280 bytes --]
Index: gdbstub.c
===================================================================
--- gdbstub.c (revision 5091)
+++ gdbstub.c (working copy)
@@ -608,6 +608,21 @@
/* CPSR (4 bytes). */
*(uint32_t *)ptr = tswapl (cpsr_read(env));
ptr += 4;
+#if 1
+ /* 16 VFP registers (16 bytes each) */
+ /* Note that there are 32 regs available, but we only send along 16 of them -- the other 16 are optional in arm hw. */
+ for (i = 0; i < 16; i++)
+ {
+ memcpy(ptr, &env->vfp.regs[i], 8);
+ ptr += 8;
+ }
+ /* fpsid, fpscr, mvfr1, mvfr0, fpexec, fpinst, fpinst2 (4 bytes each) */
+ for (i = 0; i < 7; i++)
+ {
+ *(uint32_t *)ptr = tswapl(env->vfp.xregs[i]);
+ ptr += 4;
+ }
+#endif
return ptr - mem_buf;
}
@@ -626,7 +641,20 @@
}
/* Ignore FPA regs and scr. */
ptr += 8 * 12 + 4;
+
cpsr_write (env, tswapl(*(uint32_t *)ptr), 0xffffffff);
+ ptr += 4;
+
+#if 1
+ /* 16 VFP registers. */
+ for (i = 0; i < 16; i++)
+ {
+ env->vfp.regs[i] = *(double *)ptr;
+ ptr += 8;
+ }
+ /* Ignore 7 VFP status registers -- XXX fixme. */
+ ptr += 7*4;
+#endif
}
#elif defined (TARGET_M68K)
static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
[-- Attachment #3: arm-with-vfp.xml --]
[-- Type: text/xml, Size: 3254 bytes --]
<?xml version="1.0"?>
<!-- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target>
<architecture>armv5te</architecture>
<!-- <xi:include href="arm-core.xml"/>-->
<feature name="org.gnu.gdb.arm.core">
<reg name="r0" bitsize="32"/>
<reg name="r1" bitsize="32"/>
<reg name="r2" bitsize="32"/>
<reg name="r3" bitsize="32"/>
<reg name="r4" bitsize="32"/>
<reg name="r5" bitsize="32"/>
<reg name="r6" bitsize="32"/>
<reg name="r7" bitsize="32"/>
<reg name="r8" bitsize="32"/>
<reg name="r9" bitsize="32"/>
<reg name="r10" bitsize="32"/>
<reg name="r11" bitsize="32"/>
<reg name="r12" bitsize="32"/>
<reg name="sp" bitsize="32" type="data_ptr"/>
<reg name="lr" bitsize="32"/>
<reg name="pc" bitsize="32" type="code_ptr"/>
<!-- The CPSR is register 25, rather than register 16, because
the FPA registers historically were placed between the PC
and the CPSR in the "g" packet. -->
<reg name="cpsr" bitsize="32" regnum="25"/>
</feature>
<!-- <xi:include href="arm-fpa.xml"/>-->
<feature name="org.gnu.gdb.arm.fpa">
<!-- f0's regnum is set explicitly, because the FPA registers
historically were placed between the PC and the CPSR in the "g"
packet - in the middle of org.gnu.gdb.arm.core. -->
<reg name="f0" bitsize="96" type="arm_fpa_ext" regnum="16"/>
<reg name="f1" bitsize="96" type="arm_fpa_ext"/>
<reg name="f2" bitsize="96" type="arm_fpa_ext"/>
<reg name="f3" bitsize="96" type="arm_fpa_ext"/>
<reg name="f4" bitsize="96" type="arm_fpa_ext"/>
<reg name="f5" bitsize="96" type="arm_fpa_ext"/>
<reg name="f6" bitsize="96" type="arm_fpa_ext"/>
<reg name="f7" bitsize="96" type="arm_fpa_ext"/>
<reg name="fps" bitsize="32"/>
</feature>
<!-- <xi:include href="arm-vfp.xml"/>-->
<feature name="org.gnu.gdb.arm.vfp">
<reg name="d0" bitsize="128" type="ieee_double"/>
<reg name="d1" bitsize="128" type="ieee_double"/>
<reg name="d2" bitsize="128" type="ieee_double"/>
<reg name="d3" bitsize="128" type="ieee_double"/>
<reg name="d4" bitsize="128" type="ieee_double"/>
<reg name="d5" bitsize="128" type="ieee_double"/>
<reg name="d6" bitsize="128" type="ieee_double"/>
<reg name="d7" bitsize="128" type="ieee_double"/>
<reg name="d8" bitsize="128" type="ieee_double"/>
<reg name="d9" bitsize="128" type="ieee_double"/>
<reg name="d10" bitsize="128" type="ieee_double"/>
<reg name="d11" bitsize="128" type="ieee_double"/>
<reg name="d12" bitsize="128" type="ieee_double"/>
<reg name="d13" bitsize="128" type="ieee_double"/>
<reg name="d14" bitsize="128" type="ieee_double"/>
<reg name="d15" bitsize="128" type="ieee_double"/>
<reg name="fpsid" bitsize="32" type="uint32"/>
<reg name="fpscr" bitsize="32" type="uint32"/>
<reg name="mvfr1" bitsize="32" type="uint32"/>
<reg name="mvfr0" bitsize="32" type="uint32"/>
<reg name="fpexec" bitsize="32" type="uint32"/>
<reg name="fpinst" bitsize="32" type="uint32"/>
<reg name="fpinst2" bitsize="32" type="uint32"/>
</feature>
</target>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-28 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28 5:50 [Qemu-devel] arm vfp support in gdbstub Vladimir Vukicevic
2008-08-28 15:36 ` Paul Brook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).