开发者

Port below x86 program to mips32

开发者 https://www.devze.com 2023-01-25 17:26 出处:网络
Below sample code for X86 arch, #define INC(_lval,_lqual) \\ __asm__ __volatile__ ( \\ \"lock ; incl (%0)\" : /*out*/ : /*in*/\"r\"(&(_l开发者_运维技巧val)) : \"memory\", \"cc\" )

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

精彩评论

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