Hi everybody,

I want to call this function:

Code:

int x86asm_add(int a,int b)
{asm(
"addl %%ebx,%%eax"
:"=a"(a)
:"a"(a),"b"(b)
);
}

in here:

Code:

int x86asm_add_call(int a,int b)
{
   asm("x86asm_add %1,%2,%0" : "=r"(a):"r"(a),"r"(b)
   );
}


But i taken this error:


Code:

 `x86asm_add %eax,%edx,%eax'

I looked and made like in here: http://webcache.googleusercontent.com/search?q=cache:AVYvydO-m1oJ:www.cs.dartmouth.edu/~sergey/cs108/2009/gcc-inline-asm.pdf+&cd=13&hl=tr&ct=clnk&gl=tr

Part: 4.1 Extended asm, an introduction.


How can i call this function?I am using dev-c++.And i want to learn this in gcc-inline-asm.Thank you for your helps Wink

Code:
int x86asm_add(int a,int b) {
    asm("addl %%ebx,%%eax"
        : "=a"(a)
        : "a"(a),"b"(b)
    );
    return a;
}

int call_native(int a, int b) {
    x86asm_add(a, b);
}

// There's no reason to ever do this, but it's technically possible.
// I've optimized it down to a tail call.
int call_extern(int a, int b) {
    asm("jmp _x86asm_add");
}
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement