"jacob navia" <ja***@jacob.remcomp.fr> writes:
Push the arguments in the stack
int a = myasm_routine(arg1,arg2,arg3);
Supposing word size args (32 bits) the asm
routine will find the args at esp+4,esp+8,esp+12,etc
That's all.
How is the ASM routine reading its input?
Does it expect it in some special places like
registers or like?
If yes, add an interface asm code like this:
; routine expects args in eax,edx
; put arg1 in eax
movl 4(%esp),%eax
; put arg2 in edx
movl 8(%esp),%edx
call original_asm_routine
ret
Use the -S option of your compiler and look
at the generated assembler.
I suppose the OP is probably using an x86 system, but I can't be
certain; it may be obvious from the context, but not to me.
I have no idea whether Jacob's response is correct, because he's
really talking about assembly language, not about C.
Which is why both the question and the answer really belong in a
system-specific newsgroup, where it can be discussed intelligently,
rather than here in comp.lang.c, where it's off-topic.
I can understand the OP making that mistake; it happens all the time,
and the usual (and proper) response is to suggest a better place to
get help.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.