]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/asm-offsets: Export certain 'struct cpuinfo_x86' fields for 64-bit asm use too
authorArd Biesheuvel <ardb@kernel.org>
Wed, 14 May 2025 10:42:46 +0000 (12:42 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 15 May 2025 07:12:07 +0000 (09:12 +0200)
Expose certain 'struct cpuinfo_x86' fields via asm-offsets for x86_64
too, so that it will be possible to set CPU capabilities from 64-bit
asm code.

32-bit already used these fields, so simply move those offset exports into
the unified asm-offsets.c file.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250514104242.1275040-12-ardb+git@google.com
arch/x86/kernel/asm-offsets.c
arch/x86/kernel/asm-offsets_32.c

index ad4ea6fb3b6cb9755f7ea783aea5fc2d095fdbba..6259b474073bc5a22f57dc4e6dfdad73e5e2dadf 100644 (file)
 
 static void __used common(void)
 {
+       OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
+       OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
+       OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
+       OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
+       OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
+       OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
+       OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
+
        BLANK();
        OFFSET(TASK_threadsp, task_struct, thread.sp);
 #ifdef CONFIG_STACKPROTECTOR
index 2b411cd00a4e285a9e5b3ae8f56a7a715ac4269d..e0a292db97b2328df7deed0fca2eadcd94dbeccc 100644 (file)
@@ -12,15 +12,6 @@ void foo(void);
 
 void foo(void)
 {
-       OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
-       OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
-       OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
-       OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
-       OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
-       OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
-       OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
-       BLANK();
-
        OFFSET(PT_EBX, pt_regs, bx);
        OFFSET(PT_ECX, pt_regs, cx);
        OFFSET(PT_EDX, pt_regs, dx);