This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I want to call assembler routines from from C/C++ but am very confused at
the variation in calling conventions and how I can
force the complier to put arguments on the stack and not use registers, or a
combination, or do something else that isn't
deterministic that will screw up the assembler code.
I have tried using -mregparm=0 on the command line but that seems to screwAs you would expect.
up calls to the standard library.
I have tried using unsigned char myfunction(unsigned char buf),I don't know. I'd like to understand such features, so if some expert explains that, I'll learn something too.
__attribute__ ((regparm(0))) after the function prototype
An examination of the assembler produced always shows it passes the buffer?? %edi not %rdi ??
pointer in %edi and not on the stack.
Also, I am confused over whether the IP pushed is 32 or 64 bit in size.If you are compiling for x86-64 then a call would push the 64 bit rip. If you are compiling for i386 through i686 etc. the 32 eip would be pushed.
Both the above statements tell me you intend to be compiling 64 bit code. But I don't know for sure that you are compiling 64 bit code.I have read that the memory model used on linux limits code and global data to 2GB each but dynamically allocated data can be as large as you like, so code can be made more compact.
What I would really like is some pointers to good documentation about all this if it exists.
I use the Latest Ubuntu 64bit Linux and latest C++ compilers.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |