summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/004-SignalTest/signaltest.cc9
-rw-r--r--test/115-native-bridge/nativebridge.cc9
2 files changed, 12 insertions, 6 deletions
diff --git a/test/004-SignalTest/signaltest.cc b/test/004-SignalTest/signaltest.cc
index 34e331b901..6dd63551fd 100644
--- a/test/004-SignalTest/signaltest.cc
+++ b/test/004-SignalTest/signaltest.cc
@@ -62,9 +62,12 @@ static void signalhandler(int sig ATTRIBUTE_UNUSED, siginfo_t* info ATTRIBUTE_UN
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
struct sigcontext *sc = reinterpret_cast<struct sigcontext*>(&uc->uc_mcontext);
sc->pc += 4; // Skip instruction causing segv.
-#elif defined(__i386__) || defined(__x86_64__)
+#elif defined(__i386__)
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
uc->CTX_EIP += 3;
+#elif defined(__x86_64__)
+ struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
+ uc->CTX_EIP += 2;
#else
UNUSED(context);
#endif
@@ -97,9 +100,9 @@ extern "C" JNIEXPORT jint JNICALL Java_Main_testSignal(JNIEnv*, jclass) {
// On supported architectures we cause a real SEGV.
*go_away_compiler = 'a';
#elif defined(__x86_64__)
- // Cause a SEGV using an instruction known to be 3 bytes long to account for hardcoded jump
+ // Cause a SEGV using an instruction known to be 2 bytes long to account for hardcoded jump
// in the signal handler
- asm volatile("movl $0, %%eax;" "movb $1, (%%al);" : : : "%eax");
+ asm volatile("movl $0, %%eax;" "movb %%ah, (%%rax);" : : : "%eax");
#else
// On other architectures we simulate SEGV.
kill(getpid(), SIGSEGV);
diff --git a/test/115-native-bridge/nativebridge.cc b/test/115-native-bridge/nativebridge.cc
index 702e779bb1..948273abd5 100644
--- a/test/115-native-bridge/nativebridge.cc
+++ b/test/115-native-bridge/nativebridge.cc
@@ -206,9 +206,9 @@ static jint trampoline_Java_Main_testSignal(JNIEnv*, jclass) {
#if defined(__arm__) || defined(__i386__) || defined(__aarch64__)
*go_away_compiler = 'a';
#elif defined(__x86_64__)
- // Cause a SEGV using an instruction known to be 3 bytes long to account for hardcoded jump
+ // Cause a SEGV using an instruction known to be 2 bytes long to account for hardcoded jump
// in the signal handler
- asm volatile("movl $0, %%eax;" "movb $1, (%%al);" : : : "%eax");
+ asm volatile("movl $0, %%eax;" "movb %%ah, (%%rax);" : : : "%eax");
#else
// On other architectures we simulate SEGV.
kill(getpid(), SIGSEGV);
@@ -403,9 +403,12 @@ static bool nb_signalhandler(int sig, siginfo_t* info ATTRIBUTE_UNUSED, void* co
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
struct sigcontext *sc = reinterpret_cast<struct sigcontext*>(&uc->uc_mcontext);
sc->pc += 4; // Skip instruction causing segv & sigill.
-#elif defined(__i386__) || defined(__x86_64__)
+#elif defined(__i386__)
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
uc->CTX_EIP += 3;
+#elif defined(__x86_64__)
+ struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
+ uc->CTX_EIP += 2;
#else
UNUSED(context);
#endif