Path: blob/master/src/hotspot/os/aix/os_aix.hpp
40930 views
/*1* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2013, 2016 SAP SE. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef OS_AIX_OS_AIX_HPP26#define OS_AIX_OS_AIX_HPP2728// Information about the protection of the page at address '0' on this os.29static bool zero_page_read_protected() { return false; }3031// Class Aix defines the interface to the Aix operating systems.3233class Aix {34friend class os;3536private:3738static julong _physical_memory;39static pthread_t _main_thread;40static int _page_size;4142// -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE)43static int _on_pase;4445// 0 = uninitialized, otherwise 16 bit number:46// lower 8 bit - minor version47// higher 8 bit - major version48// For AIX, e.g. 0x0601 for AIX 6.149// for OS/400 e.g. 0x0504 for OS/400 V5R450static uint32_t _os_version;5152// -1 = uninitialized,53// 0 - SPEC1170 not requested (XPG_SUS_ENV is OFF or not set)54// 1 - SPEC1170 requested (XPG_SUS_ENV is ON)55static int _xpg_sus_mode;5657// -1 = uninitialized,58// 0 - EXTSHM=OFF or not set59// 1 - EXTSHM=ON60static int _extshm;6162static julong available_memory();63static julong physical_memory() { return _physical_memory; }64static void initialize_system_info();6566// OS recognitions (PASE/AIX, OS level) call this before calling any67// one of Aix::on_pase(), Aix::os_version().68static void initialize_os_info();6970// Scan environment for important settings which might effect the71// VM. Trace out settings. Warn about invalid settings and/or72// correct them.73//74// Must run after os::Aix::initialue_os_info().75static void scan_environment();7677// Initialize libo4 (on PASE) and libperfstat (on AIX). Call this78// before relying on functions from either lib, e.g. Aix::get_meminfo().79static void initialize_libo4();80static void initialize_libperfstat();8182public:83static void init_thread_fpu_state();84static pthread_t main_thread(void) { return _main_thread; }8586// Given an address, returns the size of the page backing that address87static size_t query_pagesize(void* p);8889static int page_size(void) {90assert(_page_size != -1, "not initialized");91return _page_size;92}9394static intptr_t* ucontext_get_sp(const ucontext_t* uc);95static intptr_t* ucontext_get_fp(const ucontext_t* uc);9697static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);9899// libpthread version string100static void libpthread_init();101102// Function returns true if we run on OS/400 (pase), false if we run103// on AIX.104static bool on_pase() {105assert(_on_pase != -1, "not initialized");106return _on_pase ? true : false;107}108109// Function returns true if we run on AIX, false if we run on OS/400110// (pase).111static bool on_aix() {112assert(_on_pase != -1, "not initialized");113return _on_pase ? false : true;114}115116// Get 4 byte AIX kernel version number:117// highest 2 bytes: Version, Release118// if available: lowest 2 bytes: Tech Level, Service Pack.119static uint32_t os_version() {120assert(_os_version != 0, "not initialized");121return _os_version;122}123124// 0 = uninitialized, otherwise 16 bit number:125// lower 8 bit - minor version126// higher 8 bit - major version127// For AIX, e.g. 0x0601 for AIX 6.1128// for OS/400 e.g. 0x0504 for OS/400 V5R4129static int os_version_short() {130return os_version() >> 16;131}132133// Convenience method: returns true if running on PASE V5R4 or older.134static bool on_pase_V5R4_or_older() {135return on_pase() && os_version_short() <= 0x0504;136}137138// Convenience method: returns true if running on AIX 5.3 or older.139static bool on_aix_53_or_older() {140return on_aix() && os_version_short() <= 0x0503;141}142143// Returns true if we run in SPEC1170 compliant mode (XPG_SUS_ENV=ON).144static bool xpg_sus_mode() {145assert(_xpg_sus_mode != -1, "not initialized");146return _xpg_sus_mode;147}148149// Returns true if EXTSHM=ON.150static bool extshm() {151assert(_extshm != -1, "not initialized");152return _extshm;153}154155// result struct for get_meminfo()156struct meminfo_t {157158// Amount of virtual memory (in units of 4 KB pages)159unsigned long long virt_total;160161// Amount of real memory, in bytes162unsigned long long real_total;163164// Amount of free real memory, in bytes165unsigned long long real_free;166167// Total amount of paging space, in bytes168unsigned long long pgsp_total;169170// Amount of free paging space, in bytes171unsigned long long pgsp_free;172173};174175// Functions to retrieve memory information on AIX, PASE.176// (on AIX, using libperfstat, on PASE with libo4.so).177// Returns true if ok, false if error.178static bool get_meminfo(meminfo_t* pmi);179};180181#endif // OS_AIX_OS_AIX_HPP182183184