The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 966bbfa5f24f601593a0890154e3fb5fddc51e6e
Gitweb: https://git.kernel.org/tip/966bbfa5f24f601593a0890154e3fb5fddc51e6e
Author: David Laight <david.laight.linux@gmail.com>
AuthorDate: Mon, 03 Aug 2026 10:47:02 +01:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Wed, 23 Sep 2026 13:16:13 -07:00
x86/local: Support large immediate values in local_(add|sub)()
Replace the "ir" constraint with "er" so that constants over 2^31 get loaded
into a register due to ADD/SUB supporting only 32-bit signed immediates.
[ bp: Massage commit message. ]
Signed-off-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260803094702.3852-3-david.laight.linux@gmail.com
---
arch/x86/include/asm/local.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
index 4957018..68af7b7 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -32,14 +32,14 @@ static inline void local_add(long i, local_t *l)
{
asm volatile(_ASM_ADD "%1,%0"
: "+m" (l->a.counter)
- : "ir" (i));
+ : "er" (i));
}
static inline void local_sub(long i, local_t *l)
{
asm volatile(_ASM_SUB "%1,%0"
: "+m" (l->a.counter)
- : "ir" (i));
+ : "er" (i));
}
/**