Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

-mregparm on gcc doesnt work correctly?
Hi,

I have some expermentals with -mregparm option of gcc. I compile my
code (16bit, if that matters) like this

gcc -mregparm=2 ...

So I expect that the first 2 param of a function is transferred in EAX
and EDX, and from the 3rd params onward the params are put in stack.
So for example calling "function(x,y,z,v)" should put "z" and "v" in
stack.

But by disassembling my gcc-generated code, I surprised to see that it
uses ECX for the 3rd param, and only from 4th param it uses stack. So
in the above example, only "v" is in stack, but not "z" as expected (z
is in ECX!!). How is that possible??

Is there any way to force gcc to use only use stack for the 3rd params
onward, as it seems "-mregparm=2" didnt do what they promised?

So !!

I am using gcc 4.1.2 on Linux Ubuntu 7.10

Thanks,
J


Report this thread to moderator Post Follow-up to this message
Old Post
junkoi
03-31-08 09:20 AM


Re: -mregparm on gcc doesnt work correctly?
junkoi wrote:
> Hi,
>
> I have some expermentals with -mregparm option of gcc. I compile my
> code (16bit, if that matters) like this
>
> gcc -mregparm=2 ...
>
> So I expect that the first 2 param of a function is transferred in EAX
> and EDX, and from the 3rd params onward the params are put in stack.
> So for example calling "function(x,y,z,v)" should put "z" and "v" in
> stack.
>
> But by disassembling my gcc-generated code, I surprised to see that it
> uses ECX for the 3rd param, and only from 4th param it uses stack. So
> in the above example, only "v" is in stack, but not "z" as expected (z
> is in ECX!!). How is that possible??
>

Probably because anything but -mregparm=0 and -mregparm=3 gets virtually
zero testing.

-hpa


Report this thread to moderator Post Follow-up to this message
Old Post
H. Peter Anvin
03-31-08 01:21 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

A86 Assembler archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 01:02 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.