Article View: comp.arch
Article #12998Re: catering to bad code
From: rpw3
Date: Thu, 19 Feb 1987 00:35
Date: Thu, 19 Feb 1987 00:35
43 lines
2236 bytes
2236 bytes
In article <14833@amdcad.UUCP> phil@amdcad.UUCP (Phil Ngai) writes:
+---------------
| In a Unix system I am designing, I am considering catering to bad
| code. That is, like the VAX I propose to make location 0 contain a
| readable 0. I think that code which gets ported to a Sun machine often
| has to have this kind of thing cleaned up.
|
| What do people think of this? Is it kind of disgusting?
+---------------
No, no, Mr. Phil, don't do it! ;-}
Well, if you think you MUST do it (I understand limited time/money and
concerns about unlimited risk), do it this way:
Make the a.out format explicitly support specifying the text starting offset.
(System-V COFF format does, and it can be added to BSD a.out easily enough,
if necessary, with a new magic number.)
Make the default be to NOT map in the page, however, write yourself a little
hack that takes an a.out and INSERTS the page of zeros, and adjusts the header
to reflect the offset of zero (rather than "+1 page"). You won't need to
re-link, since the absolute virtual addresses didn't move, just the existence
of page #0.
Benefits:
1. All new code developed on the machine will have the most often bug caught
by default.
2. Old, bad, dirty, broken code can be made to work with just an execution
of the "addpage0" utility on the object (AFTER it has blown up the first
time and you are sure deref'ing a zero pointer is why).
3. You will be able to SLOWLY clean up the ugly code, as time/money permit.
Rob Warnock
Systems Architecture Consultant
UUCP: {amdcad,fortune,sun}!redwood!rpw3
DDD: (415)572-2607
USPS: 627 26th Ave, San Mateo, CA 94403
Technical Details
Message-ID:
<14837@amdcad.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!gatech!amdcad!rpw3References:
<14833@amdcad.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!gatech!amdcad!rpw3 From: rpw3@amdcad.UUCP Newsgroups: comp.arch Subject: Re: catering to bad code Message-ID: <14837@amdcad.UUCP> Date: Wed, 18-Feb-87 19:35:22 EST Article-I.D.: amdcad.14837 Posted: Wed Feb 18 19:35:22 1987 Date-Received: Fri, 20-Feb-87 01:04:33 EST References: <14833@amdcad.UUCP> Reply-To: rpw3@amdcad.UUCP (Rob Warnock) Distribution: world Organization: [Consultant] San Mateo, CA Lines: 43 Summary: No, No, Mr. Bill!!