Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/os/aix/os_aix.hpp
40930 views
1
/*
2
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
3
* Copyright (c) 2013, 2016 SAP SE. All rights reserved.
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_AIX_OS_AIX_HPP
27
#define OS_AIX_OS_AIX_HPP
28
29
// Information about the protection of the page at address '0' on this os.
30
static bool zero_page_read_protected() { return false; }
31
32
// Class Aix defines the interface to the Aix operating systems.
33
34
class Aix {
35
friend class os;
36
37
private:
38
39
static julong _physical_memory;
40
static pthread_t _main_thread;
41
static int _page_size;
42
43
// -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE)
44
static int _on_pase;
45
46
// 0 = uninitialized, otherwise 16 bit number:
47
// lower 8 bit - minor version
48
// higher 8 bit - major version
49
// For AIX, e.g. 0x0601 for AIX 6.1
50
// for OS/400 e.g. 0x0504 for OS/400 V5R4
51
static uint32_t _os_version;
52
53
// -1 = uninitialized,
54
// 0 - SPEC1170 not requested (XPG_SUS_ENV is OFF or not set)
55
// 1 - SPEC1170 requested (XPG_SUS_ENV is ON)
56
static int _xpg_sus_mode;
57
58
// -1 = uninitialized,
59
// 0 - EXTSHM=OFF or not set
60
// 1 - EXTSHM=ON
61
static int _extshm;
62
63
static julong available_memory();
64
static julong physical_memory() { return _physical_memory; }
65
static void initialize_system_info();
66
67
// OS recognitions (PASE/AIX, OS level) call this before calling any
68
// one of Aix::on_pase(), Aix::os_version().
69
static void initialize_os_info();
70
71
// Scan environment for important settings which might effect the
72
// VM. Trace out settings. Warn about invalid settings and/or
73
// correct them.
74
//
75
// Must run after os::Aix::initialue_os_info().
76
static void scan_environment();
77
78
// Initialize libo4 (on PASE) and libperfstat (on AIX). Call this
79
// before relying on functions from either lib, e.g. Aix::get_meminfo().
80
static void initialize_libo4();
81
static void initialize_libperfstat();
82
83
public:
84
static void init_thread_fpu_state();
85
static pthread_t main_thread(void) { return _main_thread; }
86
87
// Given an address, returns the size of the page backing that address
88
static size_t query_pagesize(void* p);
89
90
static int page_size(void) {
91
assert(_page_size != -1, "not initialized");
92
return _page_size;
93
}
94
95
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
96
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
97
98
static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);
99
100
// libpthread version string
101
static void libpthread_init();
102
103
// Function returns true if we run on OS/400 (pase), false if we run
104
// on AIX.
105
static bool on_pase() {
106
assert(_on_pase != -1, "not initialized");
107
return _on_pase ? true : false;
108
}
109
110
// Function returns true if we run on AIX, false if we run on OS/400
111
// (pase).
112
static bool on_aix() {
113
assert(_on_pase != -1, "not initialized");
114
return _on_pase ? false : true;
115
}
116
117
// Get 4 byte AIX kernel version number:
118
// highest 2 bytes: Version, Release
119
// if available: lowest 2 bytes: Tech Level, Service Pack.
120
static uint32_t os_version() {
121
assert(_os_version != 0, "not initialized");
122
return _os_version;
123
}
124
125
// 0 = uninitialized, otherwise 16 bit number:
126
// lower 8 bit - minor version
127
// higher 8 bit - major version
128
// For AIX, e.g. 0x0601 for AIX 6.1
129
// for OS/400 e.g. 0x0504 for OS/400 V5R4
130
static int os_version_short() {
131
return os_version() >> 16;
132
}
133
134
// Convenience method: returns true if running on PASE V5R4 or older.
135
static bool on_pase_V5R4_or_older() {
136
return on_pase() && os_version_short() <= 0x0504;
137
}
138
139
// Convenience method: returns true if running on AIX 5.3 or older.
140
static bool on_aix_53_or_older() {
141
return on_aix() && os_version_short() <= 0x0503;
142
}
143
144
// Returns true if we run in SPEC1170 compliant mode (XPG_SUS_ENV=ON).
145
static bool xpg_sus_mode() {
146
assert(_xpg_sus_mode != -1, "not initialized");
147
return _xpg_sus_mode;
148
}
149
150
// Returns true if EXTSHM=ON.
151
static bool extshm() {
152
assert(_extshm != -1, "not initialized");
153
return _extshm;
154
}
155
156
// result struct for get_meminfo()
157
struct meminfo_t {
158
159
// Amount of virtual memory (in units of 4 KB pages)
160
unsigned long long virt_total;
161
162
// Amount of real memory, in bytes
163
unsigned long long real_total;
164
165
// Amount of free real memory, in bytes
166
unsigned long long real_free;
167
168
// Total amount of paging space, in bytes
169
unsigned long long pgsp_total;
170
171
// Amount of free paging space, in bytes
172
unsigned long long pgsp_free;
173
174
};
175
176
// Functions to retrieve memory information on AIX, PASE.
177
// (on AIX, using libperfstat, on PASE with libo4.so).
178
// Returns true if ok, false if error.
179
static bool get_meminfo(meminfo_t* pmi);
180
};
181
182
#endif // OS_AIX_OS_AIX_HPP
183
184