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 19 of 21 Topic 4599 of 4821
Post > Topic >>

Re: Segment push in RM

by Cranky <spamtrap@[EMAIL PROTECTED] > Apr 3, 2008 at 11:33 PM

On Apr 4, 8:23 am, "Rod Pemberton"  <spamt...@[EMAIL PROTECTED]
> wrote:
>
> 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;

Hi Rod,
    where did you get the above from, can't see it in my Intel pdf's.
Is it an update for later models? Maybe that's why I don't see zero
extension for P4/P3.

I think the reason your seeing EFLAGS (P2) is due to the segment
register being pushed as..

 ELSE StackAddrSize = 16
  ...
 ELSE (* OperandSize = 32 *)
  ...
 IF (SRC is CS or DS or ES or SS of FS or GS)
  SP <- (SP - 4);
  SS:SP <- SRC; (* Push word *) <--not dword for segment reg's
 FI;

or something like that..

To test I pushed and popped a known 32 bit value first to put a known
on the stack..

push 66666666h
pop edx
db 66h
push gs
push 55555555h
pop edx
db 66h
push fs
.....

then popped eax and printed it's value 6 times (once for each segment
push) then I would get

1111xCSx
2222xDSx
.....
6666xGSx

If you try to use a debugger to see this then you need to run to a
breakpoint, not step, a least with GRDB...

0100 MOV     EDX,88888888 ;upto you
0106 PUSH    EDX
0108 POP     ECX          ;SP-4 still has 88888888
010A PUSH    DS           ;SP <- (SP - 4), SS:SP <- DS (16bits)
010C POP     EAX          ;EAX=8888xDSx
010E INT     03           ;Break

run with ->G

Hope this helps.

-- Cranky
 




 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 Mon Oct 6 16:44:14 CDT 2008.