summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/exceptions.cc
diff options
context:
space:
mode:
authorGoogler <noreply@google.com>2019-02-06 16:59:32 -0800
committerShentubot <shentubot@google.com>2019-02-06 17:00:24 -0800
commit3c71e025e83f1684eec9517f64d0d8a7a0608191 (patch)
tree561e9629c7ee479c7ea8c6a156e367fdfe42661f /test/syscalls/linux/exceptions.cc
parent0cf7fc4e115c2dcc40901c44b238ab36b5d966fc (diff)
Internal change.
PiperOrigin-RevId: 232776481 Change-Id: Ic19d4aa6322fef71621bad0e9fb8bdedf6694114
Diffstat (limited to 'test/syscalls/linux/exceptions.cc')
-rw-r--r--test/syscalls/linux/exceptions.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/syscalls/linux/exceptions.cc b/test/syscalls/linux/exceptions.cc
index 72ab354e3..3f0aa8bf1 100644
--- a/test/syscalls/linux/exceptions.cc
+++ b/test/syscalls/linux/exceptions.cc
@@ -25,24 +25,28 @@ namespace testing {
void inline Halt() { asm("hlt\r\n"); }
void inline SetAlignmentCheck() {
- asm("pushf\r\n"
+ asm("subq $128, %%rsp\r\n" // Avoid potential red zone clobber
+ "pushf\r\n"
"pop %%rax\r\n"
"or $0x40000, %%rax\r\n"
"push %%rax\r\n"
"popf\r\n"
+ "addq $128, %%rsp\r\n"
:
:
: "ax");
}
void inline ClearAlignmentCheck() {
- asm("pushf\r\n"
+ asm("subq $128, %%rsp\r\n" // Avoid potential red zone clobber
+ "pushf\r\n"
"pop %%rax\r\n"
"mov $0x40000, %%rbx\r\n"
"not %%rbx\r\n"
"and %%rbx, %%rax\r\n"
"push %%rax\r\n"
"popf\r\n"
+ "addq $128, %%rsp\r\n"
:
:
: "ax", "bx");