Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!lll-tis!oodis01!uplherc!sp7040!obie!wes From: wes@obie.UUCP (Barnacle Wes) Newsgroups: comp.lang.c Subject: Re: Partial application in C Summary: This is called `Split I & D space' in PDP-11 vernacular.. Message-ID: <255@obie.UUCP> Date: 28 Jun 88 01:16:49 GMT References: <3353@cognos.UUCP> <619@goofy.megatest.UUCP> Organization: Great Salt Lake Yacht Club, north branch Lines: 36 From article <3353@cognos.UUCP>, by jimp@cognos.uucp (Jim Patterson): > there are machines that don't allow you to execute data as > code. In article <619@goofy.megatest.UUCP>, djones@megatest.UUCP (Dave Jones) replies: % I began to wonder why such a restriction might be deemed necessary. % Was it Big Brother engineering? -- Thou shalt not modify thy % executable, for it is a Bad Thing. -- Or is there a valid technical % reason behind it? I can see one possible rationale: You can have 128KB of % memory in a sixteen bit machine, divided evenly between data and code, % if you use all the addresses for both kinds of memory. This is called `Split I & D space' in PDP-11 vernacular. Many other machines have similar features - the '286 for instance. Every segment on the 286 (in 286 mode, of course) has a descriptor. Each descriptor has a byte, called the Access Rights Byte, that contains protection bits for the segment. Bit 4 is the 'executable' flag; if 0, this is a Data Segment Descriptor, if 1, this is a Executable Code Segment Descriptor. Now, if this is a Data Segment Descriptor, bit 1 describes whether this segment is read-only (0), or read-write (1). If, on the other tentacle, this is an Executable Code Segment Descriptor, bit 1 describes whether the segment can be read (1) or not (0). You cannot write to an Executable Code Segment! The system, of course, loads a program as data segments and then modifies the segment descriptors to make them executable. I hope this wasn't hopelessly overboard - looking a real data (even if it is for a brain-dead cpu like the 286) makes things look a little clearer to me. -- {uwmcsd1, hpda}!sp7040!obie!wes | "If I could just be sick, I'd be fine." +1 801 825 3468 | -- Joe Housely --