开发者

Port below x86 program to mips32

Below sample code for X86 arch,

#  define INC(_lval,_lqual) \
      __asm__ __volatile__ ( \
      "lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_l开发者_运维技巧val)) : "memory", "cc" )

Please somebody help me equivalent MIPS32 arch.


That looks like gcc inline assembly for an atomic increment. This is the gcc intrinsic for an atomic increment:

__sync_fetch_and_add(&_lval, 1);

Works on x86, mips32, etc.


I found a code that might be useful for you here. It seems in fact to indicate that the builtin for gcc is not implemented for that architecture.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜