src/os_cpu/linux_x86/vm/os_linux_x86.cpp

Print this page




 913   char* codebuf = os::reserve_memory(page_size, hint);
 914   if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) {
 915     return; // No matter, we tried, best effort.
 916   }
 917 
 918   MemTracker::record_virtual_memory_type((address)codebuf, mtInternal);
 919 
 920   if (PrintMiscellaneous && (Verbose || WizardMode)) {
 921      tty->print_cr("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
 922   }
 923 
 924   // Some code to exec: the 'ret' instruction
 925   codebuf[0] = 0xC3;
 926 
 927   // Call the code in the codebuf
 928   __asm__ volatile("call *%0" : : "r"(codebuf));
 929 
 930   // keep the page mapped so CS limit isn't reduced.
 931 #endif
 932 }







 913   char* codebuf = os::reserve_memory(page_size, hint);
 914   if ( (codebuf == NULL) || (!os::commit_memory(codebuf, page_size, true)) ) {
 915     return; // No matter, we tried, best effort.
 916   }
 917 
 918   MemTracker::record_virtual_memory_type((address)codebuf, mtInternal);
 919 
 920   if (PrintMiscellaneous && (Verbose || WizardMode)) {
 921      tty->print_cr("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
 922   }
 923 
 924   // Some code to exec: the 'ret' instruction
 925   codebuf[0] = 0xC3;
 926 
 927   // Call the code in the codebuf
 928   __asm__ volatile("call *%0" : : "r"(codebuf));
 929 
 930   // keep the page mapped so CS limit isn't reduced.
 931 #endif
 932 }
 933 
 934 int os::extra_bang_size_in_bytes() {
 935   // JDK-8050147 requires the full cache line bang for x86.
 936   return VM_Version::L1_line_size();
 937 }