39 void* const handle = os::dll_load(library, ebuf, sizeof(ebuf)); 40 if (handle == NULL) { 41 log_error(gc)("Failed to load library: %s", library); 42 vm_exit_during_initialization("ZGC requires Windows version 1803 or later"); 43 } 44 45 fn = reinterpret_cast<Fn*>(os::dll_lookup(handle, symbol)); 46 if (fn == NULL) { 47 log_error(gc)("Failed to lookup symbol: %s", symbol); 48 vm_exit_during_initialization("ZGC requires Windows version 1803 or later"); 49 } 50 } 51 52 void ZSyscall::initialize() { 53 lookup_symbol(CreateFileMappingW, "KernelBase", "CreateFileMappingW"); 54 lookup_symbol(VirtualAlloc2, "KernelBase", "VirtualAlloc2"); 55 lookup_symbol(VirtualFreeEx, "KernelBase", "VirtualFreeEx"); 56 lookup_symbol(MapViewOfFile3, "KernelBase", "MapViewOfFile3"); 57 lookup_symbol(UnmapViewOfFile2, "KernelBase", "UnmapViewOfFile2"); 58 } | 39 void* const handle = os::dll_load(library, ebuf, sizeof(ebuf)); 40 if (handle == NULL) { 41 log_error(gc)("Failed to load library: %s", library); 42 vm_exit_during_initialization("ZGC requires Windows version 1803 or later"); 43 } 44 45 fn = reinterpret_cast<Fn*>(os::dll_lookup(handle, symbol)); 46 if (fn == NULL) { 47 log_error(gc)("Failed to lookup symbol: %s", symbol); 48 vm_exit_during_initialization("ZGC requires Windows version 1803 or later"); 49 } 50 } 51 52 void ZSyscall::initialize() { 53 lookup_symbol(CreateFileMappingW, "KernelBase", "CreateFileMappingW"); 54 lookup_symbol(VirtualAlloc2, "KernelBase", "VirtualAlloc2"); 55 lookup_symbol(VirtualFreeEx, "KernelBase", "VirtualFreeEx"); 56 lookup_symbol(MapViewOfFile3, "KernelBase", "MapViewOfFile3"); 57 lookup_symbol(UnmapViewOfFile2, "KernelBase", "UnmapViewOfFile2"); 58 } 59 60 bool ZSyscall::is_os_supported() { 61 char ebuf[1024]; 62 void* const handle = os::dll_load("KernelBase", ebuf, sizeof(ebuf)); 63 if (handle == NULL) { 64 assert(false, "Failed to load library: KernelBase"); 65 return false; 66 } 67 68 return os::dll_lookup(handle, "VirtualAlloc2") != NULL; 69 } |