[PATCH v3 10/29] x86: assembly, annotate relocate_kernel

From: Jiri Slaby
Date: Fri Apr 21 2017 - 10:21:08 EST


Annotate all functions in relocate_kernel by SYM_FUNC_START,
SYM_FUNC_START_LOCAL, and SYM_FUNC_END properly.

We get in return:
0000 108 FUNC GLOBAL DEFAULT 1 relocate_kernel
0070 165 FUNC LOCAL DEFAULT 1 identity_mapped
0120 53 FUNC LOCAL DEFAULT 1 virtual_mapped
0160 127 FUNC LOCAL DEFAULT 1 swap_pages

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: x86@xxxxxxxxxx
---
arch/x86/kernel/relocate_kernel_32.S | 13 ++++++++-----
arch/x86/kernel/relocate_kernel_64.S | 13 ++++++++-----
2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S
index 77630d57e7bf..4f0f80da0454 100644
--- a/arch/x86/kernel/relocate_kernel_32.S
+++ b/arch/x86/kernel/relocate_kernel_32.S
@@ -37,8 +37,7 @@
#define CP_PA_BACKUP_PAGES_MAP DATA(0x1c)

.text
- .globl relocate_kernel
-relocate_kernel:
+SYM_FUNC_START(relocate_kernel)
/* Save the CPU context, used for jumping back */

pushl %ebx
@@ -95,8 +94,9 @@ relocate_kernel:
addl $(identity_mapped - relocate_kernel), %eax
pushl %eax
ret
+SYM_FUNC_END(relocate_kernel)

-identity_mapped:
+SYM_FUNC_START_LOCAL(identity_mapped)
/* set return address to 0 if not preserving context */
pushl $0
/* store the start address on the stack */
@@ -193,8 +193,9 @@ identity_mapped:
addl $(virtual_mapped - relocate_kernel), %eax
pushl %eax
ret
+SYM_FUNC_END(identity_mapped)

-virtual_mapped:
+SYM_FUNC_START_LOCAL(virtual_mapped)
movl CR4(%edi), %eax
movl %eax, %cr4
movl CR3(%edi), %eax
@@ -210,9 +211,10 @@ virtual_mapped:
popl %esi
popl %ebx
ret
+SYM_FUNC_END(virtual_mapped)

/* Do the copies */
-swap_pages:
+SYM_FUNC_START_LOCAL(swap_pages)
movl 8(%esp), %edx
movl 4(%esp), %ecx
pushl %ebp
@@ -272,6 +274,7 @@ swap_pages:
popl %ebx
popl %ebp
ret
+SYM_FUNC_END(swap_pages)

.globl kexec_control_code_size
.set kexec_control_code_size, . - relocate_kernel
diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
index 98111b38ebfd..5138b0587816 100644
--- a/arch/x86/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
@@ -40,8 +40,7 @@
.text
.align PAGE_SIZE
.code64
- .globl relocate_kernel
-relocate_kernel:
+SYM_FUNC_START(relocate_kernel)
/*
* %rdi indirection_page
* %rsi page_list
@@ -98,8 +97,9 @@ relocate_kernel:
addq $(identity_mapped - relocate_kernel), %r8
pushq %r8
ret
+SYM_FUNC_END(relocate_kernel)

-identity_mapped:
+SYM_FUNC_START_LOCAL(identity_mapped)
/* set return address to 0 if not preserving context */
pushq $0
/* store the start address on the stack */
@@ -189,8 +189,9 @@ identity_mapped:
movq $virtual_mapped, %rax
pushq %rax
ret
+SYM_FUNC_END(identity_mapped)

-virtual_mapped:
+SYM_FUNC_START_LOCAL(virtual_mapped)
movq RSP(%r8), %rsp
movq CR4(%r8), %rax
movq %rax, %cr4
@@ -208,9 +209,10 @@ virtual_mapped:
popq %rbp
popq %rbx
ret
+SYM_FUNC_END(virtual_mapped)

/* Do the copies */
-swap_pages:
+SYM_FUNC_START_LOCAL(swap_pages)
movq %rdi, %rcx /* Put the page_list in %rcx */
xorl %edi, %edi
xorl %esi, %esi
@@ -263,6 +265,7 @@ swap_pages:
jmp 0b
3:
ret
+SYM_FUNC_END(swap_pages)

.globl kexec_control_code_size
.set kexec_control_code_size, . - relocate_kernel
--
2.12.2