On 12/21/2009 02:33 AM, Aurelien Jarno wrote:
On Sat, Dec 19, 2009 at 03:17:16PM -0800, Richard Henderson wrote:
Signed-off-by: Richard Henderson<r...@twiddle.net>
---
  linux-user/main.c |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 12502ad..b67662c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3052,6 +3052,8 @@ int main(int argc, char **argv, char **envp)
          env->ir[30] = regs->usp;
          env->pc = regs->pc;
          env->unique = regs->unique;
+        cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD
+                                   | FPCR_UNFD | FPCR_INED | FPCR_DNOD));
      }

This cpu initialization which does not depends on the binary being run
is usually done in target-*/translate.c, using #if defined
(CONFIG_USER_ONLY).

I didn't want to assume that bsd-user initializes the fpcr to the same value. However, they probably do. This appears to be what you wanted.


r~
commit 033df7a558acdf39d81681f3858f13ebe2a92a6e
Author: Richard Henderson <r...@twiddle.net>
Date:   Mon Dec 21 12:48:43 2009 -0800

    target-alpha: Initialize fpcr.
    
    Linux, at least, disables exceptions by default.
    
    Signed-off-by: Richard Henderson <r...@twiddle.net>

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 5e0647b..87813e7 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -2748,6 +2748,8 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
     env->ps = 0x1F00;
 #if defined (CONFIG_USER_ONLY)
     env->ps |= 1 << 3;
+    cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD
+                               | FPCR_UNFD | FPCR_INED | FPCR_DNOD));
 #endif
     pal_init(env);
     /* Initialize IPR */

Reply via email to