genode/base-codezero/include/arm/cpu/atomic.h
2012-01-03 15:35:05 +01:00

34 lines
854 B
C++

/*
* \brief Atomic operations for ARM on codezero
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-2012 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__ARM__CPU__ATOMIC_H_
#define _INCLUDE__ARM__CPU__ATOMIC_H_
namespace Genode {
/**
* Atomic compare and exchange
*
* This function compares the value at dest with cmp_val.
* If both values are equal, dest is set to new_val. If
* both values are different, the value at dest remains
* unchanged.
*
* \return 1 if the value was successfully changed to new_val,
* 0 if cmp_val and the value at dest differ.
*/
int cmpxchg(volatile int *dest, int cmp_val, int new_val);
}
#endif /* _INCLUDE__ARM__CPU__ATOMIC_H_ */