hotspot/src/os/windows/vm/os_windows.hpp
author mikael
Tue, 09 Oct 2012 10:09:34 -0700
changeset 13963 e5b53c306fb5
parent 13195 be27e1b6a4b9
child 18683 a6418e038255
permissions -rw-r--r--
7197424: update copyright year to match last edit in jdk8 hotspot repository Summary: Update copyright year to 2012 for relevant files Reviewed-by: dholmes, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13963
e5b53c306fb5 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 13195
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define OS_WINDOWS_VM_OS_WINDOWS_HPP
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
// Win32_OS defines the interface to windows operating systems
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
class win32 {
12735
3e2e491f4f69 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 10494
diff changeset
    30
  friend class os;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  static int    _vm_page_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  static int    _vm_allocation_granularity;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  static int    _processor_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  static int    _processor_level;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  static julong _physical_memory;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  static size_t _default_stack_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  static bool   _is_nt;
1421
a7ef1a3b2644 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 1
diff changeset
    40
  static bool   _is_windows_2003;
8119
81eef1b06988 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 7397
diff changeset
    41
  static bool   _is_windows_server;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
12735
3e2e491f4f69 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 10494
diff changeset
    43
  static void print_windows_version(outputStream* st);
3e2e491f4f69 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 10494
diff changeset
    44
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // Windows-specific interface:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  static void   initialize_system_info();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  static void   setmode_streams();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  // Processor info as provided by NT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  static int processor_type()  { return _processor_type;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // Processor level may not be accurate on non-NT systems
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  static int processor_level() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    assert(is_nt(), "use vm_version instead");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    return _processor_level;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static julong available_memory();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static julong physical_memory() { return _physical_memory; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
10246
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
    60
  // load dll from Windows system directory or Windows directory
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
    61
  static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
    62
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // Generic interface:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // Trace number of created threads
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  static          intx  _os_thread_limit;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  static volatile intx  _os_thread_count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // Tells whether the platform is NT or Windown95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  static bool is_nt() { return _is_nt; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
8119
81eef1b06988 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 7397
diff changeset
    73
  // Tells whether this is a server version of Windows
81eef1b06988 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 7397
diff changeset
    74
  static bool is_windows_server() { return _is_windows_server; }
81eef1b06988 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents: 7397
diff changeset
    75
1421
a7ef1a3b2644 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 1
diff changeset
    76
  // Tells whether the platform is Windows 2003
a7ef1a3b2644 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 1
diff changeset
    77
  static bool is_windows_2003() { return _is_windows_2003; }
a7ef1a3b2644 6660681: Incrementally reserve pages on win server 2003 for better large page affinity
jmasa
parents: 1
diff changeset
    78
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  // Returns the byte size of a virtual memory page
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  static int vm_page_size() { return _vm_page_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  // Returns the size in bytes of memory blocks which can be allocated.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  static int vm_allocation_granularity() { return _vm_allocation_granularity; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // Read the headers for the executable that started the current process into
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  // the structure passed in (see winnt.h).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  static void read_executable_headers(PIMAGE_NT_HEADERS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  // Default stack size for the current process.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  static size_t default_stack_size() { return _default_stack_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
#ifndef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  // A wrapper to install a structured exception handler for fast JNI accesors.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  static address fast_jni_accessor_wrapper(BasicType);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  // filter function to ignore faults on serializations page
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12735
diff changeset
   101
class PlatformEvent : public CHeapObj<mtInternal> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    double CachePad [4] ;   // increase odds that _Event is sole occupant of cache line
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    volatile int _Event ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    HANDLE _ParkHandle ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  public:       // TODO-FIXME: make dtor private
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    ~PlatformEvent() { guarantee (0, "invariant") ; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    PlatformEvent() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
      _Event   = 0 ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      guarantee (_ParkHandle != NULL, "invariant") ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    // Exercise caution using reset() and fired() - they may require MEMBARs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    void reset() { _Event = 0 ; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    int  fired() { return _Event; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    void park () ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    void unpark () ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    int  park (jlong millis) ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
} ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12735
diff changeset
   127
class PlatformParker : public CHeapObj<mtInternal> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    HANDLE _ParkEvent ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    ~PlatformParker () { guarantee (0, "invariant") ; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    PlatformParker  () {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      _ParkEvent = CreateEvent (NULL, true, false, NULL) ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      guarantee (_ParkEvent != NULL, "invariant") ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
} ;
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   139
10246
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   140
// JDK7 requires VS2010
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   141
#if _MSC_VER < 1600
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   142
#define JDK6_OR_EARLIER 1
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   143
#endif
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   144
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   145
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   146
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   147
class WinSock2Dll: AllStatic {
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   148
public:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   149
  static BOOL WSAStartup(WORD, LPWSADATA);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   150
  static struct hostent* gethostbyname(const char *name);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   151
  static BOOL WinSock2Available();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   152
#ifdef JDK6_OR_EARLIER
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   153
private:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   154
  static int (PASCAL FAR* _WSAStartup)(WORD, LPWSADATA);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   155
  static struct hostent *(PASCAL FAR *_gethostbyname)(...);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   156
  static BOOL initialized;
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   157
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   158
  static void initialize();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   159
#endif
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   160
};
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   161
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   162
class Kernel32Dll: AllStatic {
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   163
public:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   164
  static BOOL SwitchToThread();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   165
  static SIZE_T GetLargePageMinimum();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   166
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   167
  static BOOL SwitchToThreadAvailable();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   168
  static BOOL GetLargePageMinimumAvailable();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   169
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   170
  // Help tools
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   171
  static BOOL HelpToolsAvailable();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   172
  static HANDLE CreateToolhelp32Snapshot(DWORD,DWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   173
  static BOOL Module32First(HANDLE,LPMODULEENTRY32);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   174
  static BOOL Module32Next(HANDLE,LPMODULEENTRY32);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   175
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   176
  static BOOL GetNativeSystemInfoAvailable();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   177
  static void GetNativeSystemInfo(LPSYSTEM_INFO);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   178
10494
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   179
  // NUMA calls
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   180
  static BOOL NumaCallsAvailable();
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   181
  static LPVOID VirtualAllocExNuma(HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   182
  static BOOL GetNumaHighestNodeNumber(PULONG);
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   183
  static BOOL GetNumaNodeProcessorMask(UCHAR, PULONGLONG);
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   184
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12735
diff changeset
   185
  // Stack walking
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12735
diff changeset
   186
  static USHORT RtlCaptureStackBackTrace(ULONG, ULONG, PVOID*, PULONG);
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12735
diff changeset
   187
10246
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   188
private:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   189
  // GetLargePageMinimum available on Windows Vista/Windows Server 2003
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   190
  // and later
10494
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   191
  // NUMA calls available Windows Vista/WS2008 and later
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   192
10246
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   193
  static SIZE_T (WINAPI *_GetLargePageMinimum)(void);
10494
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   194
  static LPVOID (WINAPI *_VirtualAllocExNuma) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   195
  static BOOL (WINAPI *_GetNumaHighestNodeNumber) (PULONG);
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   196
  static BOOL (WINAPI *_GetNumaNodeProcessorMask) (UCHAR, PULONGLONG);
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 12735
diff changeset
   197
  static USHORT (WINAPI *_RtlCaptureStackBackTrace)(ULONG, ULONG, PVOID*, PULONG);
10246
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   198
  static BOOL initialized;
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   199
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   200
  static void initialize();
10494
3f347ed8bd3c 7082969: NUMA interleaving
iveresov
parents: 10246
diff changeset
   201
  static void initializeCommon();
10246
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   202
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   203
#ifdef JDK6_OR_EARLIER
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   204
private:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   205
  static BOOL (WINAPI *_SwitchToThread)(void);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   206
  static HANDLE (WINAPI* _CreateToolhelp32Snapshot)(DWORD,DWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   207
  static BOOL (WINAPI* _Module32First)(HANDLE,LPMODULEENTRY32);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   208
  static BOOL (WINAPI* _Module32Next)(HANDLE,LPMODULEENTRY32);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   209
  static void (WINAPI *_GetNativeSystemInfo)(LPSYSTEM_INFO);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   210
#endif
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   211
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   212
};
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   213
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   214
class Advapi32Dll: AllStatic {
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   215
public:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   216
  static BOOL AdjustTokenPrivileges(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   217
  static BOOL OpenProcessToken(HANDLE, DWORD, PHANDLE);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   218
  static BOOL LookupPrivilegeValue(LPCTSTR, LPCTSTR, PLUID);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   219
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   220
  static BOOL AdvapiAvailable();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   221
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   222
#ifdef JDK6_OR_EARLIER
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   223
private:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   224
  static BOOL (WINAPI *_AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, DWORD, PTOKEN_PRIVILEGES, PDWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   225
  static BOOL (WINAPI *_OpenProcessToken)(HANDLE, DWORD, PHANDLE);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   226
  static BOOL (WINAPI *_LookupPrivilegeValue)(LPCTSTR, LPCTSTR, PLUID);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   227
  static BOOL initialized;
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   228
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   229
  static void initialize();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   230
#endif
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   231
};
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   232
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   233
class PSApiDll: AllStatic {
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   234
public:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   235
  static BOOL EnumProcessModules(HANDLE, HMODULE *, DWORD, LPDWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   236
  static DWORD GetModuleFileNameEx(HANDLE, HMODULE, LPTSTR, DWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   237
  static BOOL GetModuleInformation(HANDLE, HMODULE, LPMODULEINFO, DWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   238
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   239
  static BOOL PSApiAvailable();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   240
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   241
#ifdef JDK6_OR_EARLIER
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   242
private:
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   243
  static BOOL (WINAPI *_EnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   244
  static BOOL (WINAPI *_GetModuleFileNameEx)(HANDLE, HMODULE, LPTSTR, DWORD);;
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   245
  static BOOL (WINAPI *_GetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD);
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   246
  static BOOL initialized;
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   247
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   248
  static void initialize();
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   249
#endif
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   250
};
adee0cf4c981 7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
zgu
parents: 8119
diff changeset
   251
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   252
#endif // OS_WINDOWS_VM_OS_WINDOWS_HPP