Skip to content

Commit

Permalink
x86/asm/32: Change all ENTRY+ENDPROC to SYM_FUNC_*
Browse files Browse the repository at this point in the history
These are all functions which are invoked from elsewhere, so annotate
them as global using the new SYM_FUNC_START and their ENDPROC's by
SYM_FUNC_END.

Now, ENTRY/ENDPROC can be forced to be undefined on X86, so do so.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Allison Randal <allison@lohutok.net>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Bill Metzenthen <billm@melbpc.org.au>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-arch@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: linux-efi <linux-efi@vger.kernel.org>
Cc: linux-efi@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: platform-driver-x86@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20191011115108.12392-28-jslaby@suse.cz
  • Loading branch information
Jiri Slaby authored and Borislav Petkov committed Oct 18, 2019
1 parent 5e63306 commit 6d685e5
Show file tree
Hide file tree
Showing 26 changed files with 104 additions and 108 deletions.
4 changes: 2 additions & 2 deletions arch/x86/boot/compressed/efi_stub_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

.text
ENTRY(efi_call_phys)
SYM_FUNC_START(efi_call_phys)
/*
* 0. The function can only be called in Linux kernel. So CS has been
* set to 0x0010, DS and SS have been set to 0x0018. In EFI, I found
Expand Down Expand Up @@ -77,7 +77,7 @@ ENTRY(efi_call_phys)
movl saved_return_addr(%edx), %ecx
pushl %ecx
ret
ENDPROC(efi_call_phys)
SYM_FUNC_END(efi_call_phys)
.previous

.data
Expand Down
12 changes: 6 additions & 6 deletions arch/x86/boot/compressed/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
.hidden _egot

__HEAD
ENTRY(startup_32)
SYM_FUNC_START(startup_32)
cld
/*
* Test KEEP_SEGMENTS flag to see if the bootloader is asking
Expand Down Expand Up @@ -142,14 +142,14 @@ ENTRY(startup_32)
*/
leal .Lrelocated(%ebx), %eax
jmp *%eax
ENDPROC(startup_32)
SYM_FUNC_END(startup_32)

#ifdef CONFIG_EFI_STUB
/*
* We don't need the return address, so set up the stack so efi_main() can find
* its arguments.
*/
ENTRY(efi_pe_entry)
SYM_FUNC_START(efi_pe_entry)
add $0x4, %esp

call 1f
Expand All @@ -174,9 +174,9 @@ ENTRY(efi_pe_entry)
pushl %eax
pushl %ecx
jmp 2f /* Skip efi_config initialization */
ENDPROC(efi_pe_entry)
SYM_FUNC_END(efi_pe_entry)

ENTRY(efi32_stub_entry)
SYM_FUNC_START(efi32_stub_entry)
add $0x4, %esp
popl %ecx
popl %edx
Expand Down Expand Up @@ -205,7 +205,7 @@ fail:
movl BP_code32_start(%esi), %eax
leal startup_32(%eax), %eax
jmp *%eax
ENDPROC(efi32_stub_entry)
SYM_FUNC_END(efi32_stub_entry)
#endif

.text
Expand Down
8 changes: 4 additions & 4 deletions arch/x86/crypto/serpent-sse2-i586-asm_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
pxor t0, x3; \
movdqu x3, (3*4*4)(out);

ENTRY(__serpent_enc_blk_4way)
SYM_FUNC_START(__serpent_enc_blk_4way)
/* input:
* arg_ctx(%esp): ctx, CTX
* arg_dst(%esp): dst
Expand Down Expand Up @@ -559,9 +559,9 @@ ENTRY(__serpent_enc_blk_4way)
xor_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE);

ret;
ENDPROC(__serpent_enc_blk_4way)
SYM_FUNC_END(__serpent_enc_blk_4way)

ENTRY(serpent_dec_blk_4way)
SYM_FUNC_START(serpent_dec_blk_4way)
/* input:
* arg_ctx(%esp): ctx, CTX
* arg_dst(%esp): dst
Expand Down Expand Up @@ -613,4 +613,4 @@ ENTRY(serpent_dec_blk_4way)
write_blocks(%eax, RC, RD, RB, RE, RT0, RT1, RA);

ret;
ENDPROC(serpent_dec_blk_4way)
SYM_FUNC_END(serpent_dec_blk_4way)
8 changes: 4 additions & 4 deletions arch/x86/crypto/twofish-i586-asm_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
xor %esi, d ## D;\
ror $1, d ## D;

ENTRY(twofish_enc_blk)
SYM_FUNC_START(twofish_enc_blk)
push %ebp /* save registers according to calling convention*/
push %ebx
push %esi
Expand Down Expand Up @@ -261,9 +261,9 @@ ENTRY(twofish_enc_blk)
pop %ebp
mov $1, %eax
ret
ENDPROC(twofish_enc_blk)
SYM_FUNC_END(twofish_enc_blk)

ENTRY(twofish_dec_blk)
SYM_FUNC_START(twofish_dec_blk)
push %ebp /* save registers according to calling convention*/
push %ebx
push %esi
Expand Down Expand Up @@ -318,4 +318,4 @@ ENTRY(twofish_dec_blk)
pop %ebp
mov $1, %eax
ret
ENDPROC(twofish_dec_blk)
SYM_FUNC_END(twofish_dec_blk)
24 changes: 12 additions & 12 deletions arch/x86/entry/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ SYM_CODE_END(__switch_to_asm)
* asmlinkage function so its argument has to be pushed on the stack. This
* wrapper creates a proper "end of stack" frame header before the call.
*/
ENTRY(schedule_tail_wrapper)
SYM_FUNC_START(schedule_tail_wrapper)
FRAME_BEGIN

pushl %eax
Expand All @@ -766,7 +766,7 @@ ENTRY(schedule_tail_wrapper)

FRAME_END
ret
ENDPROC(schedule_tail_wrapper)
SYM_FUNC_END(schedule_tail_wrapper)
/*
* A newly forked process directly context switches into this address.
*
Expand Down Expand Up @@ -885,7 +885,7 @@ SYM_CODE_END(xen_sysenter_target)
* ebp user stack
* 0(%ebp) arg6
*/
ENTRY(entry_SYSENTER_32)
SYM_FUNC_START(entry_SYSENTER_32)
/*
* On entry-stack with all userspace-regs live - save and
* restore eflags and %eax to use it as scratch-reg for the cr3
Expand Down Expand Up @@ -1013,7 +1013,7 @@ ENTRY(entry_SYSENTER_32)
popfl
jmp .Lsysenter_flags_fixed
SYM_ENTRY(__end_SYSENTER_singlestep_region, SYM_L_GLOBAL, SYM_A_NONE)
ENDPROC(entry_SYSENTER_32)
SYM_FUNC_END(entry_SYSENTER_32)

/*
* 32-bit legacy system call entry.
Expand Down Expand Up @@ -1043,7 +1043,7 @@ ENDPROC(entry_SYSENTER_32)
* edi arg5
* ebp arg6
*/
ENTRY(entry_INT80_32)
SYM_FUNC_START(entry_INT80_32)
ASM_CLAC
pushl %eax /* pt_regs->orig_ax */

Expand Down Expand Up @@ -1120,7 +1120,7 @@ SYM_CODE_START(iret_exc)
SYM_CODE_END(iret_exc)
.previous
_ASM_EXTABLE(.Lirq_return, iret_exc)
ENDPROC(entry_INT80_32)
SYM_FUNC_END(entry_INT80_32)

.macro FIXUP_ESPFIX_STACK
/*
Expand Down Expand Up @@ -1213,7 +1213,7 @@ SYM_CODE_START_LOCAL(common_interrupt)
SYM_CODE_END(common_interrupt)

#define BUILD_INTERRUPT3(name, nr, fn) \
ENTRY(name) \
SYM_FUNC_START(name) \
ASM_CLAC; \
pushl $~(nr); \
SAVE_ALL switch_stacks=1; \
Expand All @@ -1222,7 +1222,7 @@ ENTRY(name) \
movl %esp, %eax; \
call fn; \
jmp ret_from_intr; \
ENDPROC(name)
SYM_FUNC_END(name)

#define BUILD_INTERRUPT(name, nr) \
BUILD_INTERRUPT3(name, nr, smp_##name); \
Expand Down Expand Up @@ -1341,7 +1341,7 @@ SYM_CODE_START(spurious_interrupt_bug)
SYM_CODE_END(spurious_interrupt_bug)

#ifdef CONFIG_XEN_PV
ENTRY(xen_hypervisor_callback)
SYM_FUNC_START(xen_hypervisor_callback)
pushl $-1 /* orig_ax = -1 => not a system call */
SAVE_ALL
ENCODE_FRAME_POINTER
Expand Down Expand Up @@ -1369,7 +1369,7 @@ SYM_INNER_LABEL_ALIGN(xen_do_upcall, SYM_L_GLOBAL)
call xen_maybe_preempt_hcall
#endif
jmp ret_from_intr
ENDPROC(xen_hypervisor_callback)
SYM_FUNC_END(xen_hypervisor_callback)

/*
* Hypervisor uses this for application faults while it executes.
Expand All @@ -1383,7 +1383,7 @@ ENDPROC(xen_hypervisor_callback)
* to pop the stack frame we end up in an infinite loop of failsafe callbacks.
* We distinguish between categories by maintaining a status value in EAX.
*/
ENTRY(xen_failsafe_callback)
SYM_FUNC_START(xen_failsafe_callback)
pushl %eax
movl $1, %eax
1: mov 4(%esp), %ds
Expand Down Expand Up @@ -1420,7 +1420,7 @@ ENTRY(xen_failsafe_callback)
_ASM_EXTABLE(2b, 7b)
_ASM_EXTABLE(3b, 8b)
_ASM_EXTABLE(4b, 9b)
ENDPROC(xen_failsafe_callback)
SYM_FUNC_END(xen_failsafe_callback)
#endif /* CONFIG_XEN_PV */

#ifdef CONFIG_XEN_PVHVM
Expand Down
16 changes: 8 additions & 8 deletions arch/x86/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ SYM_CODE_END(startup_32)
* up already except stack. We just set up stack here. Then call
* start_secondary().
*/
ENTRY(start_cpu0)
SYM_FUNC_START(start_cpu0)
movl initial_stack, %ecx
movl %ecx, %esp
call *(initial_code)
1: jmp 1b
ENDPROC(start_cpu0)
SYM_FUNC_END(start_cpu0)
#endif

/*
Expand All @@ -196,7 +196,7 @@ ENDPROC(start_cpu0)
* If cpu hotplug is not supported then this code can go in init section
* which will be freed later
*/
ENTRY(startup_32_smp)
SYM_FUNC_START(startup_32_smp)
cld
movl $(__BOOT_DS),%eax
movl %eax,%ds
Expand Down Expand Up @@ -363,7 +363,7 @@ ENTRY(startup_32_smp)

call *(initial_code)
1: jmp 1b
ENDPROC(startup_32_smp)
SYM_FUNC_END(startup_32_smp)

#include "verify_cpu.S"

Expand Down Expand Up @@ -393,7 +393,7 @@ setup_once:
andl $0,setup_once_ref /* Once is enough, thanks */
ret

ENTRY(early_idt_handler_array)
SYM_FUNC_START(early_idt_handler_array)
# 36(%esp) %eflags
# 32(%esp) %cs
# 28(%esp) %eip
Expand All @@ -408,7 +408,7 @@ ENTRY(early_idt_handler_array)
i = i + 1
.fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc
.endr
ENDPROC(early_idt_handler_array)
SYM_FUNC_END(early_idt_handler_array)

SYM_CODE_START_LOCAL(early_idt_handler_common)
/*
Expand Down Expand Up @@ -464,7 +464,7 @@ SYM_CODE_START_LOCAL(early_idt_handler_common)
SYM_CODE_END(early_idt_handler_common)

/* This is the default interrupt "handler" :-) */
ENTRY(early_ignore_irq)
SYM_FUNC_START(early_ignore_irq)
cld
#ifdef CONFIG_PRINTK
pushl %eax
Expand Down Expand Up @@ -499,7 +499,7 @@ ENTRY(early_ignore_irq)
hlt_loop:
hlt
jmp hlt_loop
ENDPROC(early_ignore_irq)
SYM_FUNC_END(early_ignore_irq)

__INITDATA
.align 4
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/lib/atomic64_386_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

#define BEGIN(op) \
.macro endp; \
ENDPROC(atomic64_##op##_386); \
SYM_FUNC_END(atomic64_##op##_386); \
.purgem endp; \
.endm; \
ENTRY(atomic64_##op##_386); \
SYM_FUNC_START(atomic64_##op##_386); \
LOCK v;

#define ENDP endp
Expand Down
Loading

0 comments on commit 6d685e5

Please sign in to comment.