Changeset 58


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
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp

    r2 r58  
    3030#define BUFFER_SIZE 30
    3131
    32 #ifdef _WINDOWS
     32#if defined(_WINDOWS) || defined(OS2)
    3333GetBooleanField_t JNI_FastGetField::jni_fast_GetBooleanField_fp;
    3434GetByteField_t    JNI_FastGetField::jni_fast_GetByteField_fp;
     
    110110  __ jcc (Assembler::notEqual, slow);
    111111
    112 #ifndef _WINDOWS
     112#if !defined(_WINDOWS) && !defined(__WIN32OS2__)
    113113  __ ret (0);
    114114#else
     
    132132  __ flush ();
    133133
    134 #ifndef _WINDOWS
     134#if !defined(_WINDOWS) && !defined(OS2)
    135135  return fast_entry;
    136136#else
     
    227227  __ pop (rsi);
    228228
    229 #ifndef _WINDOWS
     229#if !defined(_WINDOWS) && !defined(__WIN32OS2__)
    230230  __ ret (0);
    231231#else
     
    244244  __ flush ();
    245245
    246 #ifndef _WINDOWS
     246#if !defined(_WINDOWS) && !defined(OS2)
    247247  return fast_entry;
    248248#else
     
    321321  __ jcc (Assembler::notEqual, slow_with_pop);
    322322
    323 #ifndef _WINDOWS
     323#if !defined(_WINDOWS) && !defined(__WIN32OS2__)
    324324  __ ret (0);
    325325#else
     
    345345  __ flush ();
    346346
    347 #ifndef _WINDOWS
     347#if !defined(_WINDOWS) && !defined(OS2)
    348348  return fast_entry;
    349349#else
  • 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();
  • trunk/openjdk/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp

    r2 r58  
    5858    if ( ThreadLocalStorage::get_thread_ptr_offset() == 0 ) {
    5959      int thread_ptr_offset;
     60#ifdef __EMX__
     61      __asm__("leal %1, %%eax; "
     62              "subl %%fs:0, %%eax; "
     63              "movl %%eax, %0; "
     64              : "=m"(thread_ptr_offset) : "m"(wrapperthread) : "%eax");
     65#else
    6066      __asm {
    6167        lea eax, dword ptr wrapperthread;
     
    6369        mov thread_ptr_offset, eax
    6470      };
     71#endif     
    6572      ThreadLocalStorage::set_thread_ptr_offset(thread_ptr_offset);
    6673    }
     
    7178    else {
    7279      int test_thread_ptr_offset;
     80#ifdef __EMX__
     81      __asm__("leal %1, %%eax; "
     82              "subl %%fs:0, %%eax; "
     83              "movl %%eax, %0; "
     84              : "=m"(test_thread_ptr_offset) : "m"(wrapperthread) : "%eax");
     85#else
    7386      __asm {
    7487        lea eax, dword ptr wrapperthread;
     
    7689        mov test_thread_ptr_offset, eax
    7790      };
     91#endif
    7892      assert(test_thread_ptr_offset == ThreadLocalStorage::get_thread_ptr_offset(),
    7993             "thread pointer offset from SEH changed");
     
    340354intptr_t* _get_previous_fp() {
    341355  intptr_t **frameptr;
     356#ifdef __EMX__
     357  __asm("movl %%ebp, %0" : "=m"(frameptr));
     358#else
    342359  __asm {
    343360    mov frameptr, ebp
    344361  };
     362#endif 
    345363  return *frameptr;
    346364}
     
    423441extern "C" int SafeFetch32 (int * adr, int Err) {
    424442   int rv = Err ;
    425    _try {
     443   __try {
    426444       rv = *((volatile int *) adr) ;
    427445   } __except(EXCEPTION_EXECUTE_HANDLER) {
     
    432450extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t Err) {
    433451   intptr_t rv = Err ;
    434    _try {
     452   __try {
    435453       rv = *((volatile intptr_t *) adr) ;
    436454   } __except(EXCEPTION_EXECUTE_HANDLER) {
     
    446464   // On systems that don't support pause a rep:nop
    447465   // is executed as a nop.  The rep: prefix is ignored.
     466#ifdef __EMX__
     467   __asm__("pause; ");
     468#else
    448469   _asm {
    449470      pause ;
    450471   };
     472#endif
    451473   return 1 ;
    452474#endif // AMD64
     
    457479#ifndef AMD64
    458480  int fpu_cntrl_word = StubRoutines::fpu_cntrl_wrd_std();
     481#ifdef __EMX__
     482  __asm__("fldcw %0; " : : "m"(fpu_cntrl_word));
     483#else 
    459484  __asm fldcw fpu_cntrl_word;
     485#endif 
    460486#endif // !AMD64
    461487}
  • trunk/openjdk/hotspot/src/share/vm/prims/forte.cpp

    r2 r58  
    618618
    619619
    620 #ifndef _WINDOWS
     620#if !defined(_WINDOWS) && !defined(OS2)
    621621// Support for the Forte(TM) Peformance Tools collector.
    622622//
     
    637637#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \
    638638        ( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),0 : 0 )
    639 #endif // !_WINDOWS
     639#endif // !_WINDOWS && !OS2
    640640
    641641} // end extern "C"
     
    643643
    644644void Forte::register_stub(const char* name, address start, address end) {
    645 #if !defined(_WINDOWS) && !defined(IA64)
     645#if !defined(_WINDOWS) && !defined(OS2) && !defined(IA64)
    646646  assert(pointer_delta(end, start, sizeof(jbyte)) < INT_MAX,
    647647    "Code size exceeds maximum range")
     
    649649  collector_func_load((char*)name, NULL, NULL, start,
    650650    pointer_delta(end, start, sizeof(jbyte)), 0, NULL);
    651 #endif // !_WINDOWS && !IA64
    652 }
     651#endif // !_WINDOWS && !OS2 && !IA64
     652}
  • trunk/openjdk/hotspot/src/share/vm/prims/jniFastGetField.hpp

    r2 r58  
    6161
    6262 public:
    63 #if defined(_WINDOWS) && !defined(_WIN64)
     63#if (defined(_WINDOWS) && !defined(_WIN64)) || defined(OS2)
    6464  static GetBooleanField_t jni_fast_GetBooleanField_fp;
    6565  static GetByteField_t    jni_fast_GetByteField_fp;
  • trunk/openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp

    r51 r58  
    8282
    8383#ifdef OS2
     84#include <sys/types.h>
    8485#ifdef __WIN32OS2__
    8586#include <excpt.h>
     87// compiler's select() would conflict with Winsock
     88#define select __io_select
    8689#include <io.h>
     90#undef select
     91#ifdef __EMX__
     92// we disable BSD visibility for the compiler so define these manually
     93int     finite(double) __pure2;
     94int     isnanf(float) __pure2;
     95#define S_IREAD     S_IRUSR
     96#define S_IWRITE    S_IWUSR
     97#define S_IEXEC     S_IXUSR
     98#include <alloca.h> // <stdlib.h> defines alloca only in BSD mode
     99#endif
     100#else // __WIN32OS2__
     101#include <io.h>
     102#endif // __WIN32OS2__
     103#ifdef __EMX__
     104#include <strings.h> // strcasecmp()
     105// EMX doesn't provide some ANSI declarations
     106#define _alloca     alloca
     107#define _fileno     fileno
     108#define _O_BINARY   O_BINARY
     109#define _O_TEXT     O_TEXT
     110#define _O_CREAT    O_CREAT
     111#define _O_TRUNC    O_TRUNC
     112#define _O_EXCL     O_TRUNC
     113#define _O_WRONLY   O_WRONLY
     114#define _O_RDONLY   O_RDONLY
     115#define _O_RDWR     O_RDWR
     116#define _S_IREAD    S_IREAD
     117#define _S_IWRITE   S_IWRITE
     118#define _S_IEXEC    S_IEXEC
    87119#endif
    88120#endif // OS2
  • trunk/openjdk/hotspot/src/share/vm/utilities/ostream.cpp

    r2 r58  
    835835#endif
    836836
     837#ifdef __WIN32OS2__
     838#include <winsock.h>
     839#endif
     840
    837841// Network access
    838842networkStream::networkStream() : bufferedStream(1024*10, 1024*10) {
Note: See TracChangeset for help on using the changeset viewer.