[erlang-questions] porting to NetBSD/amd64

Mikael Pettersson mikpe@REDACTED
Tue Dec 4 13:40:52 CET 2007


On Tue, 4 Dec 2007 10:55:47 +0100, Ignatios Souvatzis wrote:
> I've been pointed to a problem compiling the pkgsrc Meta-Package for
> Erlang to NetBSD/amd64. (The package works fine here on NetBSD/arm32,
> NetBSD/i386 (== all 32bit Intel) and Solaris/sparc).
> 
> Apparently, a part of the configure script compiles some OS+CPU-specific 
> code, with a couple of variants available, to check for "reliable FPU
> exceptions". The default code makes the build process hang cheweing up
> all CPU cycles. (Hm, uncleared FPU exception, or non-incremented PC...)

Yep, x86-64 requires some specific handling due to FP execption
differences between x87 and SSE2. Failure to do this results in
an infinite loop, as you've observed.

> Are there instructions available somewhere to what this code is expected
> to do exactly, so that I can write some code that matches them?

Embedded in erts/configure.in is a file fpe-test.c. It enables
FP exceptions, sets up a handler, and then forces an FP overflow.

If successful this enables faster FP handling in the BEAM virtual
machine. It's also a requirement for HiPE (native code) on all
processors except ARM.

The proper solution is to port fpe-test.c to NetBSD/amd64. It's
already ported to FreeBSD/amd64 and OpenBSD/amd64, so this
shouldn't be too difficult. Once fpe-test.c is ported similar
changes must be done in erts/emulator/sys/unix/sys_float.c.

I wrote most of the FP exception code, so I can do this port
if someone gives me a temporary NetBSD/amd64 account.

/Mikael



More information about the erlang-questions mailing list