< prev index next >
src/cpu/x86/vm/debug_x86.cpp
Print this page
rev 7424 : improve secondary signal handling
*** 30,34 ****
--- 30,56 ----
#include "runtime/os.hpp"
#include "utilities/debug.hpp"
#include "utilities/top.hpp"
void pd_ps(frame f) {}
+
+ #ifndef PRODUCT
+ // return an instruction which will generate a SIGILL
+ bool get_illegal_instruction_sequence(uint8_t buf[8]) {
+ const uint8_t sequence[] = {
+ #if defined(AMD64)
+ // 06 => invalid instruction for x64
+ 0x06
+ #else
+ // Note: privileged instructions won't work, because they cause a SIGSEGV
+ // on Linux, not a SIGILL. "0f 0e" and "0f 0f" are invalid opcodes which
+ // will cause real SIGILL resp. EXCEPTION_ILLEGAL_INSTRUCTION.
+ 0x0f, 0x0f,
+ // in case this does not work, use a HLT which should be privilegued.
+ 0xF4
+ #endif
+ };
+ memcpy(buf, sequence, sizeof(sequence));
+ return true;
+ }
+ #endif
+
< prev index next >