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