Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [cooler@coolerlab asm]$ gcc -o test test.c -masm=intel
- /tmp/ccpTHIx9.s: Assembler messages:
- /tmp/ccpTHIx9.s:60: Error: junk `PTR [ebp+8]' after expression
- /tmp/ccpTHIx9.s:60: Error: too many memory references for `mov'
- /tmp/ccpTHIx9.s:61: Error: too many memory references for `mov'
- [cooler@coolerlab asm]$ cat test.c
- #include <stdio.h>
- int Add(int x, int y);
- int main()
- {
- printf("%d \n", add(2,3));
- return 0;
- }
- int Add(int x, int y)
- {
- __asm__(
- ".intel_syntax noprefix\n"
- "mov eax,%1\n"
- "mov ebx,%2\n"
- "add eax,ebx\n"
- "mov %0,eax\n"
- ".att_syntax\n"
- : "=r"(x) : "a"(x), "b"(y)
- );
- return x;
- }
- [cooler@coolerlab asm]$
Advertisement
Add Comment
Please, Sign In to add comment