Path: utzoo!attcan!uunet!mcvax!enea!kth!sics!uplog!thomas From: thomas@uplog.se (Thomas Hameenaho) Newsgroups: comp.arch Subject: Re: NULL pointers (was: Software Distribution) Keywords: software distribution, null pointers Message-ID: <303@uplog.se> Date: 3 Oct 88 07:29:05 GMT References: <978@esunix.UUCP> <3112@pt.cs.cmu.edu> Reply-To: thomas@uplog.UUCP (Thomas Hameenaho) Organization: TeleLOGIC Uppsala AB Lines: 22 In article <3112@pt.cs.cmu.edu> bsy@PLAY.MACH.CS.CMU.EDU (Bennet Yee) writes: >Of course, if your machine core dumps on dereferencing NULL, just trap the >fault (SIGSEGV), check the instruction that caused the trap, and patch up >and return if it was due to dereferencing NULL; otherwise dump core. If we >presume that most pointers dereferenced are not NULL, then the run-time >costs are small. It's a very machine dependent solution, but certainly can >be done on any Unix machine. This problem should be easy to solve hadn't it been the case that many Unix kernels are defunct when it comes to using the a.out header. Our Pyramid (hint hint!) dumps core if the text segment doesn't start on virtual address 0! The sysV 68020 machines we have can correctly use the header. You can for instance have the entry point at address 4 and have a 0 at address 0 if you just want to be able to run the code as is. Or if you prefer you can skip page 0 and trap any references to 0 and once and for all fix the offending code. -- Real life: Thomas Hameenaho Email: thomas@uplog.{se,uucp} Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden