src/hotspot/os_cpu/bsd_zero/orderAccess_bsd_zero.hpp
author michaelm
Thu, 22 Aug 2019 14:36:10 +0100
changeset 57838 78844dceede6
parent 54323 846bc643f4ef
permissions -rw-r--r--
8199849: Add support for UTF-8 encoded credentials in HTTP Basic Authentication Reviewed-by: chegar, dfuchs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
     2
 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     3
 * Copyright 2007, 2008, 2009 Red Hat, Inc.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     5
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     9
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    14
 * accompanied this code).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    15
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    19
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    22
 * questions.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    23
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    24
 */
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    25
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
    26
#ifndef OS_CPU_BSD_ZERO_ORDERACCESS_BSD_ZERO_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
    27
#define OS_CPU_BSD_ZERO_ORDERACCESS_BSD_ZERO_HPP
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    28
50429
83aec1d357d4 8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents: 47609
diff changeset
    29
// Included in orderAccess.hpp header file.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    30
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    31
#ifdef ARM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    32
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    33
/*
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    34
 * ARM Kernel helper for memory barrier.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    35
 * Using __asm __volatile ("":::"memory") does not work reliable on ARM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    36
 * and gcc __sync_synchronize(); implementation does not use the kernel
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    37
 * helper for all gcc versions so it is unreliable to use as well.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    38
 */
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    39
typedef void (__kernel_dmb_t) (void);
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    40
#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    41
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    42
#define FULL_MEM_BARRIER __kernel_dmb()
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    43
#define LIGHT_MEM_BARRIER __kernel_dmb()
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    44
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    45
#else // ARM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    46
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    47
#define FULL_MEM_BARRIER __sync_synchronize()
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    48
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    49
#ifdef PPC
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    50
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    51
#ifdef __NO_LWSYNC__
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    52
#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    53
#else
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    54
#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    55
#endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    56
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    57
#else // PPC
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    58
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    59
#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    60
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    61
#endif // PPC
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    62
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    63
#endif // ARM
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    64
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    65
// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    66
// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    67
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    68
inline void OrderAccess::loadload()   { LIGHT_MEM_BARRIER; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    69
inline void OrderAccess::storestore() { LIGHT_MEM_BARRIER; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    70
inline void OrderAccess::loadstore()  { LIGHT_MEM_BARRIER; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    71
inline void OrderAccess::storeload()  { FULL_MEM_BARRIER;  }
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    72
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    73
inline void OrderAccess::acquire()    { LIGHT_MEM_BARRIER; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    74
inline void OrderAccess::release()    { LIGHT_MEM_BARRIER; }
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 25715
diff changeset
    75
inline void OrderAccess::fence()      { FULL_MEM_BARRIER;  }
54323
846bc643f4ef 8220351: Cross-modifying code
rehn
parents: 53244
diff changeset
    76
inline void OrderAccess::cross_modify_fence()            { }
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    77
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50429
diff changeset
    78
#endif // OS_CPU_BSD_ZERO_ORDERACCESS_BSD_ZERO_HPP