Current-Users archive

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

Re: Help needed with FPE handling



Hi -

martti.kuparinen%iki.fi@localhost said:
> As you can see, the patch-as file does not work on amd64

I don't have an amd64 to test. How does it fail?
There is one obvious strangeness with your patch: it leaves "pc"
uninitialized.
Why are you doing it differently than all the other OSes?

I can at least contribute an implementation for i386, see
the appended patch. "make test" succeeds, how can I check
whether it really works?

best regards
Matthias


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDirig Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Index: patches/patch-as
===================================================================
RCS file: /cvsroot/pkgsrc-wip/wip/erlang/patches/patch-as,v
retrieving revision 1.4
diff -u -r1.4 patch-as
--- patches/patch-as    24 Feb 2010 13:49:55 -0000      1.4
+++ patches/patch-as    18 Jun 2010 15:54:00 -0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-as,v 1.1 2009/12/15 12:09:20 asau Exp $
+$NetBSD$
 
---- erts/emulator/sys/unix/sys_float.c.orig    2010-02-19 20:04:07.000000000 
+0200
-+++ erts/emulator/sys/unix/sys_float.c 2010-02-24 14:43:43.000000000 +0200
-@@ -476,7 +476,7 @@
+--- erts/emulator/sys/unix/sys_float.c.orig    2010-02-19 18:04:07.000000000 
+0000
++++ erts/emulator/sys/unix/sys_float.c
+@@ -476,7 +476,7 @@ static int mask_fpe(void)
  
  #endif
  
@@ -11,17 +11,35 @@
  
  #if defined(__linux__) && defined(__i386__)
  #if !defined(X86_FXSR_MAGIC)
-@@ -519,6 +519,9 @@
+@@ -519,6 +519,11 @@ static int mask_fpe(void)
  #define mc_pc(mc)     ((mc)->mc_rip)
  #elif defined(__FreeBSD__) && defined(__i386__)
  #define mc_pc(mc)     ((mc)->mc_eip)
++#elif defined(__NetBSD__) && defined(__i386__)
++#define mc_pc(mc)     ((mc)->__gregs[_REG_EIP])
 +#elif defined(__NetBSD__) && defined(__x86_64__)
 +#define mc_pc(mc)     ((mc)->__gregs[_REG_RIP])
 +typedef mcontext_t *erts_mcontext_ptr_t;
  #elif defined(__OpenBSD__) && defined(__x86_64__)
  #define mc_pc(mc)     ((mc)->sc_rip)
  #elif defined(__sun__) && defined(__x86_64__)
-@@ -615,6 +618,14 @@
+@@ -610,11 +615,30 @@ static void fpe_sig_action(int sig, sigi
+       struct env87 *env87 = &savefpu->sv_87.sv_env;
+       env87->en_sw &= ~0xFF;
+     }
++#elif defined(__NetBSD__) && defined(__i386__)
++    mcontext_t *mc = &uc->uc_mcontext;
++    pc = mc_pc(mc);
++    if (uc->uc_flags & _UC_FXSAVE) {
++      struct envxmm *envxmm = (struct envxmm *)&mc->__fpregs;
++      envxmm->en_mxcsr = 0x1F80;
++      envxmm->en_sw &= ~0xFF;
++    } else {
++      struct env87 *env87 = (struct env87 *)&mc->__fpregs;
++      env87->en_sw &= ~0xFF;
++    }
+ #elif defined(__OpenBSD__) && defined(__x86_64__)
+     struct fxsave64 *fxsave = uc->sc_fpstate;
      pc = mc_pc(uc);
      fxsave->fx_mxcsr = 0x1F80;
      fxsave->fx_fsw &= ~0xFF;
$NetBSD$

--- lib/mnesia/test/Makefile.orig       2009-03-12 12:27:42.000000000 +0000
+++ lib/mnesia/test/Makefile
@@ -109,7 +109,7 @@ release_spec: opt
 release_tests_spec: opt
        $(INSTALL_DIR) $(RELSYSDIR)
        $(INSTALL_DATA) mnesia.spec mnesia.spec.vxworks $(ERL_FILES) 
$(HRL_FILES) $(RELSYSDIR)
-       $(INSTALL_PROGRAM) mt $(INSTALL_PROGS) $(RELSYSDIR)
+       $(INSTALL_SCRIPT) mt $(INSTALL_PROGS) $(RELSYSDIR)
 #      chmod -f -R u+w $(RELSYSDIR)
 #      @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)
 


Home | Main Index | Thread Index | Old Index