19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP 26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP 27 // Win32_OS defines the interface to windows operating systems 28 29 // Information about the protection of the page at address '0' on this os. 30 static bool zero_page_read_protected() { return true; } 31 32 // File conventions 33 static const char* file_separator() { return "\\"; } 34 static const char* line_separator() { return "\r\n"; } 35 static const char* path_separator() { return ";"; } 36 37 class win32 { 38 friend class os; 39 40 protected: 41 static int _vm_page_size; 42 static int _vm_allocation_granularity; 43 static int _processor_type; 44 static int _processor_level; 45 static julong _physical_memory; 46 static size_t _default_stack_size; 47 static bool _is_nt; 48 static bool _is_windows_2003; 49 static bool _is_windows_server; 50 static bool _has_performance_count; 51 52 static void print_windows_version(outputStream* st); 53 54 public: 55 // Windows-specific interface: 56 static void initialize_system_info(); 57 static void setmode_streams(); 58 59 // Processor info as provided by NT 60 static int processor_type() { return _processor_type; } 61 // Processor level may not be accurate on non-NT systems 62 static int processor_level() { 63 assert(is_nt(), "use vm_version instead"); 64 return _processor_level; 65 } 66 static julong available_memory(); 67 static julong physical_memory() { return _physical_memory; } 68 69 // load dll from Windows system directory or Windows directory 70 static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); 71 72 private: 73 static void initialize_performance_counter(); 74 75 public: 76 // Generic interface: 77 78 // Trace number of created threads 79 static intx _os_thread_limit; 80 static volatile intx _os_thread_count; 81 82 // Tells whether the platform is NT or Windown95 83 static bool is_nt() { return _is_nt; } 84 85 // Tells whether this is a server version of Windows 86 static bool is_windows_server() { return _is_windows_server; } 87 88 // Tells whether the platform is Windows 2003 89 static bool is_windows_2003() { return _is_windows_2003; } 90 91 // Returns the byte size of a virtual memory page 92 static int vm_page_size() { return _vm_page_size; } 93 94 // Returns the size in bytes of memory blocks which can be allocated. 95 static int vm_allocation_granularity() { return _vm_allocation_granularity; } 96 97 // Read the headers for the executable that started the current process into 98 // the structure passed in (see winnt.h). 99 static void read_executable_headers(PIMAGE_NT_HEADERS); 100 101 // Default stack size for the current process. 102 static size_t default_stack_size() { return _default_stack_size; } 103 104 #ifndef _WIN64 105 // A wrapper to install a structured exception handler for fast JNI accesors. 106 static address fast_jni_accessor_wrapper(BasicType); 107 #endif 108 109 static void call_test_func_with_wrapper(void (*funcPtr)(void)); | 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef OS_WINDOWS_VM_OS_WINDOWS_HPP 26 #define OS_WINDOWS_VM_OS_WINDOWS_HPP 27 // Win32_OS defines the interface to windows operating systems 28 29 // Information about the protection of the page at address '0' on this os. 30 static bool zero_page_read_protected() { return true; } 31 32 // File conventions 33 static const char* file_separator() { return "\\"; } 34 static const char* line_separator() { return "\r\n"; } 35 static const char* path_separator() { return ";"; } 36 37 class win32 { 38 friend class os; 39 friend unsigned __stdcall java_start(class Thread*); 40 41 protected: 42 static int _vm_page_size; 43 static int _vm_allocation_granularity; 44 static int _processor_type; 45 static int _processor_level; 46 static julong _physical_memory; 47 static size_t _default_stack_size; 48 static bool _is_nt; 49 static bool _is_windows_2003; 50 static bool _is_windows_server; 51 static bool _has_exit_bug; 52 static bool _has_performance_count; 53 54 static void print_windows_version(outputStream* st); 55 56 public: 57 // Windows-specific interface: 58 static void initialize_system_info(); 59 static void setmode_streams(); 60 61 // Processor info as provided by NT 62 static int processor_type() { return _processor_type; } 63 // Processor level may not be accurate on non-NT systems 64 static int processor_level() { 65 assert(is_nt(), "use vm_version instead"); 66 return _processor_level; 67 } 68 static julong available_memory(); 69 static julong physical_memory() { return _physical_memory; } 70 71 // load dll from Windows system directory or Windows directory 72 static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); 73 74 private: 75 enum Ept { EPT_THREAD, EPT_PROCESS, EPT_PROCESS_DIE }; 76 // Wrapper around _endthreadex(), exit() and _exit() 77 static int exit_process_or_thread(Ept what, int exit_code); 78 79 static void initialize_performance_counter(); 80 81 public: 82 // Generic interface: 83 84 // Trace number of created threads 85 static intx _os_thread_limit; 86 static volatile intx _os_thread_count; 87 88 // Tells whether the platform is NT or Windown95 89 static bool is_nt() { return _is_nt; } 90 91 // Tells whether this is a server version of Windows 92 static bool is_windows_server() { return _is_windows_server; } 93 94 // Tells whether the platform is Windows 2003 95 static bool is_windows_2003() { return _is_windows_2003; } 96 97 // Tells whether there can be the race bug during process exit on this platform 98 static bool has_exit_bug() { return _has_exit_bug; } 99 100 // Returns the byte size of a virtual memory page 101 static int vm_page_size() { return _vm_page_size; } 102 103 // Returns the size in bytes of memory blocks which can be allocated. 104 static int vm_allocation_granularity() { return _vm_allocation_granularity; } 105 106 // Read the headers for the executable that started the current process into 107 // the structure passed in (see winnt.h). 108 static void read_executable_headers(PIMAGE_NT_HEADERS); 109 110 // Default stack size for the current process. 111 static size_t default_stack_size() { return _default_stack_size; } 112 113 #ifndef _WIN64 114 // A wrapper to install a structured exception handler for fast JNI accesors. 115 static address fast_jni_accessor_wrapper(BasicType); 116 #endif 117 118 static void call_test_func_with_wrapper(void (*funcPtr)(void)); |