"Robert Redelmeier" <redelm@[EMAIL PROTECTED]
> wrote in message
news:53wJj.167$vF.48@[EMAIL PROTECTED]
> Rod Pemberton <spamtrap@[EMAIL PROTECTED]
> wrote in part:
> > Tell me where you see EFLAGS in the pseudo code for "push ds"
> > (line is "TEMP = SRC"):
>
> > ELSE IF StackAddrSize = 32
> > THEN
> > IF OperandSize = 32
> > THEN
> > ESP <- (ESP - 4);
> > IF (SRC is FS or GS)
> > THEN
> > TEMP = ZeroExtend32(SRC);
> > ELSE IF (SRC is IMMEDIATE)
> > TEMP = SignExtend32(SRC); FI;
> > ELSE
> > TEMP = SRC;
> > FI;
> > SS:ESP <- TEMP; (* Push doubleword *)
> > ELSE (* OperandSize = 16*)
> > ESP <- (ESP - 2);
> > SS:ESP <- SRC; (* Push word *)
> > FI;
> >
> > From the pseudo code, although the 16-bit SRC in "TEMP =
> > SRC" isn't zero or sign extended, one could claim that TEMP
> > should _only_ contain a value of DS from the assignment,
> > "="... and not contain additional garbage, such as EFLAGS.
>
> ZEROs are just as much garbage as EFLAGS! ... maybe "cleaner"
> garbage :) but still, undefined is undefined.
>
> Please note the line IF (SCR is FS or GS)
> very specifically excludes DS, so by implication, it is neither
> zero extended nor sign extended. Any old trash can be left there.
>
Please note the line "ELSE IF StackAddrSize = 32" Sorry, it appears I
posted the wrong section of pseudo code...
> I expect undefined behaviour, and I'm glad to give the CPU designer
> some latitude to do whatever works best for the microcode rather
> than overconstraining them with seldom-used specs.
>
You shouldn't expect that. This is the correct section:
ELSE StackAddrSize = 16
IF OperandSize = 16
THEN
SP <- (SP . 2);
SS:SP <- SRC; (* Push word *)
ELSE (* OperandSize = 32 *)
SP <- (SP . 4);
SS:SP <- SRC; (* Push doubleword *)
For stacksize 16 and operand size 32, as in RM "db 0x66, push ds", it's
supposed to push a doubleword. Since I double checked at the behest of
"Cranky" and found out the P2 is only pu****ng 16-bits (I'm really
shocked!!)
not 32-bits as I previously found, the P2 has a bug. It should push
32-bits
as the other two cpu's do (zeroed as they do, IMO...). The P2 appears to
be
ignoring the db 0x66 prefix.
Sorry, I really didn't mean to post bad info, but you could of cross
checked... ;-)
Rod Pemberton


|