aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-11 19:22:27 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-11 19:22:27 +0000
commit8e33c08c84b9f418dee69f79e7b579c59e77814b (patch)
treec86cdb9f3a9529ef4b1851d0d34e9f364a219415 /gdbstub.c
parent197ea35ab2175f7faaee4cb416332dc28db5bbbe (diff)
downloadqemu-8e33c08c84b9f418dee69f79e7b579c59e77814b.zip
qemu-8e33c08c84b9f418dee69f79e7b579c59e77814b.tar.gz
qemu-8e33c08c84b9f418dee69f79e7b579c59e77814b.tar.bz2
MIPS FPU support for the gdb stub, by Daniel Jacobowitz.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2242 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 9e10c0c..a5e68ae 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -532,11 +532,37 @@ static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
*(uint32_t *)ptr = tswapl(env->PC);
ptr += 4;
+#ifdef MIPS_USES_FPU
+ for (i = 0; i < 32; i++)
+ {
+ *(uint32_t *)ptr = tswapl(FPR_W (env, i));
+ ptr += 4;
+ }
+
+ *(uint32_t *)ptr = tswapl(env->fcr31);
+ ptr += 4;
+
+ *(uint32_t *)ptr = tswapl(env->fcr0);
+ ptr += 4;
+#endif
+
/* 32 FP registers, fsr, fir, fp. Not yet implemented. */
+ /* what's 'fp' mean here? */
return ptr - mem_buf;
}
+/* convert MIPS rounding mode in FCR31 to IEEE library */
+static unsigned int ieee_rm[] =
+ {
+ float_round_nearest_even,
+ float_round_to_zero,
+ float_round_up,
+ float_round_down
+ };
+#define RESTORE_ROUNDING_MODE \
+ set_float_rounding_mode(ieee_rm[env->fcr31 & 3], &env->fp_status)
+
static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
{
int i;
@@ -566,6 +592,28 @@ static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
env->PC = tswapl(*(uint32_t *)ptr);
ptr += 4;
+
+#ifdef MIPS_USES_FPU
+ for (i = 0; i < 32; i++)
+ {
+ FPR_W (env, i) = tswapl(*(uint32_t *)ptr);
+ ptr += 4;
+ }
+
+ env->fcr31 = tswapl(*(uint32_t *)ptr) & 0x0183FFFF;
+ ptr += 4;
+
+ env->fcr0 = tswapl(*(uint32_t *)ptr);
+ ptr += 4;
+
+ /* set rounding mode */
+ RESTORE_ROUNDING_MODE;
+
+#ifndef CONFIG_SOFTFLOAT
+ /* no floating point exception for native float */
+ SET_FP_ENABLE(env->fcr31, 0);
+#endif
+#endif
}
#elif defined (TARGET_SH4)
static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)