So far, this is only read-as-written.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/m68k/cpu.h | 1 +
target/m68k/cpu.c | 23 ++++++++++++++++++++++-
target/m68k/helper.c | 14 ++++++++------
3 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index a676ae0b34..9d987b42be 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -110,6 +110,7 @@ typedef struct CPUArchState {
uint32_t fpsr;
bool fpsr_inex1; /* live only with an in-flight decimal operand */
float_status fp_status;
+ uint32_t fpiar;
uint64_t mactmp;
/*
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index fd6c227820..e36eb3e5d6 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -392,6 +392,23 @@ static const VMStateDescription vmstate_freg = {
}
};
+static bool fpu_fpiar_needed(void *opaque)
+{
+ M68kCPU *s = opaque;
+ return s->env.fpiar != 0;
+}
+
+static const VMStateDescription vmstate_fpiar = {
+ .name = "cpu/fpu/fpiar",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = fpu_fpiar_needed,
+ .fields = (const VMStateField[]) {
+ VMSTATE_UINT32(env.fpiar, M68kCPU),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static int fpu_post_load(void *opaque, int version)
{
M68kCPU *s = opaque;
@@ -412,7 +429,11 @@ static const VMStateDescription vmstate_fpu = {
VMSTATE_STRUCT_ARRAY(env.fregs, M68kCPU, 8, 0, vmstate_freg, FPReg),
VMSTATE_STRUCT(env.fp_result, M68kCPU, 0, vmstate_freg, FPReg),
VMSTATE_END_OF_LIST()
- }
+ },
+ .subsections = (const VMStateDescription * const []) {
+ &vmstate_fpiar,
+ NULL
+ },
};
static bool cf_spregs_needed(void *opaque)
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 6fc5afd296..dae6542e6d 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -44,8 +44,8 @@ static int cf_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n)
return gdb_get_reg32(mem_buf, env->fpcr);
case 9: /* fpstatus */
return gdb_get_reg32(mem_buf, env->fpsr);
- case 10: /* fpiar, not implemented */
- return gdb_get_reg32(mem_buf, 0);
+ case 10: /* fpiar */
+ return gdb_get_reg32(mem_buf, env->fpiar);
}
return 0;
}
@@ -67,7 +67,8 @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
case 9: /* fpstatus */
env->fpsr = ldl_p(mem_buf);
return 4;
- case 10: /* fpiar, not implemented */
+ case 10: /* fpiar */
+ env->fpiar = ldl_p(mem_buf);
return 4;
}
return 0;
@@ -89,8 +90,8 @@ static int m68k_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n)
return gdb_get_reg32(mem_buf, env->fpcr);
case 9: /* fpstatus */
return gdb_get_reg32(mem_buf, env->fpsr);
- case 10: /* fpiar, not implemented */
- return gdb_get_reg32(mem_buf, 0);
+ case 10: /* fpiar */
+ return gdb_get_reg32(mem_buf, env->fpiar);
}
return 0;
}
@@ -112,7 +113,8 @@ static int m68k_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
case 9: /* fpstatus */
env->fpsr = ldl_p(mem_buf);
return 4;
- case 10: /* fpiar, not implemented */
+ case 10: /* fpiar */
+ env->fpiar = ldl_p(mem_buf);
return 4;
}
return 0;
--
2.43.0