Ignore:
Timestamp:
Jul 15, 2010, 2:46:42 PM (15 years ago)
Author:
dmik
Message:

hotspot/src: Another big bunch of patches to make the windows code build with Odin32/GCC on OS/2.

Location:
trunk/openjdk/hotspot/src/os/windows/vm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/hotspot/src/os/windows/vm/os_windows.cpp

    r2 r58  
    5656#include <vdmdbg.h>
    5757
     58#ifdef __WIN32OS2__
     59#include <mmsystem.h>
     60#include <wincon.h>
     61#include <basetsd.h>
     62#define _M_IX86
     63#define _lseeki64 lseek
     64#endif
     65
    5866// for timer info max values which include all bits
    5967#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
     
    531539
    532540  HANDLE thread_handle =
     541#ifdef __WIN32OS2__
     542    // @todo probably need to cause some per-thread LIBC initialization routine
     543    CreateThread(NULL,
     544                 stack_size,
     545                 (LPTHREAD_START_ROUTINE) java_start,
     546                 thread,
     547                 CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION,
     548                 (LPDWORD)&thread_id);
     549#else
    533550    (HANDLE)_beginthreadex(NULL,
    534551                           (unsigned)stack_size,
     
    536553                           thread,
    537554                           CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION,
    538                            &thread_id);
     555                           (PDWORD)&thread_id);
     556#endif 
    539557  if (thread_handle == NULL) {
    540558    // perhaps STACK_SIZE_PARAM_IS_A_RESERVATION is not supported, try again
    541559    // without the flag.
    542560    thread_handle =
     561#ifdef __WIN32OS2__
     562    // @todo probably need to cause some per-thread LIBC initialization routine
     563    CreateThread(NULL,
     564                 stack_size,
     565                 (LPTHREAD_START_ROUTINE) java_start,
     566                 thread,
     567                 CREATE_SUSPENDED,
     568                 (LPDWORD)&thread_id);
     569#else
    543570    (HANDLE)_beginthreadex(NULL,
    544571                           (unsigned)stack_size,
     
    547574                           CREATE_SUSPENDED,
    548575                           &thread_id);
     576#endif 
    549577  }
    550578  if (thread_handle == NULL) {
     
    621649
    622650julong os::win32::available_memory() {
     651#ifdef __WIN32OS2__
     652  MEMORYSTATUS ms;
     653  ms.dwLength = sizeof(ms);
     654  GlobalMemoryStatus(&ms);
     655
     656  return ms.dwAvailPhys;
     657#else   
    623658  // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
    624659  // value if total memory is larger than 4GB
     
    628663
    629664  return (julong)ms.ullAvailPhys;
     665#endif
    630666}
    631667
     
    644680
    645681// VC6 lacks DWORD_PTR
     682#ifndef __WIN32OS2__
    646683#if _MSC_VER < 1300
    647684typedef UINT_PTR DWORD_PTR;
     685#endif
    648686#endif
    649687
     
    703741
    704742// Constant offset - calculated using offset()
    705 static jlong  _offset   = 116444736000000000;
     743static jlong  _offset   = 116444736000000000LL;
    706744// Fake time counter for reproducible results when debugging
    707745static jlong  fake_time = 0;
     
    13311369
    13321370void* os::dll_lookup(void* handle, const char* name) {
    1333   return GetProcAddress((HMODULE)handle, name);
     1371  return CAST_FROM_FN_PTR(void *, GetProcAddress((HMODULE)handle, name));
    13341372}
    13351373
     
    14461484  static const arch_t arch_array[]={
    14471485    {IMAGE_FILE_MACHINE_I386,      (char*)"IA 32"},
     1486#ifndef __WIN32OS2__
    14481487    {IMAGE_FILE_MACHINE_AMD64,     (char*)"AMD 64"},
    1449     {IMAGE_FILE_MACHINE_IA64,      (char*)"IA 64"}
     1488    {IMAGE_FILE_MACHINE_IA64,      (char*)"IA 64"},
     1489#endif
    14501490  };
    14511491  #if   (defined _M_IA64)
     
    15301570    case 5000: st->print(" Windows 2000"); break;
    15311571    case 5001: st->print(" Windows XP"); break;
     1572#ifndef __WIN32OS2__     
    15321573    case 5002:
    15331574    case 6000:
     
    15731614      break;
    15741615    }
     1616#endif
    15751617    default: // future windows, print out its major and minor versions
    15761618      st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
     
    15941636  st->print(" %dk page", os::vm_page_size()>>10);
    15951637
     1638#ifdef __WIN32OS2__
     1639  MEMORYSTATUS ms;
     1640  ms.dwLength = sizeof(ms);
     1641  GlobalMemoryStatus(&ms);
     1642#else   
    15961643  // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect
    15971644  // value if total memory is larger than 4GB
     
    15991646  ms.dwLength = sizeof(ms);
    16001647  GlobalMemoryStatusEx(&ms);
     1648#endif
    16011649
    16021650  st->print(", physical %uk", os::physical_memory() >> 10);
    16031651  st->print("(%uk free)", os::available_memory() >> 10);
    16041652
     1653#ifdef __WIN32OS2__
     1654  st->print(", swap %uk", ms.dwTotalPageFile >> 10);
     1655  st->print("(%uk free)", ms.dwAvailPageFile >> 10);
     1656#else   
    16051657  st->print(", swap %uk", ms.ullTotalPageFile >> 10);
    16061658  st->print("(%uk free)", ms.ullAvailPageFile >> 10);
     1659#endif
    16071660  st->cr();
    16081661}
     
    24502503}
    24512504
     2505#ifndef __WIN32OS2__
     2506
    24522507// Windows large page support is available on Windows 2003. In order to use
    24532508// large page memory, the administrator must first assign additional privilege
     
    25552610}
    25562611
     2612#endif // ifndef __WIN32OS2__
     2613
    25572614bool os::large_page_init() {
    25582615  if (!UseLargePages) return false;
     
    25642621
    25652622# define WARN(msg) if (warn_on_failure) { warning(msg); }
     2623
     2624#ifdef __WIN32OS2__
     2625    WARN("Large page is not supported by the operating system.");
     2626#else
    25662627  if (resolve_functions_for_large_page_init()) {
    25672628    if (request_lock_memory_privilege()) {
     
    26012662
    26022663  cleanup_after_large_page_init();
     2664#endif // ifdef __WIN32OS2__
     2665
    26032666  return success;
    26042667}
     
    26392702
    26402703size_t os::large_page_size() {
     2704#ifdef __WIN32OS2__
     2705  return 0;
     2706#else
    26412707  return _large_page_size;
     2708#endif
    26422709}
    26432710
     
    26572724  const DWORD prot = exec ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
    26582725
     2726#ifndef __WIN32OS2__
    26592727  if (UseLargePagesIndividualAllocation) {
    26602728    if (TracePageSizes && Verbose) {
     
    27512819    return res;
    27522820  }
     2821#else // ifndef __WIN32OS2__
     2822  // normal policy just allocate it all at once
     2823  DWORD flag = MEM_RESERVE | MEM_COMMIT;
     2824  char * res = (char *)VirtualAlloc(NULL, bytes, flag, prot);
     2825  return res;
     2826#endif // ifndef __WIN32OS2__
    27532827}
    27542828
     
    31583232  _processor_count = si.dwNumberOfProcessors;
    31593233
     3234#ifdef __WIN32OS2__
     3235  MEMORYSTATUS ms;
     3236  ms.dwLength = sizeof(ms);
     3237
     3238  GlobalMemoryStatus(&ms);
     3239  _physical_memory = ms.dwTotalPhys;
     3240#else   
    31603241  MEMORYSTATUSEX ms;
    31613242  ms.dwLength = sizeof(ms);
     
    31653246  GlobalMemoryStatusEx(&ms);
    31663247  _physical_memory = ms.ullTotalPhys;
     3248#endif
    31673249
    31683250  OSVERSIONINFO oi;
     
    32533335  void *code_ptr = (void *)code;
    32543336  __try {
     3337#ifdef __EMX__
     3338    __asm__("call *%0" : : "m"(code_ptr));
     3339#else
    32553340    __asm call code_ptr
     3341#endif
    32563342  } __except(nx_exception_filter((_EXCEPTION_POINTERS*)_exception_info())) {
    32573343    tty->print_raw_cr("NX protection detected.");
     
    32833369  // Initialize main_process and main_thread
    32843370  main_process = GetCurrentProcess();  // Remember main_process is a pseudo handle
    3285  if (!DuplicateHandle(main_process, GetCurrentThread(), main_process,
     3371  if (!DuplicateHandle(main_process, GetCurrentThread(), main_process,
    32863372                       &main_thread, THREAD_ALL_ACCESS, false, 0)) {
    32873373    fatal("DuplicateHandle failed\n");
     
    33493435#ifndef  _WIN64
    33503436    static long fp_control_word = 0;
     3437#ifdef __EMX__
     3438    __asm__("fstcw %0" : "=m"(fp_control_word));
     3439#else
    33513440    __asm { fstcw fp_control_word }
     3441#endif   
    33523442    // see Intel PPro Manual, Vol. 2, p 7-16
    33533443    const long precision = 0x20;
     
    33583448    const long invalid   = 0x01;
    33593449    fp_control_word |= invalid;
     3450#ifdef __EMX__
     3451    __asm__("fldcw %0" : : "m"(fp_control_word));
     3452#else
    33603453    __asm { fldcw fp_control_word }
     3454#endif
    33613455#endif
    33623456  }
  • trunk/openjdk/hotspot/src/os/windows/vm/perfMemory_windows.cpp

    r2 r58  
    218218  }
    219219
     220#ifndef __WIN32OS2__
    220221  if (fa & FILE_ATTRIBUTE_REPARSE_POINT) {
    221222    // we don't accept any redirection for the user specific directory
     
    229230    return false;
    230231  }
     232#endif
    231233
    232234  if (fa & FILE_ATTRIBUTE_DIRECTORY) {
     
    566568  }
    567569
     570#ifndef __WIN32OS2__
    568571  if ((flags & FS_PERSISTENT_ACLS) == 0) {
    569572    // file system doesn't support ACLs, declare file system unsafe
     
    583586    return false;
    584587  }
     588#endif
    585589
    586590  return true;
     
    744748  if (lpSA != NULL) {
    745749    // free the contained security descriptor and the ACL
    746     free_security_desc(lpSA->lpSecurityDescriptor);
     750    free_security_desc((PSECURITY_DESCRIPTOR)lpSA->lpSecurityDescriptor);
    747751    lpSA->lpSecurityDescriptor = NULL;
    748752
     
    801805
    802806  DWORD nbytes = GetLengthSid(token_buf->User.Sid);
    803   PSID pSID = NEW_C_HEAP_ARRAY(char, nbytes);
     807  PSID pSID = (PSID)NEW_C_HEAP_ARRAY(char, nbytes);
    804808
    805809  if (!CopySid(nbytes, pSID, token_buf->User.Sid)) {
     
    926930      int matches = 0;
    927931      for (int i = 0; i < ace_count; i++) {
    928         if (EqualSid(aces[i].pSid, &(((ACCESS_ALLOWED_ACE *)ace)->SidStart))) {
     932        if (EqualSid(aces[i].pSid, (PSID)&(((ACCESS_ALLOWED_ACE *)ace)->SidStart))) {
    929933          matches++;
    930934          break;
     
    995999  }
    9961000
     1001#ifndef __WIN32OS2__
    9971002  // if running on windows 2000 or later, set the automatic inheritance
    9981003  // control flags.
     
    10151020    }
    10161021  }
     1022#endif 
    10171023   // Note, the security descriptor maintains a reference to the newACL, not
    10181024   // a copy of it. Therefore, the newACL is not freed here. It is freed when
     
    12261232      // DACLs might fix the corrupted the DACLs.
    12271233      SECURITY_INFORMATION secInfo = DACL_SECURITY_INFORMATION;
    1228       if (!SetFileSecurity(dirname, secInfo, pDirSA->lpSecurityDescriptor)) {
     1234      if (!SetFileSecurity(dirname, secInfo,
     1235                          (PSECURITY_DESCRIPTOR)pDirSA->lpSecurityDescriptor)) {
    12291236        if (PrintMiscellaneous && Verbose) {
    12301237          lasterror = GetLastError();
Note: See TracChangeset for help on using the changeset viewer.