Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/asm/purgatory: Start using annotations

Purgatory used no annotations at all. So include linux/linkage.h and
annotate everything:

* code by SYM_CODE_*
* data by SYM_DATA_*

[ bp: Fixup comment in gdt: ]

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Alexios Zavras <alexios.zavras@intel.com>
Cc: Allison Randal <allison@lohutok.net>
Cc: Enrico Weigelt <info@metux.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-arch@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20191011115108.12392-16-jslaby@suse.cz

authored by

Jiri Slaby and committed by
Borislav Petkov
b16fed65 1de5bdce

+26 -19
+14 -10
arch/x86/purgatory/entry64.S
··· 8 8 * This code has been taken from kexec-tools. 9 9 */ 10 10 11 + #include <linux/linkage.h> 12 + 11 13 .text 12 14 .balign 16 13 15 .code64 14 - .globl entry64, entry64_regs 15 16 16 - 17 - entry64: 17 + SYM_CODE_START(entry64) 18 18 /* Setup a gdt that should be preserved */ 19 19 lgdt gdt(%rip) 20 20 ··· 54 54 55 55 /* Jump to the new code... */ 56 56 jmpq *rip(%rip) 57 + SYM_CODE_END(entry64) 57 58 58 59 .section ".rodata" 59 60 .balign 4 60 - entry64_regs: 61 + SYM_DATA_START(entry64_regs) 61 62 rax: .quad 0x0 62 63 rcx: .quad 0x0 63 64 rdx: .quad 0x0 ··· 76 75 r14: .quad 0x0 77 76 r15: .quad 0x0 78 77 rip: .quad 0x0 79 - .size entry64_regs, . - entry64_regs 78 + SYM_DATA_END(entry64_regs) 80 79 81 80 /* GDT */ 82 81 .section ".rodata" 83 82 .balign 16 84 - gdt: 85 - /* 0x00 unusable segment 83 + SYM_DATA_START_LOCAL(gdt) 84 + /* 85 + * 0x00 unusable segment 86 86 * 0x08 unused 87 87 * so use them as gdt ptr 88 88 */ ··· 96 94 97 95 /* 0x18 4GB flat data segment */ 98 96 .word 0xFFFF, 0x0000, 0x9200, 0x00CF 99 - gdt_end: 100 - stack: .quad 0, 0 101 - stack_init: 97 + SYM_DATA_END_LABEL(gdt, SYM_L_LOCAL, gdt_end) 98 + 99 + SYM_DATA_START_LOCAL(stack) 100 + .quad 0, 0 101 + SYM_DATA_END_LABEL(stack, SYM_L_LOCAL, stack_init)
+8 -6
arch/x86/purgatory/setup-x86_64.S
··· 7 7 * 8 8 * This code has been taken from kexec-tools. 9 9 */ 10 + #include <linux/linkage.h> 10 11 #include <asm/purgatory.h> 11 12 12 13 .text 13 - .globl purgatory_start 14 14 .balign 16 15 - purgatory_start: 16 15 .code64 17 16 17 + SYM_CODE_START(purgatory_start) 18 18 /* Load a gdt so I know what the segment registers are */ 19 19 lgdt gdt(%rip) 20 20 ··· 32 32 /* Call the C code */ 33 33 call purgatory 34 34 jmp entry64 35 + SYM_CODE_END(purgatory_start) 35 36 36 37 .section ".rodata" 37 38 .balign 16 38 - gdt: /* 0x00 unusable segment 39 + SYM_DATA_START_LOCAL(gdt) 40 + /* 0x00 unusable segment 39 41 * 0x08 unused 40 42 * so use them as the gdt ptr 41 43 */ ··· 50 48 51 49 /* 0x18 4GB flat data segment */ 52 50 .word 0xFFFF, 0x0000, 0x9200, 0x00CF 53 - gdt_end: 51 + SYM_DATA_END_LABEL(gdt, SYM_L_LOCAL, gdt_end) 54 52 55 53 .bss 56 54 .balign 4096 57 - lstack: 55 + SYM_DATA_START_LOCAL(lstack) 58 56 .skip 4096 59 - lstack_end: 57 + SYM_DATA_END_LABEL(lstack, SYM_L_LOCAL, lstack_end)
+4 -3
arch/x86/purgatory/stack.S
··· 5 5 * Copyright (C) 2014 Red Hat Inc. 6 6 */ 7 7 8 + #include <linux/linkage.h> 9 + 8 10 /* A stack for the loaded kernel. 9 11 * Separate and in the data section so it can be prepopulated. 10 12 */ 11 13 .data 12 14 .balign 4096 13 - .globl stack, stack_end 14 15 15 - stack: 16 + SYM_DATA_START(stack) 16 17 .skip 4096 17 - stack_end: 18 + SYM_DATA_END_LABEL(stack, SYM_L_GLOBAL, stack_end)