/*
* Copyright 2007, 2008, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "orderAccess_linux_zero.inline.hpp"
#include "runtime/atomic.hpp"
#include "vm_version_zero.hpp"
// Implementation of class atomic
#ifdef M68K
/*
* __m68k_cmpxchg
*
* Atomically store newval in *ptr if *ptr is equal to oldval for user space.
* Returns newval on success and oldval if no exchange happened.
* This implementation is processor specific and works on
* 68020 68030 68040 and 68060.
*
* It will not work on ColdFire, 68000 and 68010 since they lack the CAS
* instruction.
* Using a kernelhelper would be better for arch complete implementation.
*
*/
int ret;
return ret;
}
/* Perform an atomic compare and swap: if the current value of `*PTR'
is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of
`*PTR' before the operation.*/
int oldval,
int newval) {
for (;;) {
return prev;
// Success.
return prev;
// We failed even though prev == oldval. Try again.
}
}
/* Atomically add an int to memory. */
for (;;) {
// Loop until success.
}
}
/* Atomically write VALUE into `*PTR' and returns the previous
contents of `*PTR'. */
for (;;) {
// Loop until success.
return prev;
}
}
#endif // M68K
#ifdef ARM
/*
* __kernel_cmpxchg
*
* Atomically store newval in *ptr if *ptr is equal to oldval for user space.
* Return zero if *ptr was changed or non-zero if no exchange happened.
* The C flag is also set if *ptr was changed to allow for assembly
* optimization in the calling code.
*
*/
/* Perform an atomic compare and swap: if the current value of `*PTR'
is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of
`*PTR' before the operation.*/
int oldval,
int newval) {
for (;;) {
return prev;
// Success.
return prev;
// We failed even though prev == oldval. Try again.
}
}
/* Atomically add an int to memory. */
for (;;) {
// Loop until a __kernel_cmpxchg succeeds.
}
}
/* Atomically write VALUE into `*PTR' and returns the previous
contents of `*PTR'. */
for (;;) {
// Loop until a __kernel_cmpxchg succeeds.
return prev;
}
}
#endif // ARM
*dest = store_value;
}
*dest = store_value;
}
#ifdef ARM
#else
#ifdef M68K
#else
#endif // M68K
#endif // ARM
}
#ifdef ARM
#else
#ifdef M68K
#else
#endif // M68K
#endif // ARM
}
}
}
}
}
}
}
}
#ifdef ARM
#else
#ifdef M68K
#else
// __sync_lock_test_and_set is a bizarrely named atomic exchange
// operation. Note that some platforms only support this with the
// limitation that the only valid value to store is the immediate
// constant 1. There is a test for this in JNI_CreateJavaVM().
#endif // M68K
#endif // ARM
}
#ifdef ARM
#else
#ifdef M68K
#else
#endif // M68K
#endif // ARM
}
}
#ifdef ARM
#else
#ifdef M68K
#else
#endif // M68K
#endif // ARM
}
}
#ifdef ARM
#else
#ifdef M68K
#else
#endif // M68K
#endif // ARM
}
volatile void* dest,
void* compare_value) {
}
return dest;
}
}
}
#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP