HP3000-L Archives

September 1997, Week 1

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:
Sat, 6 Sep 1997 18:44:46 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (41 lines)
Gavin notes:

> Mark after Stan after Mark:
> >>    GETPRIVMODE ();   /* unless caller was already in priv mode */
> >>
> >>>   return get_control_reg(10) & 0xff;
> >
> >Stan is, of course, correct about the need for GETPRIVMODE () if these
> >routines don't exist already exist in a privileged XL.
>
> Control registers (other than SAR, CR26, CR27, and the Interval Timer if
> the S bit in the PWS is off) can only be read at the "most privileged level",
> i.e. ring zero, so the GETPRIVMODE() call here isn't going to do you any
> good, as get_control_reg is not a not a function but a compiler construct
> that expands inline to an MFCTL instruction which will trap due to the
> code not executing at a sufficient privilege level (GETPRIVMODE() promotes
> a process from ring 3 to ring 2).
>
> Nyeah. :-)

As it turns out, Gavin's partially correct.  Pascal/iX has a pre-defined
function called "get_control_reg", which does indeed need to be called
from ring 0.

But...in my example, I recall saying:

   Function get_control_reg (crnum : integer) : integer;
      external;

That overrides the pre-defined function, and triggers a call to an
MPE/iX internal routine ... one which requires ring 2 (or 0 or 1) to
call.

:debug
= vainfo (get_control_reg, "access_rights_fmt")
Code             pl1 = 2  pl2 = 0

:)

Stan (I tested it!) Sieler

ATOM RSS1 RSS2