qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, daniel@0x0f.com
Subject: [PATCH v3 26/26] target/m68k: Implement FPIAR
Date: Mon,  9 Sep 2024 10:28:23 -0700	[thread overview]
Message-ID: <20240909172823.649837-27-richard.henderson@linaro.org> (raw)
In-Reply-To: <20240909172823.649837-1-richard.henderson@linaro.org>

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



      parent reply	other threads:[~2024-09-09 17:30 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 17:27 [PATCH v3 00/26] target/m68k: fpu improvements Richard Henderson
2024-09-09 17:27 ` [PATCH v3 01/26] target/m68k: Always return a temporary from gen_lea_mode Richard Henderson
2024-09-09 17:27 ` [PATCH v3 02/26] target/m68k: Add FPSR exception bit defines Richard Henderson
2024-09-09 17:28 ` [PATCH v3 03/26] target/m68k: Restore fp rounding mode on vm load Richard Henderson
2024-09-09 21:59   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 04/26] target/m68k: Keep FPSR up-to-date Richard Henderson
2024-09-09 17:28 ` [PATCH v3 05/26] target/m68k: Update FPSR.EXC Richard Henderson
2024-09-09 17:28 ` [PATCH v3 06/26] softfloat: Set QEMU_NO_HARDFLOAT for m68k Richard Henderson
2024-09-09 17:28 ` [PATCH v3 07/26] target/m68k: Invoke update_fpsr for FMOVECR Richard Henderson
2024-09-09 17:28 ` [PATCH v3 08/26] target/m68k: Introduce M68K_FEATURE_FPU_PACKED_DECIMAL Richard Henderson
2024-09-09 17:28 ` [PATCH v3 09/26] target/m68k: Merge gen_ea into SRC_EA and DEST_EA Richard Henderson
2024-09-09 22:02   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 10/26] target/m68k: Use g_assert_not_reached in gen_lea_mode and gen_ea_mode Richard Henderson
2024-09-09 22:03   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 11/26] target/m68k: Use OS_UNSIZED in LEA, PEA, JMP Richard Henderson
2024-09-09 17:28 ` [PATCH v3 12/26] target/m68k: Move pre-dec/post-inc to gen_lea_mode Richard Henderson
2024-09-09 17:28 ` [PATCH v3 13/26] target/m68k: Split gen_ea_mode for load/store Richard Henderson
2024-09-09 17:28 ` [PATCH v3 14/26] target/m68k: Remove env argument to gen_lea_indexed Richard Henderson
2024-09-09 22:05   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 15/26] target/m68k: Remove env argument to gen_lea_mode Richard Henderson
2024-09-09 22:06   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 16/26] target/m68k: Remove env argument to gen_load_mode Richard Henderson
2024-09-09 22:06   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 17/26] target/m68k: Remove env argument to gen_store_mode Richard Henderson
2024-09-09 22:06   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 18/26] target/m68k: Remove env argument to gen_ea_mode_fp Richard Henderson
2024-09-09 22:06   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 19/26] target/m68k: Split gen_ea_mode_fp for load/store Richard Henderson
2024-09-09 22:13   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 20/26] target/m68k: Move gen_addr_fault into gen_{load, store}_mode_fp Richard Henderson
2024-09-09 22:14   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 21/26] target/m68k: Merge gen_load_fp, gen_load_mode_fp Richard Henderson
2024-09-09 22:16   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 22/26] target/m68k: Merge gen_store_fp, gen_store_mode_fp Richard Henderson
2024-09-09 22:16   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` [PATCH v3 23/26] target/m68k: Implement packed decimal real loads and stores Richard Henderson
2024-09-09 17:28 ` [PATCH v3 24/26] tests/tcg/m68k: Add packed decimal tests Richard Henderson
2024-09-09 17:28 ` [PATCH v3 25/26] target/m68k: Make vmstate variables static Richard Henderson
2024-09-09 22:17   ` Philippe Mathieu-Daudé
2024-09-09 17:28 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240909172823.649837-27-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=daniel@0x0f.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).