www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/26/15:55:08

Date: Wed, 26 Nov 1997 12:52:59 -0800 (PST)
Message-Id: <199711262052.MAA16539@adit.ap.net>
Mime-Version: 1.0
To: "Tan Pinghui" <tanph AT bj DOT col DOT com DOT cn>, <djgpp AT delorie DOT com>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: `.addrsize' and `.opsize' (was: (no subject))

At 04:52  11/25/1997 +0800, Tan Pinghui wrote:
>Hello, all,
>
>I find the following asm listings in stub.asm:
>	...
>	.addrsize
>	rep
>	stosd
>	...
>	.opsize
>	jmpf fs:[start_eip]
>	...
>
>Could anyone tell me the meaning of ".addrsize" and ".opsize"?
They are DJASM's way of expressing the 386's confusing opcode prefix scheme.
For backward compatibility with the 8086, instructions have 16-bit and
32-bit forms. But their opcodes are identical. So in a 32-bit segment the
32-bit forms are used by default, and in 16-bit segments the 16-bit forms
are used by default. The prefix bytes are used to get the non-default form
(i.e. a `mov ax,bx' in a 32-bit segment). `.addrsize' stands for the address
size prefix byte, 0x67 if I recall correctly. This tells it to interpret the
address as either a 32- or 16-bit value. For instance, it determines whether
`di' or `edi' is used as the index register for a string instruction.
`.opsize' is 0x66, the data size prefix byte. It determines the size of the
operands, distinguishing between `mov ax,bx' and `mov eax,ebx'. In your
example, I think it is being used to jump to a 32-bit address from a 16-bit
segment.
HTH

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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