linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/vdso: Use named constant for ENCLU leaves
@ 2020-03-19 20:51 Jarkko Sakkinen
  2020-03-19 21:20 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Jarkko Sakkinen @ 2020-03-19 20:51 UTC (permalink / raw)
  To: linux-sgx; +Cc: Jarkko Sakkinen, Sean Christopherson

Rather than using magic numbers and a comment, replace the magic
numbers with named constants.

Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
Already pushed (as is RSA key generation). Just something noted when
going through 2/8 patch.
 arch/x86/entry/vdso/vsgx_enter_enclave.S | 5 +++--
 arch/x86/include/asm/enclu.h             | 8 ++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/include/asm/enclu.h

diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S
index 22a22e0774d8..7c01a629dc7e 100644
--- a/arch/x86/entry/vdso/vsgx_enter_enclave.S
+++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S
@@ -3,6 +3,7 @@
 #include <linux/linkage.h>
 #include <asm/export.h>
 #include <asm/errno.h>
+#include <asm/enclu.h>
 
 #include "extable.h"
 
@@ -85,9 +86,9 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
 
 .Lenter_enclave:
 	/* EENTER <= leaf <= ERESUME */
-	cmp	$0x2, %eax
+	cmp	EENTER, %eax
 	jb	.Linvalid_leaf
-	cmp	$0x3, %eax
+	cmp	ERESUME, %eax
 	ja	.Linvalid_leaf
 
 	/* Load TCS and AEP */
diff --git a/arch/x86/include/asm/enclu.h b/arch/x86/include/asm/enclu.h
new file mode 100644
index 000000000000..06157b3e9ede
--- /dev/null
+++ b/arch/x86/include/asm/enclu.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_ENCLU_H
+#define _ASM_X86_ENCLU_H
+
+#define EENTER	0x02
+#define ERESUME	0x03
+
+#endif /* _ASM_X86_ENCLU_H */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-19 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 20:51 [PATCH] x86/vdso: Use named constant for ENCLU leaves Jarkko Sakkinen
2020-03-19 21:20 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).