diff -r 1fb6cf5a4c4d -r ab487d32ce9a targets/plc_debug.c --- a/targets/plc_debug.c Mon Mar 04 12:22:49 2013 +0900 +++ b/targets/plc_debug.c Mon Mar 04 17:49:12 2013 +0900 @@ -184,6 +184,7 @@ extern int TryEnterDebugSection(void); extern long AtomicCompareExchange(long*, long, long); +extern long long AtomicCompareExchange64(long long* , long long , long long); extern void LeaveDebugSection(void); extern void ValidateRetainBuffer(void); extern void InValidateRetainBuffer(void); @@ -376,7 +377,10 @@ tail.msgidx = (old_cursor >> 32); new_cursor = ((uint64_t)(tail.msgidx + 1)<<32) | (uint64_t)((buffpos + size + sizeof(mTail)) & LOG_BUFFER_MASK); - }while(!__sync_bool_compare_and_swap(&LogCursor[level],old_cursor,new_cursor)); + }while(AtomicCompareExchange64( + (long long*)&LogCursor[level], + (long long)old_cursor, + (long long)new_cursor)!=old_cursor); copy_to_log(level, buffpos, buf, size); copy_to_log(level, (buffpos + size) & LOG_BUFFER_MASK, &tail, sizeof(mTail));