Internal change.

PiperOrigin-RevId: 232776481
Change-Id: Ic19d4aa6322fef71621bad0e9fb8bdedf6694114
This commit is contained in:
Googler
2019-02-06 17:00:24 -08:00
committed by Shentubot
parent 0cf7fc4e11
commit 3c71e025e8
+6 -2
View File
@@ -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");