x86 opcodes 0FB7 and 0FBF 16-bit?

Emulation of old PCs, PC hardware, or PC peripherals.

x86 opcodes 0FB7 and 0FBF 16-bit?

Postby superfury » 2019-4-08 @ 07:08

Do opcodes 0FB7 and 0FBF(MOVS/ZX) in 16-bit mode function like a normal MOV(without sign extension to 32-bit, since it's from a 16-bit memory/register location to 16-bit register)? Or do they always extend to a 32-bit register, regardless of operand size?

I already implemented it in both 16-bit(plain MOV in effect) and 32-bit fashion(Sign/Zero extending to 32-bit), but I'm just double checking here.
superfury
l33t
 
Posts: 3231
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: x86 opcodes 0FB7 and 0FBF 16-bit?

Postby Stenzek » 2019-4-08 @ 13:43

As far as I can tell, 0FB6 extends 8-bits to the operand size, 0FB7 is always 16->32-bit. As the second operand of 0FB7 is 16-bit, it wouldn't make sense to zero-extend 16-bits to 16-bits.

Edit: Seems my implementation (and bochs) differs. 0FB7 with a 16-bit operand size is essentially a 16->16 MOV without affecting the upper bits. I think this is one of the cases where the documentation is confusing :/
Stenzek
Newbie
 
Posts: 58
Joined: 2017-12-08 @ 08:30

Re: x86 opcodes 0FB7 and 0FBF 16-bit?

Postby peterferrie » 2019-4-10 @ 18:56

0FB6 is an 8-bit extension to the operand size. 0FB7 is a 16-bit extension to the operand size. Both can be extended from 16-bit to 32-bit via override (or truncated from 32-bit to 16-bit).
peterferrie
Oldbie
 
Posts: 638
Joined: 2008-5-08 @ 21:54


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 3 guests