HP3000-L Archives

July 1999, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Fri, 9 Jul 1999 09:51:06 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
Dennis writes:

> Stan Sieler ([log in to unmask]) wrote:
> : R26 is 0 (NIL)
> : >  RCTR=00000000 ISR=00000208 IOR=0000000c IIR=0f581059 IVA=00d67000
> : The IIR (Interrupt Instruction Register) has the opcode for
> :    LDHS     12(0,26),25
>
> : So, the code is trying to load at address 12 bytes in from NIL, which
> : generally isn't desirable.
>
> Unless you are running at ring 0, you can't dereference the first page.
> (Unless this has changed in 5 years.)

Actually, ring 2 is sufficient to read $a.0 (which is what NIL usually
"translates" into) ... has been as long as I recall.

So...that's why I said "generally isn't desirable" ... because:

   1) sometimes you trap (if you're in ring 3);

   2) sometimes you get misleading data (you really don't want the
      "contents" of NIL or NIL + 12);

   3) sometimes you get a little farther and then trap trying to store
      back into the bad address.

But you generally (but *not* always) will trap somewhere along the line.

> : because you'd generally see the error *storing* relative to NIL, not loading
> : from it.
> : Stan Sieler                                          [log in to unmask]
>
> This is the default on HP-UX, linking without -z.

Just as clarification, the HP-UX default (i.e., compiling in C and
linking without specifying "-z") is that you *can* dereference NIL (0)
if you're loading.  Here's a sloppy example from HP-UX 10.20:

   (oz#sieler) /users/sieler: cc test.c -o test
   (oz#sieler) /users/sieler: ./test
   *badptr = 0

   (oz#sieler) /users/sieler: cc test.c -z -o test
   (oz#sieler) /users/sieler: ./test
   Memory fault

   (oz#sieler) /users/sieler: cat test.c
   main ()
   {

   int
      *badptr  = 0;


   (void) printf ("*badptr = %d\n", *badptr);
   }

--
Stan Sieler                                          [log in to unmask]
                                         http://www.allegro.com/sieler/

ATOM RSS1 RSS2