src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.inline.hpp
author ihse
Mon, 26 Nov 2018 14:18:22 +0100
branchihse-manpages-branch
changeset 57043 23d7457ca4c6
parent 47216 71c04702a3d5
child 53244 9807daeb47c4
permissions -rw-r--r--
Clean up login in when running which kind of man page creation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29182
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     1
/*
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     3
 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     5
 *
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     8
 * published by the Free Software Foundation.
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
     9
 *
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    14
 * accompanied this code).
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    15
 *
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    19
 *
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    22
 * questions.
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    23
 *
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    24
 */
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    25
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    26
#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    27
#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    28
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    29
#include "runtime/os.hpp"
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    30
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    31
// See http://www.technovelty.org/code/c/reading-rdtsc.htl for details
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    32
inline jlong os::rdtsc() {
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    33
  uint64_t res;
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    34
  uint32_t ts1, ts2;
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    35
  __asm__ __volatile__ ("rdtsc" : "=a" (ts1), "=d" (ts2));
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    36
  res = ((uint64_t)ts1 | (uint64_t)ts2 << 32);
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    37
  return (jlong)res;
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    38
}
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    39
78af2a4d1ec3 8068055: AARCH64: os_cpu
aph
parents:
diff changeset
    40
#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP