aboutsummaryrefslogtreecommitdiff
path: root/target/i386/gdbstub.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/i386/gdbstub.c')
-rw-r--r--target/i386/gdbstub.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index c3a2cf6f28..786971284a 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -121,7 +121,9 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
return gdb_get_reg32(mem_buf, env->regs[gpr_map32[n]]);
}
} else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) {
- floatx80 *fp = (floatx80 *) &env->fpregs[n - IDX_FP_REGS];
+ int st_index = n - IDX_FP_REGS;
+ int r_index = (st_index + env->fpstt) % 8;
+ floatx80 *fp = &env->fpregs[r_index].d;
int len = gdb_get_reg64(mem_buf, cpu_to_le64(fp->low));
len += gdb_get_reg16(mem_buf, cpu_to_le16(fp->high));
return len;