I am having some difficulties with SIGSEGV in attempting a
registerised build of 6.4.2 for hppa.  ghc run with no arguments
dies like this:

Program received signal SIGSEGV, Segmentation fault.
0xdb7ed0 in removeIndirections ()
(gdb) where
#0  0xdb7ed0 in removeIndirections ()
#1  0xdb7f38 in lookupStableName ()
#2  0xdb7fd4 in getStablePtr ()
#3  0xdbf2cc in makeStablePtrzh_fast ()
(gdb)

(Needless to say the debugger is not as useful as it could be because
much of the code does not use C calling conventions.)

If I understand the failing code, it is chasing down indirections from a closure
structure and ending up trying to treat a *_info routine as if it were
part of the indirection processing.  Chasing things backwards there I see
some fundamental memory corruption going on -- prog_name and prog_argv, for
example, are being overwritten with pointers to code after they were
properly initialized earlier in startup processing.

I did some rewriting of StgRun for hppa -- I think it was wrong but
alas my rewrite didn't fix the SEGV -- and I need to make sure I
understand what StgRun and StgReturn are supposed to be doing.

If I understand correctly, a C routine calls StgRun to execute a
routine in stg-land.  StgRun just allocates some stack space,
saves registers onto the stack and jumps to the desired stg entry point.
That does its thing then jumps to StgReturn, which then restores registers,
pops the stack area, and returns the results to the C routine that called
StgRun.

What is the purpose of RESERVED_C_STACK_BYTES?  Are stg routines
expecting a free area of that size at *top* of stack?  I need to make sure
that I have saved the registers at the correct end of the stack frame created
in StgRun.  It is difficult to tell from the existing hppa code what exactly
was intended.
-- 
Joe Buehler

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to