Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!ucsd!helios.ee.lbl.gov!pasteur!ucbvax!icaen.uiowa.edu!dbfunk From: dbfunk@icaen.uiowa.edu (David B Funk) Newsgroups: comp.sys.apollo Subject: Re: GUARD FAULT ? Message-ID: <8912151054.AA00867@icaen.uiowa.edu> Date: 15 Dec 89 10:29:03 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: Iowa Computer Aided Engineering Network, University of Iowa Lines: 31 WRT posting: <923@tlc.tlc.com> > Does anyone know what a GUARD FAULT is ?. I got it in a deeply recursive > routine on an DN-4000, SR 0.1, bsd4.2. The same program runs ok on a SUN. -- A Guard Fault is the error that you get when your program runs off the end of its stack segment. IE runs out of stack space. Apollo uses a "guard segment" to implement its stack overflow trapping. This is a small (32Kb) segment that is put in memory just after the stack segment. Its MMU atributes are set to trap on any access. So when you program goes walking off the end of its stack, it runs into the guard segment and triggers a guard fault trap. It is possible to run off the stack and not trigger a guard fault. If a program goes "walking" down the stack in small steps (less than 32Kb) then it will trigger a guard fault when it hits the end. Such as the case of a overly deep recursive program with moderate amounts of local storage. But if the process has large amounts of local storage (>64Kb) so that it goes down the stack in large steps, it is possible to "step over" the guard segment and mess up other things. This can result in errors like "segmentation fault", "access violation" or the dreaded "unable to unwind stack" (really FUBAR). In any case, you need more stack space. The system allocates a 256Kb stack by default (Do a man/help on "limits"). This is considered big enough for general purposes but not so large that it will eat up lots of disk space for each active process. (On the DN10k under sr10.0.p the default stack size was 5Mb and people started screaming when the found that they lost 5Mbytes of disk each time another process started up.) There is an option to the loader (binder) that can be used to request a larger stack when making your program. Dave Funk