hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
changeset 37430 fd743dadef12
parent 35201 996db89f378e
child 38133 78b95467b9f1
equal deleted inserted replaced
37428:6e724f3d488b 37430:fd743dadef12
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   285   if (sig == SIGPIPE || sig == SIGXFSZ) {
   285   if (sig == SIGPIPE || sig == SIGXFSZ) {
   286     // allow chained handler to go first
   286     // allow chained handler to go first
   287     if (os::Linux::chained_handler(sig, info, ucVoid)) {
   287     if (os::Linux::chained_handler(sig, info, ucVoid)) {
   288       return true;
   288       return true;
   289     } else {
   289     } else {
   290       if (PrintMiscellaneous && (WizardMode || Verbose)) {
   290       // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
   291         char buf[64];
       
   292         warning("Ignoring %s - see bugs 4229104 or 646499219",
       
   293                 os::exception_name(sig, buf, sizeof(buf)));
       
   294       }
       
   295       return true;
   291       return true;
   296     }
   292     }
   297   }
   293   }
   298 
   294 
   299   JavaThread* thread = NULL;
   295   JavaThread* thread = NULL;
   540         address page_start =
   536         address page_start =
   541           (address) align_size_down((intptr_t) addr, (intptr_t) page_size);
   537           (address) align_size_down((intptr_t) addr, (intptr_t) page_size);
   542         bool res = os::protect_memory((char*) page_start, page_size,
   538         bool res = os::protect_memory((char*) page_start, page_size,
   543                                       os::MEM_PROT_RWX);
   539                                       os::MEM_PROT_RWX);
   544 
   540 
   545         if (PrintMiscellaneous && Verbose) {
   541         log_debug(os)("Execution protection violation "
   546           char buf[256];
   542                       "at " INTPTR_FORMAT
   547           jio_snprintf(buf, sizeof(buf), "Execution protection violation "
   543                       ", unguarding " INTPTR_FORMAT ": %s, errno=%d", p2i(addr),
   548                        "at " INTPTR_FORMAT
   544                       p2i(page_start), (res ? "success" : "failed"), errno);
   549                        ", unguarding " INTPTR_FORMAT ": %s, errno=%d", addr,
       
   550                        page_start, (res ? "success" : "failed"), errno);
       
   551           tty->print_raw_cr(buf);
       
   552         }
       
   553         stub = pc;
   545         stub = pc;
   554 
   546 
   555         // Set last_addr so if we fault again at the same address, we don't end
   547         // Set last_addr so if we fault again at the same address, we don't end
   556         // up in an endless loop.
   548         // up in an endless loop.
   557         //
   549         //
   643   if( uname(&uts) != 0 ) return false; // uname fails?
   635   if( uname(&uts) != 0 ) return false; // uname fails?
   644   char *minor_string;
   636   char *minor_string;
   645   int major = strtol(uts.release,&minor_string,10);
   637   int major = strtol(uts.release,&minor_string,10);
   646   int minor = strtol(minor_string+1,NULL,10);
   638   int minor = strtol(minor_string+1,NULL,10);
   647   bool result = (major > 2 || (major==2 && minor >= 4));
   639   bool result = (major > 2 || (major==2 && minor >= 4));
   648 #ifndef PRODUCT
   640   log_info(os)("OS version is %d.%d, which %s support SSE/SSE2",
   649   if (PrintMiscellaneous && Verbose) {
       
   650     tty->print("OS version is %d.%d, which %s support SSE/SSE2\n",
       
   651                major,minor, result ? "DOES" : "does NOT");
   641                major,minor, result ? "DOES" : "does NOT");
   652   }
       
   653 #endif
       
   654   return result;
   642   return result;
   655 #endif // AMD64
   643 #endif // AMD64
   656 }
   644 }
   657 
   645 
   658 bool os::is_allocatable(size_t bytes) {
   646 bool os::is_allocatable(size_t bytes) {
   937     return; // No matter, we tried, best effort.
   925     return; // No matter, we tried, best effort.
   938   }
   926   }
   939 
   927 
   940   MemTracker::record_virtual_memory_type((address)codebuf, mtInternal);
   928   MemTracker::record_virtual_memory_type((address)codebuf, mtInternal);
   941 
   929 
   942   if (PrintMiscellaneous && (Verbose || WizardMode)) {
   930   log_info(os)("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
   943      tty->print_cr("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
       
   944   }
       
   945 
   931 
   946   // Some code to exec: the 'ret' instruction
   932   // Some code to exec: the 'ret' instruction
   947   codebuf[0] = 0xC3;
   933   codebuf[0] = 0xC3;
   948 
   934 
   949   // Call the code in the codebuf
   935   // Call the code in the codebuf