From: Fumiaki Kamiya
Subject: cannot run CMUCL on Solaris
Date: 
Message-ID: <a2rancr7o0.fsf@pomo.cse.ucsc.edu>
I'm having trouble trying to run CMUCL on Sparc-based
Solaris.
On some of the machines, I get

segv_handler: No mapping fault: 0x00978000
segv_handler: Recursive no mapping fault (stack overflow?)

and it returns to the shell.  I have CMUCLLIB and
CMUCL_EMPTYFILE defined.  It appears to me that this only
happens on UltraSparcs and not on non-UltraSparcs.

Is this a known bug? Is there a way to get around this??

-- 
Fumiaki Kamiya

From: Martin Cracauer
Subject: Re: cannot run CMUCL on Solaris
Date: 
Message-ID: <1996Oct6.172903.9652@wavehh.hanse.de>
Fumiaki Kamiya <······@cse.ucsc.edu> writes:

>I'm having trouble trying to run CMUCL on Sparc-based
>Solaris.

Is this an Ultrasparc machine?

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <········@wavehh.hanse.de>  http://www.bik-gmbh.de/~cracauer
"As far as I'm concerned,  if something is so complicated that you can't ex-"
"plain it in 10 seconds, then it's probably not worth knowing anyway"- Calvin
From: Fumiaki Kamiya
Subject: Re: cannot run CMUCL on Solaris
Date: 
Message-ID: <a2n2xz9w7u.fsf@apache.cse.ucsc.edu>
In article <····················@wavehh.hanse.de> ········@wavehh.hanse.de (Martin Cracauer) writes:

> Fumiaki Kamiya <······@cse.ucsc.edu> writes:
> 
> >I'm having trouble trying to run CMUCL on Sparc-based
> >Solaris.
> 
> Is this an Ultrasparc machine?

Yes.
-- 
Fumiaki Kamiya
From: Martin Cracauer
Subject: Re: cannot run CMUCL on Solaris
Date: 
Message-ID: <1996Oct7.122743.24831@wavehh.hanse.de>
Fumiaki Kamiya <······@cse.ucsc.edu> writes:

>In article <····················@wavehh.hanse.de> ········@wavehh.hanse.de (Martin Cracauer) writes:

>> Fumiaki Kamiya <······@cse.ucsc.edu> writes:
>> 
>> >I'm having trouble trying to run CMUCL on Sparc-based
>> >Solaris.
>> 
>> Is this an Ultrasparc machine?

>Yes.

CMUCL currently doesn't run on Ultrasparcs, sorry. There are a few
things I could try to make it run, with about 50% chance to fix the
problem, but I don't have access to such a maschine (hint, hint :-).

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <········@wavehh.hanse.de>  http://www.bik-gmbh.de/~cracauer
"As far as I'm concerned,  if something is so complicated that you can't ex-"
"plain it in 10 seconds, then it's probably not worth knowing anyway"- Calvin
From: Fumiaki Kamiya
Subject: Re: cannot run CMUCL on Solaris
Date: 
Message-ID: <a2vicihwsw.fsf@pomo.cse.ucsc.edu>
In article <···············@mail.fwi.uva.nl> ······@fwi.uva.nl (Casper H.S. Dik) writes:

> The fix is simple; just zero the 6 bits in the instruction when you
> encounter it.

How do you do that?
..or where can I get a fixed core, if that's all it's
needed.
I don't mind recompiling but I cannot even construct
internals.h...:-(

-- 
Fumiaki Kamiya
From: Casper H.S. Dik - Network Security Engineer
Subject: Re: cannot run CMUCL on Solaris
Date: 
Message-ID: <casper.845460646@uk-usenet.uk.sun.com>
Fumiaki Kamiya <······@cse.ucsc.edu> writes:

>In article <···············@mail.fwi.uva.nl> ······@fwi.uva.nl (Casper H.S. Dik) writes:

>> The fix is simple; just zero the 6 bits in the instruction when you
>> encounter it.

>How do you do that?
>..or where can I get a fixed core, if that's all it's
>needed.
>I don't mind recompiling but I cannot even construct
>internals.h...:-(

Here's some code that does it automagically.

It intercepts the sigill handler and fixes the offending instructions
as they are found.

/*
 * ··········@Holland.Sun.COM
 *
 * Make CMUCL for UltraSPARC work for those that cannot rebuild it.
 *
 * Compile with:
 *
 *	cc -Kpic -G -o cmucl-workaround.so cmucl-workaround.c -O
 * or
 *	gcc -fpic -shared -o cmucl-workaround.so cmucl-workaround.c -O
 *
 * Use as:
 *	env LD_PRELOAD=<full-path-to>/cmucl-workaround.so cmu-lisp
 */


#include <ucontext.h>
#include <stdio.h>
#include <dlfcn.h>
#include <signal.h>

static int (*org_sigaction)(int, const struct sigaction *, struct sigaction *);
static struct sigaction sigillact;

static void myhandler(int sig, siginfo_t * info, void * p)
{
    struct ucontext *uc  = p;
    unsigned int *pc = (unsigned int*)
	uc->uc_mcontext.gregs[REG_PC];

    if (info->si_code == ILL_ILLOPC && (*pc & 0xe1f82000) == 0x81d02000) {
	/* this assumes the segment the PC is in is writable */
	*pc &= ~0x1f80;
	/* flush icache should go here */
	return;
    }
    if (sigillact.sa_flags & SA_SIGINFO)
	sigillact.sa_sigaction(sig, info, p);
    else
	sigillact.sa_handler(sig);
}
	
int sigaction(int sig, const struct sigaction *act,
	  struct sigaction *oact)
{
    struct sigaction newact;
    if (!org_sigaction) {
	org_sigaction =
	    (int(*)(int, const struct sigaction *, struct sigaction *))
	    dlsym(RTLD_NEXT,"sigaction");
	if (org_sigaction == 0) {
	    fprintf(stderr,"sigaction: %s\n", dlerror());
	    exit(2);
	}
    }
    if (sig == SIGILL) {
	if (act)  {			/* setting */
	    newact = sigillact = *act;
	    newact.sa_flags |= SA_SIGINFO;
	    newact.sa_sigaction = myhandler;
	    act = &newact;
	}
	if (oact) {
	    *oact = sigillact;
	    oact = NULL;
	}
    }
    return org_sigaction(sig, act, oact);
}
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.