qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 7/7] target-m68k: add FPCR and FPSR


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v4 7/7] target-m68k: add FPCR and FPSR
Date: Mon, 19 Jun 2017 14:16:26 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 06/11/2017 04:16 PM, Laurent Vivier wrote:
@@ -95,8 +101,14 @@ static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t 
*mem_buf, int n)
          env->fregs[n].d = float64_to_floatx80(ldfq_p(mem_buf), &s);
          return 8;
      }
-    if (n < 11) {
-        /* FP control registers (not implemented)  */
+    switch (n) {
+    case 8: /* fpcontrol */
+        env->fpcr = ldl_p(mem_buf);
+        return 4;

Should use cpu_m68k_set_fpcr.


+DEF_HELPER_2(set_fpcr, void, env, i32)

Hmm. I suppose the write to env->fpcr means you can't indicate TCG_CALL_NO_RWG. I wonder if it's better as

uint32_t HELPER(set_fpcr)(CPUM68KState *env, uint32_t val)
{
   cpu_m68k_set_fpcr(env, val);
   return env->fpcr;
}

DEF_HELPER_FLAGS_2(set_fpcr, i32, env, i32)

gen_helper_set_fpcr(QEMU_FPCR, cpu_env, val);

This skirts the rules of TCG, but it'll work, since we disguise the (incorrect) write to env->fpcr with a (correct but redundant) write to QEMU_FPCR.

Any time we can avoid spilling all globals we're better off.

As an alternative, is it really that important to represent FPSR and FPCR as tcg registers? Perhaps it's better to just tcg_gen_ld/st instead?


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]