Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653953 > unrolled thread

[PATCH 1/5] x86: boot/copy, remove unused functions

Started byJiri Slaby <jslaby@suse.cz>
First post2017-05-31 10:20 +0200
Last post2017-06-05 11:20 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/5] x86: boot/copy, remove unused functions Jiri Slaby <jslaby@suse.cz> - 2017-05-31 10:20 +0200
    [PATCH 3/5] x86_64: boot, extract efi_pe_entry from startup_64 Jiri Slaby <jslaby@suse.cz> - 2017-05-31 10:20 +0200
      Re: [PATCH 3/5] x86_64: boot, extract efi_pe_entry from startup_64 Matt Fleming <matt@codeblueprint.co.uk> - 2017-06-05 16:30 +0200
    [PATCH 2/5] x86_32: boot, extract efi_pe_entry from startup_32 Jiri Slaby <jslaby@suse.cz> - 2017-05-31 10:20 +0200
      Re: [PATCH 2/5] x86_32: boot, extract efi_pe_entry from startup_32 Matt Fleming <matt@codeblueprint.co.uk> - 2017-06-05 16:30 +0200
    [PATCH 5/5] x86: entry, use ENTRY instead of ALIGN+GLOBAL for stub32_clone Jiri Slaby <jslaby@suse.cz> - 2017-05-31 10:20 +0200
    [PATCH 4/5] x86: math-emu, add ENDPROC to functions Jiri Slaby <jslaby@suse.cz> - 2017-05-31 10:20 +0200
    [tip:x86/boot] x86/boot: Remove unused copy_*_gs() functions tip-bot for Jiri Slaby <tipbot@zytor.com> - 2017-06-05 11:20 +0200

#1653953 — [PATCH 1/5] x86: boot/copy, remove unused functions

FromJiri Slaby <jslaby@suse.cz>
Date2017-05-31 10:20 +0200
Subject[PATCH 1/5] x86: boot/copy, remove unused functions
Message-ID<tN71f-2f2-1@gated-at.bofh.it>
copy_from_gs and copy_to_gs are unused in the boot code. They have
actually never been used -- they were always commented out since their
addition in 5be865661516 ("String-handling functions for the new x86
setup code.") in 2007. So remove them -- they can be restored from
history if need be.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
---
 arch/x86/boot/copy.S | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/arch/x86/boot/copy.S b/arch/x86/boot/copy.S
index 1eb7d298b47d..15d9f74b0008 100644
--- a/arch/x86/boot/copy.S
+++ b/arch/x86/boot/copy.S
@@ -65,23 +65,3 @@ GLOBAL(copy_to_fs)
 	popw	%es
 	retl
 ENDPROC(copy_to_fs)
-
-#if 0 /* Not currently used, but can be enabled as needed */
-GLOBAL(copy_from_gs)
-	pushw	%ds
-	pushw	%gs
-	popw	%ds
-	calll	memcpy
-	popw	%ds
-	retl
-ENDPROC(copy_from_gs)
-
-GLOBAL(copy_to_gs)
-	pushw	%es
-	pushw	%gs
-	popw	%es
-	calll	memcpy
-	popw	%es
-	retl
-ENDPROC(copy_to_gs)
-#endif
-- 
2.13.0

[toc] | [next] | [standalone]


#1653956 — [PATCH 3/5] x86_64: boot, extract efi_pe_entry from startup_64

FromJiri Slaby <jslaby@suse.cz>
Date2017-05-31 10:20 +0200
Subject[PATCH 3/5] x86_64: boot, extract efi_pe_entry from startup_64
Message-ID<tN71f-2f2-9@gated-at.bofh.it>
In reply to#1653953
efi_pe_entry body is somehow squashed into startup_64. In the old days,
we forced startup_64 to start at offset 0x200 and efi_pe_entry to start
at 0x210. But this requirement was removed in 99f857db8857 ("x86, build:
Dynamically find entry points in compressed startup code") long time
ago.

The way it is now makes the code less readable and illogical. And given
we can now safely extract the inlined efi_pe_entry body from
startup_64 into a separate function, we do so.

We also annotate the function appropriatelly by ENTRY+ENDPROC.

ABI offsets are preserved:
0000000000000000 T startup_32
0000000000000200 T startup_64
0000000000000390 T efi64_stub_entry

On the top-level, it looked like:
	.org 0x200
	ENTRY(startup_64)
	#ifdef CONFIG_EFI_STUB		; start of inlined
		jmp     preferred_addr
	GLOBAL(efi_pe_entry)
		... ; a lot of assembly (efi_pe_entry)
		leaq    preferred_addr(%rax), %rax
		jmp     *%rax
	preferred_addr:
	#endif				; end of inlined
		... ; a lot of assembly (startup_64)
	ENDPROC(startup_64)

And it is converted into:
	.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

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <x86@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
---
 arch/x86/boot/compressed/head_64.S | 112 ++++++++++++++++++-------------------
 1 file changed, 53 insertions(+), 59 deletions(-)

diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index d2ae1f821e0c..146751091801 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -243,65 +243,6 @@ ENTRY(startup_64)
 	 * that maps our entire kernel(text+data+bss+brk), zero page
 	 * and command line.
 	 */
-#ifdef CONFIG_EFI_STUB
-	/*
-	 * The entry point for the PE/COFF executable is efi_pe_entry, so
-	 * only legacy boot loaders will execute this jmp.
-	 */
-	jmp	preferred_addr
-
-ENTRY(efi_pe_entry)
-	movq	%rcx, efi64_config(%rip)	/* Handle */
-	movq	%rdx, efi64_config+8(%rip) /* EFI System table pointer */
-
-	leaq	efi64_config(%rip), %rax
-	movq	%rax, efi_config(%rip)
-
-	call	1f
-1:	popq	%rbp
-	subq	$1b, %rbp
-
-	/*
-	 * Relocate efi_config->call().
-	 */
-	addq	%rbp, efi64_config+40(%rip)
-
-	movq	%rax, %rdi
-	call	make_boot_params
-	cmpq	$0,%rax
-	je	fail
-	mov	%rax, %rsi
-	leaq	startup_32(%rip), %rax
-	movl	%eax, BP_code32_start(%rsi)
-	jmp	2f		/* Skip the relocation */
-
-handover_entry:
-	call	1f
-1:	popq	%rbp
-	subq	$1b, %rbp
-
-	/*
-	 * Relocate efi_config->call().
-	 */
-	movq	efi_config(%rip), %rax
-	addq	%rbp, 40(%rax)
-2:
-	movq	efi_config(%rip), %rdi
-	call	efi_main
-	movq	%rax,%rsi
-	cmpq	$0,%rax
-	jne	2f
-fail:
-	/* EFI init failed, so hang. */
-	hlt
-	jmp	fail
-2:
-	movl	BP_code32_start(%esi), %eax
-	leaq	preferred_addr(%rax), %rax
-	jmp	*%rax
-
-preferred_addr:
-#endif
 
 	/* Setup data segments. */
 	xorl	%eax, %eax
@@ -371,6 +312,59 @@ preferred_addr:
 	jmp	*%rax
 
 #ifdef CONFIG_EFI_STUB
+
+/* The entry point for the PE/COFF executable is efi_pe_entry. */
+ENTRY(efi_pe_entry)
+	movq	%rcx, efi64_config(%rip)	/* Handle */
+	movq	%rdx, efi64_config+8(%rip) /* EFI System table pointer */
+
+	leaq	efi64_config(%rip), %rax
+	movq	%rax, efi_config(%rip)
+
+	call	1f
+1:	popq	%rbp
+	subq	$1b, %rbp
+
+	/*
+	 * Relocate efi_config->call().
+	 */
+	addq	%rbp, efi64_config+40(%rip)
+
+	movq	%rax, %rdi
+	call	make_boot_params
+	cmpq	$0,%rax
+	je	fail
+	mov	%rax, %rsi
+	leaq	startup_32(%rip), %rax
+	movl	%eax, BP_code32_start(%rsi)
+	jmp	2f		/* Skip the relocation */
+
+handover_entry:
+	call	1f
+1:	popq	%rbp
+	subq	$1b, %rbp
+
+	/*
+	 * Relocate efi_config->call().
+	 */
+	movq	efi_config(%rip), %rax
+	addq	%rbp, 40(%rax)
+2:
+	movq	efi_config(%rip), %rdi
+	call	efi_main
+	movq	%rax,%rsi
+	cmpq	$0,%rax
+	jne	2f
+fail:
+	/* EFI init failed, so hang. */
+	hlt
+	jmp	fail
+2:
+	movl	BP_code32_start(%esi), %eax
+	leaq	startup_64(%rax), %rax
+	jmp	*%rax
+ENDPROC(efi_pe_entry)
+
 	.org 0x390
 ENTRY(efi64_stub_entry)
 	movq	%rdi, efi64_config(%rip)	/* Handle */
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1657627 — Re: [PATCH 3/5] x86_64: boot, extract efi_pe_entry from startup_64

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2017-06-05 16:30 +0200
SubjectRe: [PATCH 3/5] x86_64: boot, extract efi_pe_entry from startup_64
Message-ID<tP1b3-41e-1@gated-at.bofh.it>
In reply to#1653956
On Wed, 31 May, at 10:12:41AM, Jiri Slaby wrote:
> efi_pe_entry body is somehow squashed into startup_64. In the old days,
> we forced startup_64 to start at offset 0x200 and efi_pe_entry to start
> at 0x210. But this requirement was removed in 99f857db8857 ("x86, build:
> Dynamically find entry points in compressed startup code") long time
> ago.
> 
> The way it is now makes the code less readable and illogical. And given
> we can now safely extract the inlined efi_pe_entry body from
> startup_64 into a separate function, we do so.
> 
> We also annotate the function appropriatelly by ENTRY+ENDPROC.
> 
> ABI offsets are preserved:
> 0000000000000000 T startup_32
> 0000000000000200 T startup_64
> 0000000000000390 T efi64_stub_entry
> 
> On the top-level, it looked like:
> 	.org 0x200
> 	ENTRY(startup_64)
> 	#ifdef CONFIG_EFI_STUB		; start of inlined
> 		jmp     preferred_addr
> 	GLOBAL(efi_pe_entry)
> 		... ; a lot of assembly (efi_pe_entry)
> 		leaq    preferred_addr(%rax), %rax
> 		jmp     *%rax
> 	preferred_addr:
> 	#endif				; end of inlined
> 		... ; a lot of assembly (startup_64)
> 	ENDPROC(startup_64)
> 
> And it is converted into:
> 	.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
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: <x86@kernel.org>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> ---
>  arch/x86/boot/compressed/head_64.S | 112 ++++++++++++++++++-------------------
>  1 file changed, 53 insertions(+), 59 deletions(-)

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>

[toc] | [prev] | [next] | [standalone]


#1653959 — [PATCH 2/5] x86_32: boot, extract efi_pe_entry from startup_32

FromJiri Slaby <jslaby@suse.cz>
Date2017-05-31 10:20 +0200
Subject[PATCH 2/5] x86_32: boot, extract efi_pe_entry from startup_32
Message-ID<tN71f-2f2-19@gated-at.bofh.it>
In reply to#1653953
efi_pe_entry body is somehow squashed into startup_32. In the old days,
we forced startup_32 to start at offset 0x00 and efi_pe_entry to start
at 0x10. But this requirement was removed in 99f857db8857 ("x86, build:
Dynamically find entry points in compressed startup code") long time
ago.

The way it is now makes the code less readable and illogical. And given
we can now safely extract the inlined efi_pe_entry body from
startup_32 into a separate function, we do so and we separate it to two
functions as they are marked already: efi_pe_entry + efi32_stub_entry.

We also annotate the functions appropriatelly by ENTRY+ENDPROC.

ABI offset is preserved:
  0000   128 FUNC    GLOBAL DEFAULT    6 startup_32
  0080    60 FUNC    GLOBAL DEFAULT    6 efi_pe_entry
  00bc    68 FUNC    GLOBAL DEFAULT    6 efi32_stub_entry

On the top-level, it looked like:
	ENTRY(startup_32)
	#ifdef CONFIG_EFI_STUB		; start of inlined
		jmp     preferred_addr
	ENTRY(efi_pe_entry)
		... ; a lot of assembly (efi_pe_entry)
	ENTRY(efi32_stub_entry)
		... ; a lot of assembly (efi32_stub_entry)
		leal    preferred_addr(%eax), %eax
		jmp     *%eax
	preferred_addr:
	#endif				; end of inlined
		... ; a lot of assembly (startup_32)
	ENDPROC(startup_32)

And it is converted into:
	ENTRY(startup_32)
		... ; a lot of assembly (startup_32)
	ENDPROC(startup_32)

	#ifdef CONFIG_EFI_STUB
	ENTRY(efi_pe_entry)
		... ; a lot of assembly (efi_pe_entry)
	ENDPROC(efi_pe_entry)

	ENTRY(efi32_stub_entry)
		... ; a lot of assembly (efi32_stub_entry)
		leal    startup_32(%eax), %eax
		jmp     *%eax
	ENDPROC(efi32_stub_entry)
	#endif

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <x86@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
---
 arch/x86/boot/compressed/head_32.S | 129 ++++++++++++++++++-------------------
 1 file changed, 64 insertions(+), 65 deletions(-)

diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index d85b9625e836..11c68cf53d4e 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -61,71 +61,6 @@
 
 	__HEAD
 ENTRY(startup_32)
-#ifdef CONFIG_EFI_STUB
-	jmp	preferred_addr
-
-	/*
-	 * We don't need the return address, so set up the stack so
-	 * efi_main() can find its arguments.
-	 */
-ENTRY(efi_pe_entry)
-	add	$0x4, %esp
-
-	call	1f
-1:	popl	%esi
-	subl	$1b, %esi
-
-	popl	%ecx
-	movl	%ecx, efi32_config(%esi)	/* Handle */
-	popl	%ecx
-	movl	%ecx, efi32_config+8(%esi)	/* EFI System table pointer */
-
-	/* Relocate efi_config->call() */
-	leal	efi32_config(%esi), %eax
-	add	%esi, 40(%eax)
-	pushl	%eax
-
-	call	make_boot_params
-	cmpl	$0, %eax
-	je	fail
-	movl	%esi, BP_code32_start(%eax)
-	popl	%ecx
-	pushl	%eax
-	pushl	%ecx
-	jmp	2f		/* Skip efi_config initialization */
-
-ENTRY(efi32_stub_entry)
-	add	$0x4, %esp
-	popl	%ecx
-	popl	%edx
-
-	call	1f
-1:	popl	%esi
-	subl	$1b, %esi
-
-	movl	%ecx, efi32_config(%esi)	/* Handle */
-	movl	%edx, efi32_config+8(%esi)	/* EFI System table pointer */
-
-	/* Relocate efi_config->call() */
-	leal	efi32_config(%esi), %eax
-	add	%esi, 40(%eax)
-	pushl	%eax
-2:
-	call	efi_main
-	cmpl	$0, %eax
-	movl	%eax, %esi
-	jne	2f
-fail:
-	/* EFI init failed, so hang. */
-	hlt
-	jmp	fail
-2:
-	movl	BP_code32_start(%esi), %eax
-	leal	preferred_addr(%eax), %eax
-	jmp	*%eax
-
-preferred_addr:
-#endif
 	cld
 	/*
 	 * Test KEEP_SEGMENTS flag to see if the bootloader is asking
@@ -208,6 +143,70 @@ preferred_addr:
 	jmp	*%eax
 ENDPROC(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)
+	add	$0x4, %esp
+
+	call	1f
+1:	popl	%esi
+	subl	$1b, %esi
+
+	popl	%ecx
+	movl	%ecx, efi32_config(%esi)	/* Handle */
+	popl	%ecx
+	movl	%ecx, efi32_config+8(%esi)	/* EFI System table pointer */
+
+	/* Relocate efi_config->call() */
+	leal	efi32_config(%esi), %eax
+	add	%esi, 40(%eax)
+	pushl	%eax
+
+	call	make_boot_params
+	cmpl	$0, %eax
+	je	fail
+	movl	%esi, BP_code32_start(%eax)
+	popl	%ecx
+	pushl	%eax
+	pushl	%ecx
+	jmp	2f		/* Skip efi_config initialization */
+ENDPROC(efi_pe_entry)
+
+ENTRY(efi32_stub_entry)
+	add	$0x4, %esp
+	popl	%ecx
+	popl	%edx
+
+	call	1f
+1:	popl	%esi
+	subl	$1b, %esi
+
+	movl	%ecx, efi32_config(%esi)	/* Handle */
+	movl	%edx, efi32_config+8(%esi)	/* EFI System table pointer */
+
+	/* Relocate efi_config->call() */
+	leal	efi32_config(%esi), %eax
+	add	%esi, 40(%eax)
+	pushl	%eax
+2:
+	call	efi_main
+	cmpl	$0, %eax
+	movl	%eax, %esi
+	jne	2f
+fail:
+	/* EFI init failed, so hang. */
+	hlt
+	jmp	fail
+2:
+	movl	BP_code32_start(%esi), %eax
+	leal	startup_32(%eax), %eax
+	jmp	*%eax
+ENDPROC(efi32_stub_entry)
+#endif
+
 	.text
 relocated:
 
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1657634 — Re: [PATCH 2/5] x86_32: boot, extract efi_pe_entry from startup_32

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2017-06-05 16:30 +0200
SubjectRe: [PATCH 2/5] x86_32: boot, extract efi_pe_entry from startup_32
Message-ID<tP1b4-41e-25@gated-at.bofh.it>
In reply to#1653959
On Wed, 31 May, at 10:12:40AM, Jiri Slaby wrote:
> efi_pe_entry body is somehow squashed into startup_32. In the old days,
> we forced startup_32 to start at offset 0x00 and efi_pe_entry to start
> at 0x10. But this requirement was removed in 99f857db8857 ("x86, build:
> Dynamically find entry points in compressed startup code") long time
> ago.
> 
> The way it is now makes the code less readable and illogical. And given
> we can now safely extract the inlined efi_pe_entry body from
> startup_32 into a separate function, we do so and we separate it to two
> functions as they are marked already: efi_pe_entry + efi32_stub_entry.
> 
> We also annotate the functions appropriatelly by ENTRY+ENDPROC.
> 
> ABI offset is preserved:
>   0000   128 FUNC    GLOBAL DEFAULT    6 startup_32
>   0080    60 FUNC    GLOBAL DEFAULT    6 efi_pe_entry
>   00bc    68 FUNC    GLOBAL DEFAULT    6 efi32_stub_entry
> 
> On the top-level, it looked like:
> 	ENTRY(startup_32)
> 	#ifdef CONFIG_EFI_STUB		; start of inlined
> 		jmp     preferred_addr
> 	ENTRY(efi_pe_entry)
> 		... ; a lot of assembly (efi_pe_entry)
> 	ENTRY(efi32_stub_entry)
> 		... ; a lot of assembly (efi32_stub_entry)
> 		leal    preferred_addr(%eax), %eax
> 		jmp     *%eax
> 	preferred_addr:
> 	#endif				; end of inlined
> 		... ; a lot of assembly (startup_32)
> 	ENDPROC(startup_32)
> 
> And it is converted into:
> 	ENTRY(startup_32)
> 		... ; a lot of assembly (startup_32)
> 	ENDPROC(startup_32)
> 
> 	#ifdef CONFIG_EFI_STUB
> 	ENTRY(efi_pe_entry)
> 		... ; a lot of assembly (efi_pe_entry)
> 	ENDPROC(efi_pe_entry)
> 
> 	ENTRY(efi32_stub_entry)
> 		... ; a lot of assembly (efi32_stub_entry)
> 		leal    startup_32(%eax), %eax
> 		jmp     *%eax
> 	ENDPROC(efi32_stub_entry)
> 	#endif
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: <x86@kernel.org>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> ---
>  arch/x86/boot/compressed/head_32.S | 129 ++++++++++++++++++-------------------
>  1 file changed, 64 insertions(+), 65 deletions(-)

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>

[toc] | [prev] | [next] | [standalone]


#1653965 — [PATCH 5/5] x86: entry, use ENTRY instead of ALIGN+GLOBAL for stub32_clone

FromJiri Slaby <jslaby@suse.cz>
Date2017-05-31 10:20 +0200
Subject[PATCH 5/5] x86: entry, use ENTRY instead of ALIGN+GLOBAL for stub32_clone
Message-ID<tN71g-2f2-31@gated-at.bofh.it>
In reply to#1653953
ALIGN+GLOBAL is effectively what ENTRY does, so use ENTRY which is
dedicated for global functions.

Note that this is a C-like leaf function -- it has a correct stack
frame, switches one argument and continues by jumping into C. And since
each ENTRY should be balanced by some END*, we add a corresponding
ENDPROC to stub32_clone too.

Besides that, x86's custom GLOBAL macro is going to die very soon.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <x86@kernel.org>
---
 arch/x86/entry/entry_64_compat.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S
index e1721dafbcb1..aa8a0fa385f3 100644
--- a/arch/x86/entry/entry_64_compat.S
+++ b/arch/x86/entry/entry_64_compat.S
@@ -342,8 +342,7 @@ ENTRY(entry_INT80_compat)
 	jmp	restore_regs_and_iret
 END(entry_INT80_compat)
 
-	ALIGN
-GLOBAL(stub32_clone)
+ENTRY(stub32_clone)
 	/*
 	 * The 32-bit clone ABI is: clone(..., int tls_val, int *child_tidptr).
 	 * The 64-bit clone ABI is: clone(..., int *child_tidptr, int tls_val).
@@ -353,3 +352,4 @@ GLOBAL(stub32_clone)
 	 */
 	xchg	%r8, %rcx
 	jmp	sys_clone
+ENDPROC(stub32_clone)
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1653966 — [PATCH 4/5] x86: math-emu, add ENDPROC to functions

FromJiri Slaby <jslaby@suse.cz>
Date2017-05-31 10:20 +0200
Subject[PATCH 4/5] x86: math-emu, add ENDPROC to functions
Message-ID<tN71g-2f2-39@gated-at.bofh.it>
In reply to#1653953
Functions in math-emu are annotated as ENTRY, but their ends are not
annotated at all. But these are standard functions called from C, with
proper stack register update etc.

Omitting the ends means:
* the annotations are not paired and we cannot deal with such functions
  e.g. in objtool
* the symbols are not marked as functions in the object file
* there are no sizes of the functions in the object file

So fix this by adding ENDPROC to each such case in math-emu.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <x86@kernel.org>
---
 arch/x86/math-emu/div_Xsig.S     | 1 +
 arch/x86/math-emu/div_small.S    | 2 +-
 arch/x86/math-emu/mul_Xsig.S     | 4 +++-
 arch/x86/math-emu/polynom_Xsig.S | 1 +
 arch/x86/math-emu/reg_norm.S     | 2 ++
 arch/x86/math-emu/reg_round.S    | 2 ++
 arch/x86/math-emu/reg_u_add.S    | 1 +
 arch/x86/math-emu/reg_u_div.S    | 2 ++
 arch/x86/math-emu/reg_u_mul.S    | 1 +
 arch/x86/math-emu/reg_u_sub.S    | 1 +
 arch/x86/math-emu/round_Xsig.S   | 4 ++--
 arch/x86/math-emu/shr_Xsig.S     | 1 +
 arch/x86/math-emu/wm_shrx.S      | 2 ++
 arch/x86/math-emu/wm_sqrt.S      | 1 +
 14 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/x86/math-emu/div_Xsig.S b/arch/x86/math-emu/div_Xsig.S
index f77ba3058b31..066996dba6a2 100644
--- a/arch/x86/math-emu/div_Xsig.S
+++ b/arch/x86/math-emu/div_Xsig.S
@@ -363,3 +363,4 @@ L_bugged_2:
 	pop	%ebx
 	jmp	L_exit
 #endif /* PARANOID */ 
+ENDPROC(div_Xsig)
diff --git a/arch/x86/math-emu/div_small.S b/arch/x86/math-emu/div_small.S
index 47099628fa4c..2c71527bd917 100644
--- a/arch/x86/math-emu/div_small.S
+++ b/arch/x86/math-emu/div_small.S
@@ -44,4 +44,4 @@ ENTRY(FPU_div_small)
 
 	leave
 	ret
-
+ENDPROC(FPU_div_small)
diff --git a/arch/x86/math-emu/mul_Xsig.S b/arch/x86/math-emu/mul_Xsig.S
index 717785a53eb4..22e0631bb85a 100644
--- a/arch/x86/math-emu/mul_Xsig.S
+++ b/arch/x86/math-emu/mul_Xsig.S
@@ -62,6 +62,7 @@ ENTRY(mul32_Xsig)
 	popl %esi
 	leave
 	ret
+ENDPROC(mul32_Xsig)
 
 
 ENTRY(mul64_Xsig)
@@ -114,6 +115,7 @@ ENTRY(mul64_Xsig)
 	popl %esi
 	leave
 	ret
+ENDPROC(mul64_Xsig)
 
 
 
@@ -173,4 +175,4 @@ ENTRY(mul_Xsig_Xsig)
 	popl %esi
 	leave
 	ret
-
+ENDPROC(mul_Xsig_Xsig)
diff --git a/arch/x86/math-emu/polynom_Xsig.S b/arch/x86/math-emu/polynom_Xsig.S
index 17315c89ff3d..a9aaf414135d 100644
--- a/arch/x86/math-emu/polynom_Xsig.S
+++ b/arch/x86/math-emu/polynom_Xsig.S
@@ -133,3 +133,4 @@ L_accum_done:
 	popl	%esi
 	leave
 	ret
+ENDPROC(polynomial_Xsig)
diff --git a/arch/x86/math-emu/reg_norm.S b/arch/x86/math-emu/reg_norm.S
index 8b6352efceef..53ac1a343c69 100644
--- a/arch/x86/math-emu/reg_norm.S
+++ b/arch/x86/math-emu/reg_norm.S
@@ -94,6 +94,7 @@ L_overflow:
 	call	arith_overflow
 	pop	%ebx
 	jmp	L_exit
+ENDPROC(FPU_normalize)
 
 
 
@@ -145,3 +146,4 @@ L_exit_nuo_zero:
 	popl	%ebx
 	leave
 	ret
+ENDPROC(FPU_normalize_nuo)
diff --git a/arch/x86/math-emu/reg_round.S b/arch/x86/math-emu/reg_round.S
index d1d4e48b4f67..41af5b208d88 100644
--- a/arch/x86/math-emu/reg_round.S
+++ b/arch/x86/math-emu/reg_round.S
@@ -706,3 +706,5 @@ L_exception_exit:
 	mov	$-1,%eax
 	jmp	fpu_reg_round_special_exit
 #endif /* PARANOID */ 
+
+ENDPROC(FPU_round)
diff --git a/arch/x86/math-emu/reg_u_add.S b/arch/x86/math-emu/reg_u_add.S
index 47c4c2434d85..3b1bc5e9b2f6 100644
--- a/arch/x86/math-emu/reg_u_add.S
+++ b/arch/x86/math-emu/reg_u_add.S
@@ -165,3 +165,4 @@ L_exit:
 	leave
 	ret
 #endif /* PARANOID */
+ENDPROC(FPU_u_add)
diff --git a/arch/x86/math-emu/reg_u_div.S b/arch/x86/math-emu/reg_u_div.S
index cc00654b6f9a..796eb5ab921b 100644
--- a/arch/x86/math-emu/reg_u_div.S
+++ b/arch/x86/math-emu/reg_u_div.S
@@ -469,3 +469,5 @@ L_exit:
 	leave
 	ret
 #endif /* PARANOID */ 
+
+ENDPROC(FPU_u_div)
diff --git a/arch/x86/math-emu/reg_u_mul.S b/arch/x86/math-emu/reg_u_mul.S
index 973f12af97df..6196f68cf3c1 100644
--- a/arch/x86/math-emu/reg_u_mul.S
+++ b/arch/x86/math-emu/reg_u_mul.S
@@ -146,3 +146,4 @@ L_exit:
 	ret
 #endif /* PARANOID */ 
 
+ENDPROC(FPU_u_mul)
diff --git a/arch/x86/math-emu/reg_u_sub.S b/arch/x86/math-emu/reg_u_sub.S
index 1b6c24801d22..d115b900919a 100644
--- a/arch/x86/math-emu/reg_u_sub.S
+++ b/arch/x86/math-emu/reg_u_sub.S
@@ -270,3 +270,4 @@ L_exit:
 	popl	%esi
 	leave
 	ret
+ENDPROC(FPU_u_sub)
diff --git a/arch/x86/math-emu/round_Xsig.S b/arch/x86/math-emu/round_Xsig.S
index bbe0e87718e4..87c99749a495 100644
--- a/arch/x86/math-emu/round_Xsig.S
+++ b/arch/x86/math-emu/round_Xsig.S
@@ -78,7 +78,7 @@ L_exit:
 	popl	%ebx
 	leave
 	ret
-
+ENDPROC(round_Xsig)
 
 
 
@@ -138,4 +138,4 @@ L_n_exit:
 	popl	%ebx
 	leave
 	ret
-
+ENDPROC(norm_Xsig)
diff --git a/arch/x86/math-emu/shr_Xsig.S b/arch/x86/math-emu/shr_Xsig.S
index 31cdd118e918..c8552edeec75 100644
--- a/arch/x86/math-emu/shr_Xsig.S
+++ b/arch/x86/math-emu/shr_Xsig.S
@@ -85,3 +85,4 @@ L_more_than_95:
 	popl	%esi
 	leave
 	ret
+ENDPROC(shr_Xsig)
diff --git a/arch/x86/math-emu/wm_shrx.S b/arch/x86/math-emu/wm_shrx.S
index 518428317985..340dd6897f85 100644
--- a/arch/x86/math-emu/wm_shrx.S
+++ b/arch/x86/math-emu/wm_shrx.S
@@ -92,6 +92,7 @@ L_more_than_95:
 	popl	%esi
 	leave
 	ret
+ENDPROC(FPU_shrx)
 
 
 /*---------------------------------------------------------------------------+
@@ -202,3 +203,4 @@ Ls_more_than_95:
 	popl	%esi
 	leave
 	ret
+ENDPROC(FPU_shrxs)
diff --git a/arch/x86/math-emu/wm_sqrt.S b/arch/x86/math-emu/wm_sqrt.S
index d258f59564e1..695afae38fdf 100644
--- a/arch/x86/math-emu/wm_sqrt.S
+++ b/arch/x86/math-emu/wm_sqrt.S
@@ -468,3 +468,4 @@ sqrt_more_prec_large:
 /* Our estimate is too large */
 	movl	$0x7fffff00,%eax
 	jmp	sqrt_round_result
+ENDPROC(wm_sqrt)
-- 
2.13.0

[toc] | [prev] | [next] | [standalone]


#1657442 — [tip:x86/boot] x86/boot: Remove unused copy_*_gs() functions

Fromtip-bot for Jiri Slaby <tipbot@zytor.com>
Date2017-06-05 11:20 +0200
Subject[tip:x86/boot] x86/boot: Remove unused copy_*_gs() functions
Message-ID<tOWl4-12Q-41@gated-at.bofh.it>
In reply to#1653953
Commit-ID:  28be1b454c2bb60e317b3135211a378fa2718886
Gitweb:     http://git.kernel.org/tip/28be1b454c2bb60e317b3135211a378fa2718886
Author:     Jiri Slaby <jslaby@suse.cz>
AuthorDate: Wed, 31 May 2017 10:12:39 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 5 Jun 2017 09:35:16 +0200

x86/boot: Remove unused copy_*_gs() functions

copy_from_gs() and copy_to_gs() are unused in the boot code. They have
actually never been used -- they were always commented out since their
addition in 2007:

  5be865661516 ("String-handling functions for the new x86 setup code.")

So remove them -- they can be restored from history if needed.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170531081243.5709-1-jslaby@suse.cz
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/boot/copy.S | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/arch/x86/boot/copy.S b/arch/x86/boot/copy.S
index 1eb7d29..15d9f74 100644
--- a/arch/x86/boot/copy.S
+++ b/arch/x86/boot/copy.S
@@ -65,23 +65,3 @@ GLOBAL(copy_to_fs)
 	popw	%es
 	retl
 ENDPROC(copy_to_fs)
-
-#if 0 /* Not currently used, but can be enabled as needed */
-GLOBAL(copy_from_gs)
-	pushw	%ds
-	pushw	%gs
-	popw	%ds
-	calll	memcpy
-	popw	%ds
-	retl
-ENDPROC(copy_from_gs)
-
-GLOBAL(copy_to_gs)
-	pushw	%es
-	pushw	%gs
-	popw	%es
-	calll	memcpy
-	popw	%es
-	retl
-ENDPROC(copy_to_gs)
-#endif

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web