Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site felix.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!zehntel!hplabs!sdcrdcf!trwrb!scgvaxd!pertec!felix!wes From: wes@felix.UUCP (Wes Chalfant) Newsgroups: net.unix-wizards Subject: Re: Bourne sh, 68k's and segment traps Message-ID: <311@felix.UUCP> Date: Wed, 27-Jun-84 20:32:57 EDT Article-I.D.: felix.311 Posted: Wed Jun 27 20:32:57 1984 Date-Received: Sun, 1-Jul-84 08:21:25 EDT References: <145@plx.UUCP> Organization: FileNet Corp., Costa Mesa, Ca. Lines: 56 > I am interested in hearing about solutions others have used for > instruction restarts on 68000's. My current "challange" is the > Bourne shell and the way it catches SIGSEGV's and sbrk()'s to > grow its data space. We ran into the same problem with the Bourne shell here. We are running on a 68010 rather than a 68000, but our version of UNIX does not yet support the type of segmentation violation signal handler that the Bourne shell requires. I am not even convinced that we want to support such a functionality, since the 68010 does not restart instructions (like the VAX), but instead saves the internal processor state on a bus error and then retries the failing bus cycle on return from exception. In order for this to work on a 68010, the processor state information would have to be saved somewhere, the user code re-entered in the bus error handler, the kernel re-entered after the bus error handler, and then the processor state restored (doable, but a bit of a mess). We found it easier to just fix the Bourne shell. It takes two lines in blok.c: *** blok.c.orig Wed Jun 27 17:03:04 1984 --- blok.c Mon Jun 18 10:18:33 1984 *************** *** 66,71 reqd += brkincr; reqd &= ~(brkincr-1); blokp=bloktop; bloktop=bloktop->word=BLK(Rcheat(bloktop)+reqd); bloktop->word=BLK(ADR(end)+1); BEGIN REG STKPTR stakadr=STK(bloktop+2); --- 66,81 ----- reqd += brkincr; reqd &= ~(brkincr-1); blokp=bloktop; bloktop=bloktop->word=BLK(Rcheat(bloktop)+reqd); + #ifndef notdef /* don't you just love double negatives? */ + /* at this point, bloktop may be beyond the break. I haven't been + * able to make the 68010 allow you to continue from a user bus + * trap after executing a signal handler that fixes up the bus + * trap, so we'll simply do a more intelligent thing and test + * the bloody thing before we use it. -- wes + */ + if (&bloktop->word >= brkend) + fault(MEMF); + #endif bloktop->word=BLK(ADR(end)+1); BEGIN REG STKPTR stakadr=STK(bloktop+2); ****** As we generally use the Bourne shell very little, we haven't tested this extensively, but this does fix our known cases of the shell failing. Wes Chalfant FileNet Corporation {ucbvax,decvax}!trwrb!felix!wes