qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PULL 2/5] target-m68k: initialize FPU registers
Date: Wed, 21 Jun 2017 23:00:44 +0200	[thread overview]
Message-ID: <20170621210047.24083-3-laurent@vivier.eu> (raw)
In-Reply-To: <20170621210047.24083-1-laurent@vivier.eu>

on reset, set FP registers to NaN and control registers to 0

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20170620205121.26515-3-laurent@vivier.eu>
---
 target/m68k/cpu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index f068922..f2e031f 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -49,6 +49,8 @@ static void m68k_cpu_reset(CPUState *s)
     M68kCPU *cpu = M68K_CPU(s);
     M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
     CPUM68KState *env = &cpu->env;
+    float64 nan = float64_default_nan(NULL);
+    int i;
 
     mcc->parent_reset(s);
 
@@ -57,7 +59,12 @@ static void m68k_cpu_reset(CPUState *s)
     env->sr = 0x2700;
 #endif
     m68k_switch_sp(env);
-    /* ??? FP regs should be initialized to NaN.  */
+    for (i = 0; i < 8; i++) {
+        env->fregs[i] = nan;
+    }
+    env->fpcr = 0;
+    env->fpsr = 0;
+
     cpu_m68k_set_ccr(env, 0);
     /* TODO: We should set PC from the interrupt vector.  */
     env->pc = 0;
-- 
2.9.4

  parent reply	other threads:[~2017-06-21 21:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 21:00 [Qemu-devel] [PULL 0/5] M68k for 2.10 patches Laurent Vivier
2017-06-21 21:00 ` [Qemu-devel] [PULL 1/5] target-m68k: move fmove CR to a function Laurent Vivier
2017-06-21 21:00 ` Laurent Vivier [this message]
2017-06-21 21:00 ` [Qemu-devel] [PULL 3/5] target-m68k: use floatx80 internally Laurent Vivier
2017-06-21 21:00 ` [Qemu-devel] [PULL 4/5] target-m68k: define 96bit FP registers for gdb on 680x0 Laurent Vivier
2017-06-21 21:00 ` [Qemu-devel] [PULL 5/5] target-m68k: add FPCR and FPSR Laurent Vivier
2017-06-23  8:44 ` [Qemu-devel] [PULL 0/5] M68k for 2.10 patches Peter Maydell

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=20170621210047.24083-3-laurent@vivier.eu \
    --to=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).