Skip to content

Commit 25219c2

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
x86/asm-offsets: Export certain 'struct cpuinfo_x86' fields for 64-bit asm use too
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6479755 commit 25219c2

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

arch/x86/kernel/asm-offsets.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333

3434
static void __used common(void)
3535
{
36+
OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
37+
OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
38+
OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
39+
OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
40+
OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
41+
OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
42+
OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
43+
3644
BLANK();
3745
OFFSET(TASK_threadsp, task_struct, thread.sp);
3846
#ifdef CONFIG_STACKPROTECTOR

arch/x86/kernel/asm-offsets_32.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ void foo(void);
1212

1313
void foo(void)
1414
{
15-
OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
16-
OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
17-
OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
18-
OFFSET(CPUINFO_x86_stepping, cpuinfo_x86, x86_stepping);
19-
OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
20-
OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
21-
OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
22-
BLANK();
23-
2415
OFFSET(PT_EBX, pt_regs, bx);
2516
OFFSET(PT_ECX, pt_regs, cx);
2617
OFFSET(PT_EDX, pt_regs, dx);

0 commit comments

Comments
 (0)