mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/boot: Remove x86_32 PIC using ebx workaround
@ 2022-11-04 12:45 Uros Bizjak
  2022-11-28 22:20 ` Borislav Petkov
  2022-11-29 19:44 ` [tip: x86/boot] x86/boot: Remove x86_32 PIC using %ebx workaround tip-bot2 for Uros Bizjak
  0 siblings, 2 replies; 13+ messages in thread
From: Uros Bizjak @ 2022-11-04 12:45 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin

Current minimum required version of GCC is version 5.1 which allows
reuse of PIC hard register on x86/x86-64 targets [1]. Remove
obsolete workaround that was needed for earlier GCC versions.

[1] https://gcc.gnu.org/gcc-5/changes.html

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
 arch/x86/boot/cpuflags.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
index a83d67ec627d..d75237ba7ce9 100644
--- a/arch/x86/boot/cpuflags.c
+++ b/arch/x86/boot/cpuflags.c
@@ -64,20 +64,11 @@ int has_eflag(unsigned long mask)
 	return !!((f0^f1) & mask);
 }
 
-/* Handle x86_32 PIC using ebx. */
-#if defined(__i386__) && defined(__PIC__)
-# define EBX_REG "=r"
-#else
-# define EBX_REG "=b"
-#endif
-
 void cpuid_count(u32 id, u32 count, u32 *a, u32 *b, u32 *c, u32 *d)
 {
-	asm volatile(".ifnc %%ebx,%3 ; movl  %%ebx,%3 ; .endif	\n\t"
-		     "cpuid					\n\t"
-		     ".ifnc %%ebx,%3 ; xchgl %%ebx,%3 ; .endif	\n\t"
-		    : "=a" (*a), "=c" (*c), "=d" (*d), EBX_REG (*b)
-		    : "a" (id), "c" (count)
+	asm volatile("cpuid"
+		     : "=a" (*a), "=b" (*b), "=c" (*c), "=d" (*d)
+		     : "0" (id), "2" (count)
 	);
 }
 
-- 
2.37.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-29 19:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 12:45 [PATCH] x86/boot: Remove x86_32 PIC using ebx workaround Uros Bizjak
2022-11-28 22:20 ` Borislav Petkov
2022-11-29  3:41   ` Brian Gerst
2022-11-29  8:32     ` Borislav Petkov
2022-11-29 13:24       ` Brian Gerst
2022-11-29 13:26         ` Uros Bizjak
2022-11-29  7:39   ` Uros Bizjak
2022-11-29  8:31     ` Borislav Petkov
2022-11-29  8:50       ` Uros Bizjak
2022-11-29 14:46         ` Borislav Petkov
2022-11-29 14:56           ` Uros Bizjak
2022-11-29 15:27             ` Borislav Petkov
2022-11-29 19:44 ` [tip: x86/boot] x86/boot: Remove x86_32 PIC using %ebx workaround tip-bot2 for Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®