Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!mailrus!ncar!unmvax!bbx!bbxsda!scott From: scott@bbxsda.UUCP (Scott Amspoker) Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <138@bbxsda.UUCP> Date: 21 Sep 89 17:03:12 GMT References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU> <16507@watdragon.waterloo.edu> <990@kim.misemi> Reply-To: scott@bbxsda.UUCP (Scott Amspoker) Organization: Basis International, Albuquerque, NM Lines: 25 In article <990@kim.misemi> kim@kim.misemi (Kim Letkeman) writes: > >Can you tell me how you would go about causing an 80286 to trap on >load of a "bad" value in the ES That's? This register is internal to >the CPU and I doubt that there are any values that would cause a trap >to be raised simply by loading them. When you load a segment register on an 80286/80386 in *protected* mode the CPU actually goes into an in-memory table an load a segment descriptor in to an on-chip cache so that subsequent address translation is reasonably fast. If the segment register is loaded with a value that does not have an associated segment descriptor then a trap occurs. This normally doesn't cause a problem. ES is not preserved across CALLs. C compilers on the 80286 are not inclined to load ES just to perform a pointer move or compare because 1) segment register loads are expensive 2) there is no segment register compare instruction In *real* mode (MS-DOS) there is no possibility of a bad address trap. -- Scott Amspoker Basis International, Albuquerque, NM (505) 345-5232