瀏覽代碼

[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 年之前
父節點
當前提交
5992881c46
共有 1 個文件被更改,包括 3 次插入0 次删除
  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)