OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 1:02 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Operand-size and address-size override prefix
PostPosted: Thu Feb 06, 2014 9:04 am 
Offline
Member
Member

Joined: Thu Sep 20, 2012 5:11 am
Posts: 69
Location: germany hamburg
Hello,
in the Wiki-table for the "Operand-size and address-size override prefix" we can find that the "0x66 operand prefix" and the "0x67 address prefix" is N/A (not aviable) for the real mode and the virtual 8086 mode. http://wiki.osdev.org/X86-64_Instruction_Encoding

But now i am wondering how somebody is switching from the 16 bit RM to the PM on a 80386+ and doing an access of the 32 bit controllregister cr0, but without to use an operandsize prefix before we are switching to the PM with a far jump? :shock:
Example: 66 0F 22 C0 mov cr0,eax

Has nobody tested it before on a 80386+ in the realmode to reverse the default operand-size and address-size, i can not believe.

Hint: Inside of the Intel manual we can find this statement: "These prefixes can be used in real-address mode as well as in protected mode and virtual-8086 mode". And inside the AMD manual we can find this statement: "An address-size override can be used in real-address mode to enable 32-bit addressing; however, the maximum allowable 32-bit linear address is still 000FFFFFH."

Dirk


Top
 Profile  
 
 Post subject: Re: Operand-size and address-size override prefix
PostPosted: Thu Feb 06, 2014 9:51 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 01, 2010 3:41 am
Posts: 1761
Location: Hong Kong
MOV to control register has dedicated opcode, it always work with r32 in real mode and does not require prefix.
In 64-bit long mode you may prefix it with REX.R and move to/from 64-bit register.

Intel manual wrote:
The operand size for these instructions is always 32 bits in non-64-bit modes, regardless of the operand-size attribute


Top
 Profile  
 
 Post subject: Re: Operand-size and address-size override prefix
PostPosted: Thu Feb 06, 2014 11:15 am 
Offline
Member
Member

Joined: Thu Sep 20, 2012 5:11 am
Posts: 69
Location: germany hamburg
bluemoon wrote:
MOV to control register has dedicated opcode, it always work with r32 in real mode and does not require prefix.
In 64-bit long mode you may prefix it with REX.R and move to/from 64-bit register.

Intel manual wrote:
The operand size for these instructions is always 32 bits in non-64-bit modes, regardless of the operand-size attribute

Aha, thank you. I try it later to place a nop-byte instead.

But for other instructions on a 80386+ within the 16 bit real mode the instruction prefixes for to reverse the default operand- and address- size are aviable and will not be ignored.

Dirk


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group