delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/12/20:36:58

Message-ID: <F554E1189472D21198D000805F654BFE05FA8B@ntxchangerend.engr.rendition.com>
From: yjtseng <yjtseng AT micron DOT com>
To: djgpp AT delorie DOT com, nate AT cartsys DOT com
Cc: yjtseng AT micron DOT com
Subject: RE: Help needed in getting CR0 under DOS
Date: Mon, 12 Apr 1999 18:36:23 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Reply-To: djgpp AT delorie DOT com

Nate,

You are right. I don't think the content of the direct quote which I copied
directly from the intel web site is correct. I did try with cwsdpr0.exe
which runs at ring 0 and it worked. Thanks.


Jay

	-----Original Message-----
	From:	Nate Eldredge [SMTP:nate AT cartsys DOT com]
	Sent:	April 09, 1999 9:30 PM
	To:	djgpp AT delorie DOT com
	Subject:	Re: Help needed in getting CR0 under DOS

	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