Browse Source

[Pal/Linux-SGX] Clear RFLAGS before calling _DkExceptionHandler

This is follow up of https://github.com/oscarlab/graphene/pull/643
RFLAGS.DF must be cleared when calling a C function.
Isaku Yamahata 6 years ago
parent
commit
5992881c46
1 changed files with 3 additions and 0 deletions
  1. 3 0
      Pal/src/host/Linux-SGX/enclave_entry.S

+ 3 - 0
Pal/src/host/Linux-SGX/enclave_entry.S

@@ -230,6 +230,9 @@ enclave_entry:
 	andq $STACK_ALIGN, %rsi
 	movq %rsi, SGX_GPR_RSP(%rbx)
 
+	# clear rflags to conform the ABI which requires RFLAGS.DF = 0
+	movq $0, SGX_GPR_RFLAGS(%rbx)
+
 	# new RIP is the exception handler
 	leaq _DkExceptionHandler(%rip), %rdi
 	movq %rdi, SGX_GPR_RIP(%rbx)