[comp.sys.intel] 386 instruction encoding query

kadorken@watmath.UUCP (02/11/87)

	The 386 programmers reference manual has for the full encoding of
the "jo" instruction the following bit pattern: 
0x0F 0x80 <full displacement>.  The bit encoding for pushing
a segment register (long form; 3-bit segment register name) is:
0x0F  10 seg3 000   where seg3 is one of {es, cs, ss, ds, fs or gs}.


	Thus the two byte opcode 0x0F 0x80 could be interpreted as
being either a "jo" instruction or the long form instruction "push es".
(the 3-bit encoding for es is 000).  Executing this instruction results
in a jump, not a push.  However, other encodings (using the other 3 bit
segment register names) do result in a value being pushed on the stack.

	Is the above behaviour just a fluke on our processor or will all
future '386 processors behave this way?

toma@tekgvs.UUCP (02/13/87)

In article <4979@watmath.UUCP> kadorken@watmath.UUCP (Keith A. Dorken) writes:
<
<	The 386 programmers reference manual has for the full encoding of
<the "jo" instruction the following bit pattern: 
<0x0F 0x80 <full displacement>.  The bit encoding for pushing
<a segment register (long form; 3-bit segment register name) is:
<0x0F  10 seg3 000   where seg3 is one of {es, cs, ss, ds, fs or gs}.
<
<
<	Thus the two byte opcode 0x0F 0x80 could be interpreted as
<being either a "jo" instruction or the long form instruction "push es".
<(the 3-bit encoding for es is 000).  Executing this instruction results
<in a jump, not a push.  However, other encodings (using the other 3 bit
<segment register names) do result in a value being pushed on the stack.
<
<	Is the above behaviour just a fluke on our processor or will all
<future '386 processors behave this way?

Well, my copy of the 386 Programmers's Reference Manual does not explicitly
indicate the bit field packing.  The PUSH (or POP) GS and FS instructions are
two bytes long, while those for the 8086 compatible segment registers are
single byte long.  The first byte is an excape sequence to get to the added
instructions push/pop instructions.

There is no reason to assume that the encoding of the instructions are going
to be done with some regularity!

Tom Almy
tektronix!tekgvs!toma

bverreau@mipos3.UUCP (02/14/87)

In article <4979@watmath.UUCP>, kadorken@watmath.UUCP (Keith A. Dorken) writes:
 
> 	The 386 programmers reference manual has for the full encoding of
> the "jo" instruction the following bit pattern: 
> 0x0F 0x80 <full displacement>.  The bit encoding for pushing
> a segment register (long form; 3-bit segment register name) is:
> 0x0F  10 seg3 000   where seg3 is one of {es, cs, ss, ds, fs or gs}.
> 
> 	Thus the two byte opcode 0x0F 0x80 could be interpreted as
> being either a "jo" instruction or the long form instruction "push es".
> (the 3-bit encoding for es is 000).  Executing this instruction results
> in a jump, not a push.  However, other encodings (using the other 3 bit
> segment register names) do result in a value being pushed on the stack.
> 
This is a documentation error in the reference manual.  The longer encoding
for the PUSH segment register instruction (as well as POP) is intended for
use solely with the FS and GS segment registers.  You should use the one
byte form of the instruction for PUSH ES, CS, SS, or DS.