src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp

Print this page
rev 6670 : 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
Reviewed-by: lfoltan, coleenp, dholmes
   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2007, 2008, 2011 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
  27 #define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
  28 
  29 #include "runtime/atomic.hpp"
  30 #include "runtime/os.hpp"
  31 #include "vm_version_zero.hpp"
  32 
  33 // Implementation of class atomic
  34 
  35 #ifdef M68K
  36 
  37 /*
  38  * __m68k_cmpxchg
  39  *
  40  * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
  41  * Returns newval on success and oldval if no exchange happened.
  42  * This implementation is processor specific and works on
  43  * 68020 68030 68040 and 68060.
  44  *
  45  * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
  46  * instruction.
  47  * Using a kernelhelper would be better for arch complete implementation.
  48  *
  49  */
  50 
  51 static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {


   1 /*
   2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2007, 2008, 2011 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
  27 #define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
  28 
  29 #include "runtime/atomic.hpp"
  30 #include "runtime/os.hpp"

  31 
  32 // Implementation of class atomic
  33 
  34 #ifdef M68K
  35 
  36 /*
  37  * __m68k_cmpxchg
  38  *
  39  * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
  40  * Returns newval on success and oldval if no exchange happened.
  41  * This implementation is processor specific and works on
  42  * 68020 68030 68040 and 68060.
  43  *
  44  * It will not work on ColdFire, 68000 and 68010 since they lack the CAS
  45  * instruction.
  46  * Using a kernelhelper would be better for arch complete implementation.
  47  *
  48  */
  49 
  50 static inline int __m68k_cmpxchg(int oldval, int newval, volatile int *ptr) {