hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
changeset 46619 a3919f5e8d2b
parent 46618 d503911aa948
child 46625 edefffab74e2
equal deleted inserted replaced
46618:d503911aa948 46619:a3919f5e8d2b
   532     //
   532     //
   533     // 15 bytes seems to be a (very) safe value for max instruction size.
   533     // 15 bytes seems to be a (very) safe value for max instruction size.
   534     bool pc_is_near_addr =
   534     bool pc_is_near_addr =
   535       (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15);
   535       (pointer_delta((void*) addr, (void*) pc, sizeof(char)) < 15);
   536     bool instr_spans_page_boundary =
   536     bool instr_spans_page_boundary =
   537       (align_size_down((intptr_t) pc ^ (intptr_t) addr,
   537       (align_down((intptr_t) pc ^ (intptr_t) addr,
   538                        (intptr_t) page_size) > 0);
   538                        (intptr_t) page_size) > 0);
   539 
   539 
   540     if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) {
   540     if (pc == addr || (pc_is_near_addr && instr_spans_page_boundary)) {
   541       static volatile address last_addr =
   541       static volatile address last_addr =
   542         (address) os::non_memory_address_word();
   542         (address) os::non_memory_address_word();
   544       // In conservative mode, don't unguard unless the address is in the VM
   544       // In conservative mode, don't unguard unless the address is in the VM
   545       if (addr != last_addr &&
   545       if (addr != last_addr &&
   546           (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) {
   546           (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) {
   547 
   547 
   548         // Set memory to RWX and retry
   548         // Set memory to RWX and retry
   549         address page_start = align_ptr_down(addr, page_size);
   549         address page_start = align_down(addr, page_size);
   550         bool res = os::protect_memory((char*) page_start, page_size,
   550         bool res = os::protect_memory((char*) page_start, page_size,
   551                                       os::MEM_PROT_RWX);
   551                                       os::MEM_PROT_RWX);
   552 
   552 
   553         log_debug(os)("Execution protection violation "
   553         log_debug(os)("Execution protection violation "
   554                       "at " INTPTR_FORMAT
   554                       "at " INTPTR_FORMAT