Your code is broken. See info gcc on Constraints:
`g'
Any register, memory or immediate integer operand is allowed,
except for registers that are not general registers.
so you cannot use constraint g because it includes immediate and you cannot
obviously change immediate.
Also, even if you used "rm" instead, your code has no outputs, so it
illegally clobbers the i value without telling gcc about it.
I'd propose something like:
int i = 1 ;
__asm__ volatile ( "
movl %1, %%eax\n
addl $1, %%eax\n
movl %%eax, %0\n"
: "=rm"(i) :"g"(i) : "eax"
) ;
(that could turn into movl $1,%eax; addl $1,%eax; movl $eax,somereg)
or if you want to make sure i are kept in the same register/memory, then
int i = 1 ;
__asm__ volatile ( "
movl %0, %%eax\n
addl $1, %%eax\n
movl %%eax, %0\n"
: "=rm"(i) :"0"(i) : "eax"
) ;
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/