[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180607183219.192973-3-ndesaulniers@google.com>
Date: Thu, 7 Jun 2018 11:32:18 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: akpm@...ux-foundation.org, hpa@...or.com, mingo@...hat.com,
tglx@...utronix.de
Cc: linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, virtualization@...ts.linux-foundation.org,
astrachan@...gle.com, manojgupta@...gle.com, ghackmann@...gle.com,
sedat.dilek@...il.com, tstellar@...hat.com, keescook@...gle.com,
yamada.masahiro@...ionext.com, michal.lkml@...kovi.net,
linux-kbuild@...r.kernel.org, geert@...ux-m68k.org,
will.deacon@....com, mawilcox@...rosoft.com, arnd@...db.de,
rientjes@...gle.com, acme@...hat.com, pombredanne@...b.com,
aryabinin@...tuozzo.com, kstewart@...uxfoundation.org,
boris.ostrovsky@...cle.com, jan.kiszka@...mens.com,
rostedt@...dmis.org, kirill.shutemov@...ux.intel.com,
ard.biesheuvel@...aro.org, akataria@...are.com,
brijesh.singh@....com, caoj.fnst@...fujitsu.com,
gregkh@...uxfoundation.org, jarkko.sakkinen@...ux.intel.com,
jgross@...e.com, jpoimboe@...hat.com, mka@...omium.org,
ndesaulniers@...gle.com, thomas.lendacky@....com, tweek@...gle.com,
mjg59@...gle.com, joe@...ches.com,
"H. Peter Anvin" <hpa@...ux.intel.com>
Subject: [PATCH v3 2/3] x86/asm: add _ASM_ARG* constants for argument registers to <asm/asm.h>
From: "H. Peter Anvin" <hpa@...ux.intel.com>
i386 and x86-64 uses different registers for arguments; make them
available so we don't have to #ifdef in the actual code.
Native size and specified size (q, l, w, b) versions are provided.
Suggested-by: Sedat Dilek <sedat.dilek@...il.com>
Signed-off-by: H. Peter Anvin <hpa@...ux.intel.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
---
arch/x86/include/asm/asm.h | 59 ++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 219faaec51df..990770f9e76b 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -46,6 +46,65 @@
#define _ASM_SI __ASM_REG(si)
#define _ASM_DI __ASM_REG(di)
+#ifndef __x86_64__
+/* 32 bit */
+
+#define _ASM_ARG1 _ASM_AX
+#define _ASM_ARG2 _ASM_DX
+#define _ASM_ARG3 _ASM_CX
+
+#define _ASM_ARG1L eax
+#define _ASM_ARG2L edx
+#define _ASM_ARG3L ecx
+
+#define _ASM_ARG1W ax
+#define _ASM_ARG2W dx
+#define _ASM_ARG3W cx
+
+#define _ASM_ARG1B al
+#define _ASM_ARG2B dl
+#define _ASM_ARG3B cl
+
+#else
+/* 64 bit */
+
+#define _ASM_ARG1 _ASM_DI
+#define _ASM_ARG2 _ASM_SI
+#define _ASM_ARG3 _ASM_DX
+#define _ASM_ARG4 _ASM_CX
+#define _ASM_ARG5 r8
+#define _ASM_ARG6 r9
+
+#define _ASM_ARG1Q rdi
+#define _ASM_ARG2Q rsi
+#define _ASM_ARG3Q rdx
+#define _ASM_ARG4Q rcx
+#define _ASM_ARG5Q r8
+#define _ASM_ARG6Q r9
+
+#define _ASM_ARG1L edi
+#define _ASM_ARG2L esi
+#define _ASM_ARG3L edx
+#define _ASM_ARG4L ecx
+#define _ASM_ARG5L r8d
+#define _ASM_ARG6L r9d
+
+#define _ASM_ARG1W di
+#define _ASM_ARG2W si
+#define _ASM_ARG3W dx
+#define _ASM_ARG4W cx
+#define _ASM_ARG5W r8w
+#define _ASM_ARG6W r9w
+
+#define _ASM_ARG1B dil
+#define _ASM_ARG2B sil
+#define _ASM_ARG3B dl
+#define _ASM_ARG4B cl
+#define _ASM_ARG5B r8b
+#define _ASM_ARG6B r9b
+
+#endif
+
/*
* Macros to generate condition code outputs from inline assembly,
* The output operand must be type "bool".
--
2.17.1.1185.g55be947832-goog
Powered by blists - more mailing lists