annotate src/os/windows/vm/os_windows.hpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 09259e52a610
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
11092
59b052799158 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 6842
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 470
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP
0
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // Win32_OS defines the interface to windows operating systems
a61af66fc99e Initial load
duke
parents:
diff changeset
28
14436
b0133e4187d3 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 11151
diff changeset
29 // Information about the protection of the page at address '0' on this os.
b0133e4187d3 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 11151
diff changeset
30 static bool zero_page_read_protected() { return true; }
b0133e4187d3 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 11151
diff changeset
31
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 class win32 {
6080
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 3885
diff changeset
33 friend class os;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
36 static int _vm_page_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 static int _vm_allocation_granularity;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 static int _processor_type;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 static int _processor_level;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 static julong _physical_memory;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 static size_t _default_stack_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 static bool _is_nt;
389
ee21eaa8ffe1 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 0
diff changeset
43 static bool _is_windows_2003;
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 1972
diff changeset
44 static bool _is_windows_server;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45
6080
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 3885
diff changeset
46 static void print_windows_version(outputStream* st);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 3885
diff changeset
47
0
a61af66fc99e Initial load
duke
parents:
diff changeset
48 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Windows-specific interface:
a61af66fc99e Initial load
duke
parents:
diff changeset
50 static void initialize_system_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
51 static void setmode_streams();
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // Processor info as provided by NT
a61af66fc99e Initial load
duke
parents:
diff changeset
54 static int processor_type() { return _processor_type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Processor level may not be accurate on non-NT systems
a61af66fc99e Initial load
duke
parents:
diff changeset
56 static int processor_level() {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 assert(is_nt(), "use vm_version instead");
a61af66fc99e Initial load
duke
parents:
diff changeset
58 return _processor_level;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 }
a61af66fc99e Initial load
duke
parents:
diff changeset
60 static julong available_memory();
a61af66fc99e Initial load
duke
parents:
diff changeset
61 static julong physical_memory() { return _physical_memory; }
a61af66fc99e Initial load
duke
parents:
diff changeset
62
3429
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
63 // load dll from Windows system directory or Windows directory
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
64 static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
65
0
a61af66fc99e Initial load
duke
parents:
diff changeset
66 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Generic interface:
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // Trace number of created threads
a61af66fc99e Initial load
duke
parents:
diff changeset
70 static intx _os_thread_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 static volatile intx _os_thread_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Tells whether the platform is NT or Windown95
a61af66fc99e Initial load
duke
parents:
diff changeset
74 static bool is_nt() { return _is_nt; }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 1972
diff changeset
76 // Tells whether this is a server version of Windows
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 1972
diff changeset
77 static bool is_windows_server() { return _is_windows_server; }
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 1972
diff changeset
78
389
ee21eaa8ffe1 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 0
diff changeset
79 // Tells whether the platform is Windows 2003
ee21eaa8ffe1 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 0
diff changeset
80 static bool is_windows_2003() { return _is_windows_2003; }
ee21eaa8ffe1 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 0
diff changeset
81
0
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Returns the byte size of a virtual memory page
a61af66fc99e Initial load
duke
parents:
diff changeset
83 static int vm_page_size() { return _vm_page_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Returns the size in bytes of memory blocks which can be allocated.
a61af66fc99e Initial load
duke
parents:
diff changeset
86 static int vm_allocation_granularity() { return _vm_allocation_granularity; }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Read the headers for the executable that started the current process into
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // the structure passed in (see winnt.h).
a61af66fc99e Initial load
duke
parents:
diff changeset
90 static void read_executable_headers(PIMAGE_NT_HEADERS);
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Default stack size for the current process.
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static size_t default_stack_size() { return _default_stack_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 #ifndef _WIN64
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // A wrapper to install a structured exception handler for fast JNI accesors.
a61af66fc99e Initial load
duke
parents:
diff changeset
97 static address fast_jni_accessor_wrapper(BasicType);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
99
11092
59b052799158 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 6842
diff changeset
100 static void call_test_func_with_wrapper(void (*funcPtr)(void));
59b052799158 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 6842
diff changeset
101
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // filter function to ignore faults on serializations page
a61af66fc99e Initial load
duke
parents:
diff changeset
103 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
104 };
a61af66fc99e Initial load
duke
parents:
diff changeset
105
11151
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
106 /*
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
107 * Crash protection for the watcher thread. Wrap the callback
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
108 * with a __try { call() }
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
109 * To be able to use this - don't take locks, don't rely on destructors,
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
110 * don't make OS library calls, don't allocate memory, don't print,
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
111 * don't call code that could leave the heap / memory in an inconsistent state,
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
112 * or anything else where we are not in control if we suddenly jump out.
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
113 */
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
114 class WatcherThreadCrashProtection : public StackObj {
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
115 public:
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
116 WatcherThreadCrashProtection();
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
117 bool call(os::CrashProtectionCallback& cb);
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
118 };
5e3b6f79d280 8020701: Avoid crashes in WatcherThread
rbackman
parents: 11092
diff changeset
119
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
120 class PlatformEvent : public CHeapObj<mtInternal> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
121 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
122 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
a61af66fc99e Initial load
duke
parents:
diff changeset
123 volatile int _Event ;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 HANDLE _ParkHandle ;
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 public: // TODO-FIXME: make dtor private
a61af66fc99e Initial load
duke
parents:
diff changeset
127 ~PlatformEvent() { guarantee (0, "invariant") ; }
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
130 PlatformEvent() {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 _Event = 0 ;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 guarantee (_ParkHandle != NULL, "invariant") ;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 }
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // Exercise caution using reset() and fired() - they may require MEMBARs
a61af66fc99e Initial load
duke
parents:
diff changeset
137 void reset() { _Event = 0 ; }
a61af66fc99e Initial load
duke
parents:
diff changeset
138 int fired() { return _Event; }
a61af66fc99e Initial load
duke
parents:
diff changeset
139 void park () ;
a61af66fc99e Initial load
duke
parents:
diff changeset
140 void unpark () ;
a61af66fc99e Initial load
duke
parents:
diff changeset
141 int park (jlong millis) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 } ;
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
146 class PlatformParker : public CHeapObj<mtInternal> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
147 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
148 HANDLE _ParkEvent ;
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
151 ~PlatformParker () { guarantee (0, "invariant") ; }
a61af66fc99e Initial load
duke
parents:
diff changeset
152 PlatformParker () {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 _ParkEvent = CreateEvent (NULL, true, false, NULL) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 guarantee (_ParkEvent != NULL, "invariant") ;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 } ;
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
158
3429
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
159 // JDK7 requires VS2010
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
160 #if _MSC_VER < 1600
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
161 #define JDK6_OR_EARLIER 1
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
162 #endif
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
163
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
164
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
165
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
166 class WinSock2Dll: AllStatic {
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
167 public:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
168 static BOOL WSAStartup(WORD, LPWSADATA);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
169 static struct hostent* gethostbyname(const char *name);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
170 static BOOL WinSock2Available();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
171 #ifdef JDK6_OR_EARLIER
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
172 private:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
173 static int (PASCAL FAR* _WSAStartup)(WORD, LPWSADATA);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
174 static struct hostent *(PASCAL FAR *_gethostbyname)(...);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
175 static BOOL initialized;
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
176
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
177 static void initialize();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
178 #endif
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
179 };
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
180
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
181 class Kernel32Dll: AllStatic {
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
182 public:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
183 static BOOL SwitchToThread();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
184 static SIZE_T GetLargePageMinimum();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
185
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
186 static BOOL SwitchToThreadAvailable();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
187 static BOOL GetLargePageMinimumAvailable();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
188
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
189 // Help tools
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
190 static BOOL HelpToolsAvailable();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
191 static HANDLE CreateToolhelp32Snapshot(DWORD,DWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
192 static BOOL Module32First(HANDLE,LPMODULEENTRY32);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
193 static BOOL Module32Next(HANDLE,LPMODULEENTRY32);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
194
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
195 static void GetNativeSystemInfo(LPSYSTEM_INFO);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
196
3885
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
197 // NUMA calls
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
198 static BOOL NumaCallsAvailable();
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
199 static LPVOID VirtualAllocExNuma(HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
200 static BOOL GetNumaHighestNodeNumber(PULONG);
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
201 static BOOL GetNumaNodeProcessorMask(UCHAR, PULONGLONG);
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
202
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
203 // Stack walking
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
204 static USHORT RtlCaptureStackBackTrace(ULONG, ULONG, PVOID*, PULONG);
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
205
3429
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
206 private:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
207 // GetLargePageMinimum available on Windows Vista/Windows Server 2003
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
208 // and later
3885
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
209 // NUMA calls available Windows Vista/WS2008 and later
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
210
3429
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
211 static SIZE_T (WINAPI *_GetLargePageMinimum)(void);
3885
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
212 static LPVOID (WINAPI *_VirtualAllocExNuma) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
213 static BOOL (WINAPI *_GetNumaHighestNodeNumber) (PULONG);
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
214 static BOOL (WINAPI *_GetNumaNodeProcessorMask) (UCHAR, PULONGLONG);
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
215 static USHORT (WINAPI *_RtlCaptureStackBackTrace)(ULONG, ULONG, PVOID*, PULONG);
3429
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
216 static BOOL initialized;
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
217
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
218 static void initialize();
3885
3cd0157e1d4d 7082969: NUMA interleaving
iveresov
parents: 3429
diff changeset
219 static void initializeCommon();
3429
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
220
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
221 #ifdef JDK6_OR_EARLIER
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
222 private:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
223 static BOOL (WINAPI *_SwitchToThread)(void);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
224 static HANDLE (WINAPI* _CreateToolhelp32Snapshot)(DWORD,DWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
225 static BOOL (WINAPI* _Module32First)(HANDLE,LPMODULEENTRY32);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
226 static BOOL (WINAPI* _Module32Next)(HANDLE,LPMODULEENTRY32);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
227 static void (WINAPI *_GetNativeSystemInfo)(LPSYSTEM_INFO);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
228 #endif
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
229
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
230 };
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
231
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
232 class Advapi32Dll: AllStatic {
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
233 public:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
234 static BOOL AdjustTokenPrivileges(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
235 static BOOL OpenProcessToken(HANDLE, DWORD, PHANDLE);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
236 static BOOL LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
237
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
238 static BOOL AdvapiAvailable();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
239
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
240 #ifdef JDK6_OR_EARLIER
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
241 private:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
242 static BOOL (WINAPI *_AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
243 static BOOL (WINAPI *_OpenProcessToken)(HANDLE, DWORD, PHANDLE);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
244 static BOOL (WINAPI *_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
245 static BOOL initialized;
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
246
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
247 static void initialize();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
248 #endif
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
249 };
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
250
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
251 class PSApiDll: AllStatic {
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
252 public:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
253 static BOOL EnumProcessModules(HANDLE, HMODULE *, DWORD, LPDWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
254 static DWORD GetModuleFileNameEx(HANDLE, HMODULE, LPTSTR, DWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
255 static BOOL GetModuleInformation(HANDLE, HMODULE, LPMODULEINFO, DWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
256
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
257 static BOOL PSApiAvailable();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
258
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
259 #ifdef JDK6_OR_EARLIER
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
260 private:
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
261 static BOOL (WINAPI *_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
262 static BOOL (WINAPI *_GetModuleFileNameEx)(HANDLE, HMODULE, LPTSTR, DWORD);;
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
263 static BOOL (WINAPI *_GetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD);
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
264 static BOOL initialized;
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
265
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
266 static void initialize();
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
267 #endif
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
268 };
5def270bc147 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 2204
diff changeset
269
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
270 #endif // OS_WINDOWS_VM_OS_WINDOWS_HPP