Use atomic_set() instead of hard-coded x86 inline asm.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15488 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-12-11 13:44:40 +00:00
parent c6745ed536
commit d0769921ab

View File

@ -55,6 +55,7 @@
#include "dl_list.h"
#include <KernelExport.h>
#include <SupportDefs.h>
#include <stdio.h>
#include <string.h>
@ -111,21 +112,6 @@ int fast_log_buffer_size = /*512*/ 16*1024;
device_manager_info *pnp;
static int32
atomic_exchange(vint32 *value, int32 newValue)
{
int32 oldValue;
__asm__ __volatile__ (
"xchg %0,%1"
: "=r" (oldValue), "=m" (*value)
: "0" (newValue), "1" (*value)
);
return oldValue;
}
/** convert event code to text
* text_buffer - buffer used if text must is composed manually
* (must be at least 24 characters long)
@ -214,7 +200,7 @@ fast_log_flush_buffer(void)
memset(fast_log_buffer + new_start, 0, fast_log_buffer_size);
// swap buffers
size = atomic_exchange(&fast_log_buffer_offset_alloc, new_offset_alloc);
size = atomic_set((vint32*)&fast_log_buffer_offset_alloc, new_offset_alloc);
// get rid of bit 31 flag
size &= ~(1 << 31);