summaryrefslogtreecommitdiffhomepage
path: root/test/util/signal_util.h
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-01-30 16:12:25 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-30 16:12:25 -0800
commitaf8f6f83a32f0128abd8bbf3eb6302078e447a7b (patch)
treec15332205a316f8aa71f1d07b5d5f66a620b025d /test/util/signal_util.h
parent9988cf2eeff596ce519046d80c54d09166f7d84b (diff)
parent82ae857877fdf3492f40bca87657a07892c3f59b (diff)
Merge pull request #1471 from xiaobo55x:syscall_test
PiperOrigin-RevId: 292445329
Diffstat (limited to 'test/util/signal_util.h')
-rw-r--r--test/util/signal_util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/util/signal_util.h b/test/util/signal_util.h
index bcf85c337..e7b66aa51 100644
--- a/test/util/signal_util.h
+++ b/test/util/signal_util.h
@@ -85,6 +85,20 @@ inline void FixupFault(ucontext_t* ctx) {
// The encoding is 0x48 0xab 0x00.
ctx->uc_mcontext.gregs[REG_RIP] += 3;
}
+#elif __aarch64__
+inline void Fault() {
+ // Zero and dereference x0.
+ asm("mov xzr, x0\r\n"
+ "str xzr, [x0]\r\n"
+ :
+ :
+ : "x0");
+}
+
+inline void FixupFault(ucontext_t* ctx) {
+ // Skip the bad instruction above.
+ ctx->uc_mcontext.pc += 4;
+}
#endif
} // namespace testing