Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!news.arc.nasa.gov!sgi!shinobu!odin!blythe From: blythe@sgi.com (David Blythe) Newsgroups: comp.sys.sgi Subject: Re: mpin and function length Message-ID: <1991Jun20.043719.14795@odin.corp.sgi.com> Date: 20 Jun 91 04:37:19 GMT References: <1991Jun19.172430.5654@news.larc.nasa.gov> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 33 In article <1991Jun19.172430.5654@news.larc.nasa.gov> alan@hal.larc.nasa.gov (alan dare) writes: > > >Irix'ers, > > I have been looking at some of the "REACT" features and the demo >program in section 14 volume II of the Iris-4D Programmers Guide. The program >pins the signal handler into memory. Seems like a good idea. To find the >length of the signal handling function the following is done during pinning: > > mpin((char *)catcher, (int)pinmem - (int)catcher); > > In the source code pinmem() is directly after catcher(). Thus, the >size of the function is found. I would like to pin my signal handler in >memory, but I have some questions about finding the function length. If i'm >using O3 optimization or a Power compiler I think the locations of the >functions could be changed (Correct ?). The problem could also arise if >an engineer after me mods the program and changes the function location. >I would like to find another solution to dynamicly determine the function >length, but I don't know how. > > If I am off base here, please tell me what i'm missing. If not, anyone >have any good ideas? Since mpin works in terms of pages and signal handlers shouldn't be *that* big, I would just make a reasonably generous guess at how big the code was and plug that in, we are talking about a couple of pages so overestimating by a page or two isn't going to hurt. Say 8096 bytes, and a comment indicating that if someone adds a lot to the signal handler to increase the size. You can also compile the signal handler in a separate .o file and use the size command to determine its real size. db