From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ac6f6c30c45f808a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!spool-3.news.visi.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 17 Jan 2005 15:33:49 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <41E7F653.2F899F47@alfred-hilscher.de> Subject: Re: Ada equivalent for C-pointer? Date: Mon, 17 Jan 2005 15:35:38 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-Cvnts33Ogani7DDhWIg/FmAQGVuIuomNSZ79r2yKs6H1Ps4RM8q+mOvSJ+K83KopAA0r2ryV3opYCF9!tZhw9rKS7KwMKaL8nEuOH4xtKfjihtx+aOFdaIYmdAb1i5XyOkx9hs1jlLgCD95W2SHhc2jlf4mF X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.22 Xref: g2news1.google.com comp.lang.ada:7878 Date: 2005-01-17T15:35:38-06:00 List-Id: "Nick Roberts" wrote in message news:gemini.iad826000p84p02bc.nick.roberts@acm.org... ... > In what is called the 'flat' 32-bit memory model, a far pointer is the same > as near pointer (a 32-bit absolute offset, on its own). Since 32-bit Windows > (and indeed 32-bit Linux) only uses the flat memory model, this mode > appertains mandatorily. > > However, in 32-bit segmented mode, a far pointer comprises a 32-bit offset > plus a 16-bit segment selector. These are stored in memory in a format which > is 64 bits in size (16 bits are wasted). > > I understand there are some C compilers which support 32-bit segmented mode > compilation (e.g. WATCOM), but GCC never has and probably never will. Janus/Ada supports that on DOS extenders (although System.Address is a 48-bit type, not 64 -- alignment might cause the other 16-bits be to wasted, but it is certainly not part of the type). It used to support that on Windows as well (by default, really), but it caused too much trouble with use of 'Address. DOS Extenders these days are mostly used in embedded systems (they're not really DOS extenders, but rather an very small embedded OS). For DOS Extenders, Janus/Ada separates the code and data segments, so that errant programs can't write the code segment or execute the data segment. That seems like a basic and trivial precaution to me; most of the security exploits couldn't have happened if Windows and Unix had done that. (Sure, there are occassional legitimate uses for excuting code written by the program; but that is an exceptional case, and should be treated that way.) > The distinction may seem pointless (sorry :-) to most people, but it matters > to me (because it will matter to AdaOS ;-) > > To clarify, when we are talking about near and far pointers, we are > specifically talking about the 32-bit Intel Architecture (IA-32). I'm not > aware of any other contemporary architecture supporting a superimposed > segmentation scheme. Right, which is probably why it hasn't been used in other systems. But virtually every system has a way to mark pages as read-only and no-execute, and it's silly that that wasn't used to protect programs and system. Randy.