2021-05-10 09:11:43

by H. Peter Anvin

[permalink] [raw]
Subject: [PATCH 2/3] x86/asm: add _ASM_BYTES() macro for a .byte ... opcode sequence

From: "H. Peter Anvin (Intel)" <[email protected]>

Make it easy to create a sequence of bytes that can be used in either
assembly proper on in a C asm() statement.

Signed-off-by: H. Peter Anvin (Intel) <[email protected]>
---
arch/x86/include/asm/asm.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index c80899ac0192..1a1e22297867 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -13,6 +13,8 @@
# define __ASM_FORM_COMMA(x, ...) " " __stringify(x,##__VA_ARGS__) ","
#endif

+#define _ASM_BYTES(x, ...) __ASM_FORM(.byte x,##__VA_ARGS__ ;)
+
#ifndef __x86_64__
/* 32 bit */
# define __ASM_SEL(a,b) __ASM_FORM(a)
--
2.31.1


2021-05-10 12:05:25

by tip-bot2 for Tony Luck

[permalink] [raw]
Subject: [tip: x86/asm] x86/asm: Add _ASM_BYTES() macro for a .byte ... opcode sequence

The following commit has been merged into the x86/asm branch of tip:

Commit-ID: d88be187a6e6f3a97dfa7ddc500bb9ca191b3772
Gitweb: https://git.kernel.org/tip/d88be187a6e6f3a97dfa7ddc500bb9ca191b3772
Author: H. Peter Anvin (Intel) <[email protected]>
AuthorDate: Mon, 10 May 2021 02:09:39 -07:00
Committer: Ingo Molnar <[email protected]>
CommitterDate: Mon, 10 May 2021 12:33:28 +02:00

x86/asm: Add _ASM_BYTES() macro for a .byte ... opcode sequence

Make it easy to create a sequence of bytes that can be used in either
assembly proper on in a C asm() statement.

Signed-off-by: H. Peter Anvin (Intel) <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
arch/x86/include/asm/asm.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 93aad0b..507a37a 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -13,6 +13,8 @@
# define __ASM_FORM_COMMA(x, ...) " " __stringify(x,##__VA_ARGS__) ","
#endif

+#define _ASM_BYTES(x, ...) __ASM_FORM(.byte x,##__VA_ARGS__ ;)
+
#ifndef __x86_64__
/* 32 bit */
# define __ASM_SEL(a,b) __ASM_FORM(a)