Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: Segment pus...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 15 of 21 Topic 4599 of 4860
Post > Topic >>

Re: Segment push in RM

by "Rod Pemberton" <spamtrap@[EMAIL PROTECTED] > Apr 5, 2008 at 07:53 AM

"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
 




 21 Posts in Topic:
Segment push in RM
Cranky <spamtrap@[EMA  2008-04-01 00:39:33 
Re: Segment push in RM
Frank Kotler <spamtra  2008-04-01 10:13:49 
Re: Segment push in RM
"Wolfgang Kern"  2008-04-01 14:53:19 
Re: Segment push in RM
"Rod Pemberton"  2008-04-01 06:30:27 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-01 05:52:51 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-01 07:23:22 
Re: Segment push in RM
Frank Kotler <spamtra  2008-04-01 22:04:44 
Re: Segment push in RM
"Rod Pemberton"  2008-04-02 04:05:32 
Re: Segment push in RM
Robert Redelmeier <red  2008-04-02 18:05:57 
Re: Segment push in RM
"Rod Pemberton"  2008-04-02 20:26:45 
Re: Segment push in RM
Robert Redelmeier <red  2008-04-03 21:30:34 
Re: Segment push in RM
"Rod Pemberton"  2008-04-03 21:23:12 
Re: Segment push in RM
"Wolfgang Kern"  2008-04-04 17:40:22 
Re: Segment push in RM
Robert Redelmeier <red  2008-04-04 20:19:13 
Re: Segment push in RM
"Rod Pemberton"  2008-04-05 07:53:21 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-01 23:59:11 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-02 21:03:26 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-02 20:28:18 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-03 23:33:40 
Re: Segment push in RM
"Rod Pemberton"  2008-04-05 07:30:07 
Re: Segment push in RM
Cranky <spamtrap@[EMA  2008-04-06 11:42:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 22:58:52 CST 2008.