Re: [9fans] signal.h in APE for newbies

2008-07-04 Thread Charles Forsyth
 When I trigger a division by zero the handler is not called, I just
 get trap 19 message.

if i do a floating-point division by zero, the SIGFPE signal handler is called,
because ape's signal recognises the initial sys: fp: .  (ie, it works for me.)

it doesn't work for an integer division by zero, which produces a different 
message for the underlying notify:

8.out 205840: suicide: sys: trap: divide error pc=0x1089

but that's fine too! Linux's signal(2) says, apparently referring to POSIX 
rules:

  Integer division by zero  has  undefined  result.
   On some architectures it will generate a SIGFPE signal.  (Also dividing
   the most negative integer by -1 may generate  SIGFPE.)   Ignoring  this
   signal might lead to an endless loop.

Linux might not be particularly good at documenting this particular area,
so perhaps the standard(s) have useful hints or advice that APE could follow.




Re: [9fans] signal.h in APE for newbies

2008-07-04 Thread Russ Cox
 Any chance this is some 9vx issue? I tried the test code below it
 worked in 9grid.jp ,but gave the following message in 9vx

You are caught in quite a tangled web.

The hardware gets a floating point trap,
Linux/BSD/OS X turns it into a SIGFPE, 
vx32 turns it back into a hardware trap,
Plan 9 turns it into a note,
APE turns it back into a SIGFPE.

Unfortunately for you, vx32 does not do
a very good job turning SIGFPEs into the
correct hardware trap.  Someone needs to
go through the various systems and figure
out what the right mapping is from 
info-si_code back to x86 exception code.
When I started to do this, I got very confused
and didn't care enough to muddle through.

Russ




Re: [9fans] signal.h in APE for newbies

2008-07-04 Thread Charles Forsyth
 Any chance this [fp signals in APE] is some 9vx issue?

vx32 converts SIGFPE to the SIMD SSE/SSE2 trap 19, but
9vx expects only x87.

i had wondered the other day whether there were AMD/Intel processors
in common use that supported x87 but not SSE/SSE2.  should 8c start
using SSE as the plan 9 amd64 compiler does? could it support that exclusively?




Re: [9fans] signal.h in APE for newbies

2008-07-04 Thread Charles Forsyth
 it probablly could.  but i worry about low-power x86
 devices.  perhaps floating point is just not an issue
 on them?

do they support fp at all, or just x87 not sse?
i can't remember what is on the little soekris boards




Re: [9fans] signal.h in APE for newbies

2008-07-04 Thread erik quanstrom
 it probablly could.  but i worry about low-power x86
 devices.  perhaps floating point is just not an issue
 on them?
 
 do they support fp at all, or just x87 not sse?
 i can't remember what is on the little soekris boards

according to wikipedia, geode before the nx don't support sse,
but the do support fp.  i belive that the common soekris
have pre-nx chips, as the slowest nx chip is 667mhz.

- erik