[PATCH v2 04/10] x86: boot, annotate functions properly
From: Jiri Slaby
Date: Mon Mar 20 2017 - 08:34:32 EST
1) GLOBAL is meant for global symbols, but not functions. Use
SYM_FUNC_START which is dedicated for global functions.
2) Finish every function with SYM_FUNC_END.
Note that efi_pe_entry is not a start of a function, it is the middle of
startup_64 -- annotate as such.
Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: <x86@xxxxxxxxxx>
---
The alternative to the startup_64 change would be to move efi_pe_entry
out of startup_64 which actually makes more sense, but I am afraid I
cannot test the result properly. See what it is now:
.org 0x200
ENTRY(startup_64)
#ifdef CONFIG_EFI_STUB
jmp preferred_addr
GLOBAL(efi_pe_entry)
... ; a lot of assembly (efi_pe_entry)
leaq preferred_addr(%rax), %rax
jmp *%rax
preferred_addr:
#endif
... ; a lot of assembly (startup_64)
ENDPROC(startup_64)
What about:
.org 0x200
ENTRY(startup_64)
... ; a lot of assembly (startup_64)
ENDPROC(startup_64)
#ifdef CONFIG_EFI_STUB
ENTRY(efi_pe_entry)
... ; a lot of assembly (efi_pe_entry)
leaq startup_64(%rax), %rax
jmp *%rax
ENDPROC(efi_pe_entry)
#endif
This solution is at the end of the series as RFC.
---
arch/x86/boot/compressed/head_64.S | 3 ++-
arch/x86/boot/copy.S | 12 ++++++------
arch/x86/boot/pmjump.S | 4 ++--
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index d2ae1f821e0c..6f037b3af204 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -250,7 +250,7 @@ ENTRY(startup_64)
*/
jmp preferred_addr
-ENTRY(efi_pe_entry)
+SYM_FUNC_INNER_LABEL(efi_pe_entry)
movq %rcx, efi64_config(%rip) /* Handle */
movq %rdx, efi64_config+8(%rip) /* EFI System table pointer */
@@ -369,6 +369,7 @@ preferred_addr:
*/
leaq relocated(%rbx), %rax
jmp *%rax
+SYM_FUNC_END(startup_64)
#ifdef CONFIG_EFI_STUB
.org 0x390
diff --git a/arch/x86/boot/copy.S b/arch/x86/boot/copy.S
index 1eb7d298b47d..ef154c1ca14d 100644
--- a/arch/x86/boot/copy.S
+++ b/arch/x86/boot/copy.S
@@ -17,7 +17,7 @@
.code16
.text
-GLOBAL(memcpy)
+SYM_FUNC_START(memcpy)
pushw %si
pushw %di
movw %ax, %di
@@ -33,7 +33,7 @@ GLOBAL(memcpy)
retl
ENDPROC(memcpy)
-GLOBAL(memset)
+SYM_FUNC_START(memset)
pushw %di
movw %ax, %di
movzbl %dl, %eax
@@ -48,7 +48,7 @@ GLOBAL(memset)
retl
ENDPROC(memset)
-GLOBAL(copy_from_fs)
+SYM_FUNC_START(copy_from_fs)
pushw %ds
pushw %fs
popw %ds
@@ -57,7 +57,7 @@ GLOBAL(copy_from_fs)
retl
ENDPROC(copy_from_fs)
-GLOBAL(copy_to_fs)
+SYM_FUNC_START(copy_to_fs)
pushw %es
pushw %fs
popw %es
@@ -67,7 +67,7 @@ GLOBAL(copy_to_fs)
ENDPROC(copy_to_fs)
#if 0 /* Not currently used, but can be enabled as needed */
-GLOBAL(copy_from_gs)
+SYM_FUNC_START(copy_from_gs)
pushw %ds
pushw %gs
popw %ds
@@ -76,7 +76,7 @@ GLOBAL(copy_from_gs)
retl
ENDPROC(copy_from_gs)
-GLOBAL(copy_to_gs)
+SYM_FUNC_START(copy_to_gs)
pushw %es
pushw %gs
popw %es
diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
index 3e0edc6d2a20..5915510c7b51 100644
--- a/arch/x86/boot/pmjump.S
+++ b/arch/x86/boot/pmjump.S
@@ -23,7 +23,7 @@
/*
* void protected_mode_jump(u32 entrypoint, u32 bootparams);
*/
-GLOBAL(protected_mode_jump)
+SYM_FUNC_START(protected_mode_jump)
movl %edx, %esi # Pointer to boot_params table
xorl %ebx, %ebx
@@ -48,7 +48,7 @@ ENDPROC(protected_mode_jump)
.code32
.section ".text32","ax"
-GLOBAL(in_pm32)
+SYM_FUNC_START(in_pm32)
# Set up data segments for flat 32-bit mode
movl %ecx, %ds
movl %ecx, %es
--
2.12.0