🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9731

Re: pointer format nit

#9731
From: Wayne Throop
Date: Tue, 04 Nov 1986 16:26
44 lines
2708 bytes
> chris@umcp-cs.UUCP (Chris Torek)
>> desj@brahms (David desJardins)
>>... the point is that casts of pointers *don't* convert.
> Yes they do, and Wayne Throop has to know it:  His machine does
> indeed convert.  `char *' is 48 bits; `int *' is 32 bits.  DG
> machines use word pointers, except when dealing with bytes.

Chris is right in the grand sweep (as usual) but has made a little
mistake with the details (not very usual at all).

DG MV machines indeed have differing formats for (char *) and (int *)
pointers, but both are 32 bits.  It's somebody else that has the 48-bit
character pointers (can't call to mind who that is just now).  In fact,
there are three architecturally supported pointer types in the DG MV
world, word (16-bit-granular) pointers, byte (8-bit-granular) pointers,
and bit (1-bit-granular) pointers.  These pointers indicate locations in
a 4-gigabyte address space of eight rings.  The rings are the MV memory
protection method, as well as the method of regulating OS privileges.
The first two pointer formats fit into 32 bits, and are the only formats
that are used as pointer types in C.  The third type of pointer requires
64 bits (more than strictly necessary).

For those not already bored, the three formats are like so:

               1         2         3              1         2         3
      12345678901234567890123456789012   12345678901234567890123456789012

word  IRRRWWWWWWWWWWWWWWWWWWWWWWWWWWWW
byte  RRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
bit   IRRRWWWWWWWWWWWWWWWWWWWWWWWWWWWW   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

'I' is the indirect bit, 'RRR' is the ring number, 'WWW...' is offset in
words, 'BBB...' is offset in bytes, 'XXX...' is offset in bits.
(Obviously, a lot of redundant offset in that bit pointer.  Basically,
it forms a word address first, and then a bit offset from there.)

Clearly, pointer casting on an MV machine *NEEDS* to be a conversion,
not a taken-as.  And other word-addressed machines have similar
requirements.

--
"Don't try this at home, kids..."
-- 
Wayne Throop      <the-known-world>!mcnc!rti-sel!dg_rtp!throopw
Technical Details
Message-ID: <675@dg_rtp.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!clyde!cbatt!ihnp4!ethos!rti-sel!dg_rtp!throopw
References: <4617@brl-smoke.ARPA> <657@dg_rtp.UUCP> <55@cartan.Berkeley.EDU> <4038@umcp-cs.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!mnetor!seismo!rutgers!clyde!cbatt!ihnp4!ethos!rti-sel!dg_rtp!throopw
From: throopw@dg_rtp.UUCP (Wayne Throop)
Newsgroups: net.lang.c
Subject: Re: pointer format nit
Message-ID: <675@dg_rtp.UUCP>
Date: Tue, 4-Nov-86 11:26:20 EST
Article-I.D.: dg_rtp.675
Posted: Tue Nov  4 11:26:20 1986
Date-Received: Thu, 6-Nov-86 01:02:58 EST
References: <4617@brl-smoke.ARPA> <657@dg_rtp.UUCP> <55@cartan.Berkeley.EDU> <4038@umcp-cs.UUCP>
Lines: 44
Summary: Yet Another Nit (gad, it's getting to be a habit...)