🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #6979

Re: Segment Registers -- 8086/80286

#6979
From: John R. Levine
Date: Wed, 25 Jun 1986 03:36
28 lines
2301 bytes
In article <1851@gitpyr.UUCP> kpk@gitpyr.UUCP (Kevin P. Kleinfelter) writes:
>In article <494@ubvax.UUCP>, skip@ubvax.UUCP writes:
>> ... and if you ever plan on writing programs for the i80286, don't
>> "normalize" pointers.
> ...
>So how will one compare pointers?  If you can't normalize them, two pointers
>could reference the same address, but not contain the same values. ...

Not likely.  The 286 is a genuine segmented architecture (as opposed to the
8086 which is an unsatisfactory approximation.)  The operating system
controls where each segment is mapped.  Unless you have a strange
operating system, you can assume that the contents of different segments are
disjoint, so that if two pointers point into different segments, they're not
pointing at the same thing.

Just so you shouldn't think the 286 is a reasonable chip, though, you have
to take into account that the lowest two bits of the segment address are
not part of the segment number but rather tell what protection level the
segment is allegedly addressed at.  You really should mask off those bits
before comparing pointers, although in user programs, their value is
unimportant since the user can only reference user mode data, so a sensible
program will always make them zero.  I'm sure lots of great bugs will show
up, though.
-- 
John R. Levine, Javelin Software Corp., Cambridge MA +1 617 494 1400
{ ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine@YALE.EDU
The opinions expressed herein are solely those of a 12-year-old hacker
who has broken into my account and not those of any person or organization.
Technical Details
Message-ID: <140@ima.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!ima!johnl
References: <165@sci.UUCP> <146@apr.UUCP> <494@ubvax.UUCP> <1851@gitpyr.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!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!ima!johnl
From: johnl@ima.UUCP (John R. Levine)
Newsgroups: net.micro.pc
Subject: Re: Segment Registers -- 8086/80286
Message-ID: <140@ima.UUCP>
Date: Tue, 24-Jun-86 23:36:11 EDT
Article-I.D.: ima.140
Posted: Tue Jun 24 23:36:11 1986
Date-Received: Fri, 27-Jun-86 06:46:07 EDT
References: <165@sci.UUCP> <146@apr.UUCP> <494@ubvax.UUCP> <1851@gitpyr.UUCP>
Reply-To: johnl@ima.UUCP (John R. Levine)
Organization: Javelin Software Corporation
Lines: 28
Keywords: 286 segment registers
Summary: you compare segmented addresses by comparing them