cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/10/00:29:55

Sender: nate AT cartsys DOT com
Message-ID: <370ED3B7.63FE8F3B@cartsys.com>
Date: Fri, 09 Apr 1999 21:29:43 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.5 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Help needed in getting CR0 under DOS
References: <F554E1189472D21198D000805F654BFE05FA67 AT ntxchangerend DOT engr DOT rendition DOT com>
Reply-To: djgpp AT delorie DOT com

yjtseng wrote:
> 
> Thanks  for the reply.
> 
> I don't think it is a privileged instruction based on the following quote
> from the Intel Architecture Software Developer's Manual page 2-13:
> 
>                 In protected mode, the move-to-or-from-control-registers
> forms of the MOV instruction allow
>                 the control registers to be read (at any privilege level) or
> loaded (at privilege level 0 only). This
>                 restriction means that application programs (running at
> privilege levels 1, 2, or 3) are prevented
>                 from loading the control registers; however, application
> programs can read these registers.

Interesting.  The 80386 Programmer's Reference Manual (published by
Intel) on page 17-111 describes MOV to/from special registers (CRx, DRx,
TRx), and it says:

Protected Mode Exceptions: #GP(0) [general protection fault --NE] if the
current privilege level is not 0

...

Notes: The instructions must be executed at privilege level 0 or in
real-address mode; otherwise, a protection exception will be raised.

[end of quote]

The SMSW instruction, which exists for 286 compatibility, stores the low
16 bits of CR0 in its operand, and can be executed regardless of
privilege.  But that may omit some of the bits you want.


-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019