[PATCH kvmtool v2 1/7] x86: Define bioscall only in 32-bit mode

Alexandru Elisei alexandru.elisei at arm.com
Thu Jun 18 08:49:55 PDT 2026


The gcc online docs define the behaviour of the regparm attribute for
x86-32 targets [1], and there's no mention of the behaviour for the 64-bit
version of the architecure.

gcc version 16.1 throws this error when compiling for x86-64:

x86/include/kvm/bios.h:91:43: error: ‘regparm’ attribute ignored [-Werror=attributes]
   91 | extern bioscall void int10_handler(struct biosregs *regs);
      |                                           ^~~~~~~~

but there's no such error with gcc version 14.2.

This patch author assumes that somewhere between gcc 14.2 and 16.1 the
compiler behaviour was modified to treat the regparm attribute on x86_64
as unused. Fix the compilation error by using it only for the 32-bit
version of the x86 architecture.

[1] https://gcc.gnu.org/onlinedocs/gcc-16.1.0/gcc/x86-Attributes.html#index-regparm_002c-x86

Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
 x86/include/kvm/bios.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/x86/include/kvm/bios.h b/x86/include/kvm/bios.h
index 6f4338d50717..76beb2e0a46b 100644
--- a/x86/include/kvm/bios.h
+++ b/x86/include/kvm/bios.h
@@ -62,11 +62,15 @@
 #define MB_BIOS_SS			0xfff7
 #define MB_BIOS_SP			0x40
 
+#ifdef CONFIG_X86_32
 /*
  * When interfere with assembler code we need to be sure how
  * arguments are passed in real mode.
  */
 #define bioscall __attribute__((regparm(3)))
+#else
+#define bioscall
+#endif
 
 #ifndef __ASSEMBLER__
 
-- 
2.54.0




More information about the linux-arm-kernel mailing list