All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Marmond <fmarmond@eprocess.fr>
To: Vadiraj C S <vadiraj@mail.cyberneme.com>, linux-assembly@vger.kernel.org
Subject: Re: stack contents at function call
Date: Fri, 05 Mar 2004 10:00:09 +0100	[thread overview]
Message-ID: <40484199.5040401@eprocess.fr> (raw)
In-Reply-To: <20040305135011.3ac14610.vadiraj@mail.cyberneme.com>

Vadiraj C S wrote:

>  the displace which is given above is specific to gcc and in windows it would 
>be something else, I dint get time to research on this much but the difference is
>that, I had to change it 24, 28 and 32 to make it work on icc. 
>
> And yes this asm code is call from an insline asm itself the sequence of code before 
>the call is this
>
>  asm volatile ("push %ebx") //which is the last parameter to Func_call
>  asm volatile ("push %edx") // which is the middle one b
>  asm volatile ("push %esi") // which is the address of a
>  asm volatile ("call Func_call") ;
>
>
> I'm sorry for the delay in response, I would appreciate if you can put some information
>on this at your free time..
>
>
>  
>
Hum, if you send your code parts to parts, it is a bit difficult to see 
what you are doing...
If I understand the (very few) parts you gave, the 4 bytes added by gcc 
to stack are the 'Func_call'.
You can check it be compiling with -save-temps and see the assembly 
generated code.

If you really want me to confirm, please, create a simple hello-world 
that reproduce this behaviour, compil it with -save-temps option, and 
send me both the .c and the .s files.
Then, I think I would have enough data to tell you exactly what appens 
(and how change it if you want the same code to work the same in windows 
and linux)

Fred
(PS: and please, keep reply to the community, as your problem and its 
solution may be usefull for somebody in the futur. Thanks)




Vadiraj C S wrote:

> Mr Fred,
>
>
>  
>
>>Hi,
>>Did you find the problem?
>>I would appreciate feed-backs, as I don't see what may differ from intel 
>>and gcc...
>>    
>>
>
>   Yes there is difference in the displacement from the ebp at call values 
>in gcc and intel.
>
>
>  
>
>>If you find the explanation, it would be nice to share it!
>>And if you didn't find, just send me the generated assembly (see at the 
>>end of my last reply) I may be in some help...
>>
>>    
>>
>
>
>void Func_call(unsigned long *a, unsigned shor int b, unsigned short 
>  
>
>>>>int c)
>>>>{
>>>>
>>>>       asm volatile ("pushl %esi");
>>>>       asm volatile ("pushl %edi");
>>>>       asm volatile ("pushl %ebp");
>>>>       asm volatile ("pushl %ebx");
>>>>
>>>>This below code works different in gcc and in icc
>>>>   {
>>>>       asm volatile ("movl 28(%esp),%esi");  
>>>>       asm volatile ("movw 32(%esp),%dx");
>>>>
>>>>       asm volatile ("movl 36(%esp),%ebx");
>>>>
>>>>   }
>>>>
>>>>        
>>>>
>
>
>  the displace which is given above is specific to gcc and in windows it would 
>be something else, I dint get time to research on this much but the difference is
>that, I had to change it 24, 28 and 32 to make it work on icc. 
>
> And yes this asm code is call from an insline asm itself the sequence of code before 
>the call is this
>
>  asm volatile ("push %ebx") //which is the last parameter to Func_call
>  asm volatile ("push %edx") // which is the middle one b
>  asm volatile ("push %esi") // which is the address of a
>  asm volatile ("call Func_call") ;
>
>
> I'm sorry for the delay in response, I would appreciate if you can put some information
>on this at your free time..
>
>
>  
>



  parent reply	other threads:[~2004-03-05  9:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-01  7:48 stack contents at function call Vadiraj C S
2004-03-01  8:36 ` Frederic Marmond
2004-03-01  8:42   ` Vadiraj C S
2004-03-01  9:42     ` Frederic Marmond
2004-03-05  7:26       ` Frederic Marmond
     [not found]         ` <20040305135011.3ac14610.vadiraj@mail.cyberneme.com>
2004-03-05  9:00           ` Frederic Marmond [this message]
2004-03-01  9:40 ` peter willy krause

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40484199.5040401@eprocess.fr \
    --to=fmarmond@eprocess.fr \
    --cc=linux-assembly@vger.kernel.org \
    --cc=vadiraj@mail.cyberneme.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.