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 12 of 21 Topic 4599 of 4774
Post > Topic >>

Re: Segment push in RM

by "Rod Pemberton" <spamtrap@[EMAIL PROTECTED] > Apr 3, 2008 at 09:23 PM

"Robert Redelmeier" <redelm@[EMAIL PROTECTED]
> wrote in message
news:_%bJj.18$Ce1.6@[EMAIL PROTECTED]
> Rod Pemberton <spamtrap@[EMAIL PROTECTED]
> wrote in part:
> > "Robert Redelmeier" <redelm@[EMAIL PROTECTED]
> wrote in message
> >> 'scuse me, but why are you _shocked_?
> >> DS doesn't _have_ 32 bits to push.
> >
> > Um..., it does push 32-bits for all three cpu's: ds plus
> > 16-bit zero for two and ds and lower 16-bits eflags for one.
> > Oh, sorry, my mistake.  I should've said "I'm _shocked_
> > ... it doesn't push 32-bit value equivalent to ds for... "
>
> You're complaining about the upper fill?

This issue comes up when mixing 16-bit and 32-bit code in the same
segment.
The numerical results, IMO, should be equivalent.  I.e, "Do no harm."

>From "db 0x66,"  my expectation is to see a "32-bit push".  By "32-bit
push"
I expect not just any combination of 32-bits on the stack that might
include
16-bits from DS, but a 32-bit value that accurately represents the pushed
16-bit value of DS.  I.e., zero filled for value preservation.

> Why is ZERO "more proper" than EFLAGS?
>

For "push imm8" - a 16-bit push of an 8-bit value in RM, "why is ZERO"
(via
sign extension) for the upper 8-bits "more proper" than AH, BH, CH, DH?
It's the same principle: value preservation.  Without it, a processor is
useless...

> Why is ZERO "more proper" than EFLAGS?
>

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.


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 Sun Sep 7 7:11:43 CDT 2008.