gregkh at linuxfoundation.org
2018-Jul-18 09:34 UTC
Patch "x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>" has been added to the 4.17-stable tree
This is a note to let you know that I've just added the patch titled
x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
to the 4.17-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-asm-add-_asm_arg-constants-for-argument-registers-to-asm-asm.h.patch
and it can be found in the queue-4.17 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.
>From 0e2e160033283e20f688d8bad5b89460cc5bfcc4 Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" <hpa at linux.intel.com>
Date: Thu, 21 Jun 2018 09:23:23 -0700
Subject: x86/asm: Add _ASM_ARG* constants for argument registers to
<asm/asm.h>
From: H. Peter Anvin <hpa at linux.intel.com>
commit 0e2e160033283e20f688d8bad5b89460cc5bfcc4 upstream.
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.
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
Signed-off-by: Nick Desaulniers <ndesaulniers at google.com>
Reviewed-by: Sedat Dilek <sedat.dilek at gmail.com>
Acked-by: Juergen Gross <jgross at suse.com>
Cc: Linus Torvalds <torvalds at linux-foundation.org>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: acme at redhat.com
Cc: akataria at vmware.com
Cc: akpm at linux-foundation.org
Cc: andrea.parri at amarulasolutions.com
Cc: ard.biesheuvel at linaro.org
Cc: arnd at arndb.de
Cc: aryabinin at virtuozzo.com
Cc: astrachan at google.com
Cc: boris.ostrovsky at oracle.com
Cc: brijesh.singh at amd.com
Cc: caoj.fnst at cn.fujitsu.com
Cc: geert at linux-m68k.org
Cc: ghackmann at google.com
Cc: gregkh at linuxfoundation.org
Cc: jan.kiszka at siemens.com
Cc: jarkko.sakkinen at linux.intel.com
Cc: joe at perches.com
Cc: jpoimboe at redhat.com
Cc: keescook at google.com
Cc: kirill.shutemov at linux.intel.com
Cc: kstewart at linuxfoundation.org
Cc: linux-efi at vger.kernel.org
Cc: linux-kbuild at vger.kernel.org
Cc: manojgupta at google.com
Cc: mawilcox at microsoft.com
Cc: michal.lkml at markovi.net
Cc: mjg59 at google.com
Cc: mka at chromium.org
Cc: pombredanne at nexb.com
Cc: rientjes at google.com
Cc: rostedt at goodmis.org
Cc: thomas.lendacky at amd.com
Cc: tstellar at redhat.com
Cc: tweek at google.com
Cc: virtualization at lists.linux-foundation.org
Cc: will.deacon at arm.com
Cc: yamada.masahiro at socionext.com
Link: http://lkml.kernel.org/r/20180621162324.36656-3-ndesaulniers at google.com
Signed-off-by: Ingo Molnar <mingo at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
arch/x86/include/asm/asm.h | 59 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
--- 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".
Patches currently in stable-queue which might be from hpa at linux.intel.com are
queue-4.17/x86-asm-add-_asm_arg-constants-for-argument-registers-to-asm-asm.h.patch
Apparently Analagous Threads
- [PATCH 4.17 002/101] x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
- Patch "x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>" has been added to the 4.4-stable tree
- Patch "x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>" has been added to the 4.14-stable tree
- Patch "x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>" has been added to the 4.9-stable tree
- [PATCH 4.4 05/31] x86/asm: Add _ASM_ARG* constants for argument registers to <asm/asm.h>
