public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] x86 boot cleanups
@ 2011-02-26 17:54 Brian Gerst
  2011-02-26 17:54 ` [PATCH 1/3] x86, boot: Use common ELF header defines Brian Gerst
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Brian Gerst @ 2011-02-26 17:54 UTC (permalink / raw)
  To: hpa; +Cc: x86, linux-kernel

Here are three small patches that merge 32 and 64 bit code in the boot code.

[PATCH 1/3] x86, boot: Use common ELF header defines
[PATCH 2/3] x86, boot: Remove memptr
[PATCH 3/3] x86, boot: merge memcpy()

 arch/x86/boot/compressed/misc.c |   44 ++++++++------------------------------
 1 files changed, 10 insertions(+), 34 deletions(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] x86, boot: Use common ELF header defines
  2011-02-26 17:54 [PATCH 0/3] x86 boot cleanups Brian Gerst
@ 2011-02-26 17:54 ` Brian Gerst
  2011-02-27 11:05   ` Pekka Enberg
  2011-02-26 17:54 ` [PATCH 2/3] x86, boot: Remove memptr Brian Gerst
  2011-02-26 17:54 ` [PATCH 3/3] x86, boot: merge memcpy() Brian Gerst
  2 siblings, 1 reply; 7+ messages in thread
From: Brian Gerst @ 2011-02-26 17:54 UTC (permalink / raw)
  To: hpa; +Cc: x86, linux-kernel

<linux/elf.h> defines elfhdr and elf_phdr appropriately for 32-bit
and 64-bit.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/boot/compressed/misc.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 3a19d04..2d57c97 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -275,13 +275,8 @@ static void error(char *x)
 
 static void parse_elf(void *output)
 {
-#ifdef CONFIG_X86_64
-	Elf64_Ehdr ehdr;
-	Elf64_Phdr *phdrs, *phdr;
-#else
-	Elf32_Ehdr ehdr;
-	Elf32_Phdr *phdrs, *phdr;
-#endif
+	struct elfhdr ehdr;
+	struct elf_phdr *phdrs, *phdr;
 	void *dest;
 	int i;
 
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] x86, boot: Remove memptr
  2011-02-26 17:54 [PATCH 0/3] x86 boot cleanups Brian Gerst
  2011-02-26 17:54 ` [PATCH 1/3] x86, boot: Use common ELF header defines Brian Gerst
@ 2011-02-26 17:54 ` Brian Gerst
  2011-02-27 11:07   ` Pekka Enberg
  2011-02-26 17:54 ` [PATCH 3/3] x86, boot: merge memcpy() Brian Gerst
  2 siblings, 1 reply; 7+ messages in thread
From: Brian Gerst @ 2011-02-26 17:54 UTC (permalink / raw)
  To: hpa; +Cc: x86, linux-kernel

Use unsigned long for free memory pointers for both 32-bit and 64-bit.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/boot/compressed/misc.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 2d57c97..c13b5e9 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -114,14 +114,8 @@ static int debug;
 void *memset(void *s, int c, size_t n);
 void *memcpy(void *dest, const void *src, size_t n);
 
-#ifdef CONFIG_X86_64
-#define memptr long
-#else
-#define memptr unsigned
-#endif
-
-static memptr free_mem_ptr;
-static memptr free_mem_end_ptr;
+static unsigned long free_mem_ptr;
+static unsigned long free_mem_end_ptr;
 
 static char *vidmem;
 static int vidport;
@@ -318,7 +312,7 @@ static void parse_elf(void *output)
 	}
 }
 
-asmlinkage void decompress_kernel(void *rmode, memptr heap,
+asmlinkage void decompress_kernel(void *rmode, unsigned long heap,
 				  unsigned char *input_data,
 				  unsigned long input_len,
 				  unsigned char *output)
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] x86, boot: merge memcpy()
  2011-02-26 17:54 [PATCH 0/3] x86 boot cleanups Brian Gerst
  2011-02-26 17:54 ` [PATCH 1/3] x86, boot: Use common ELF header defines Brian Gerst
  2011-02-26 17:54 ` [PATCH 2/3] x86, boot: Remove memptr Brian Gerst
@ 2011-02-26 17:54 ` Brian Gerst
  2011-02-27 11:11   ` Pekka Enberg
  2 siblings, 1 reply; 7+ messages in thread
From: Brian Gerst @ 2011-02-26 17:54 UTC (permalink / raw)
  To: hpa; +Cc: x86, linux-kernel

Merge the 32-bit and 64-bit memcpy functions.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
 arch/x86/boot/compressed/misc.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index c13b5e9..704bec1 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -10,6 +10,7 @@
  */
 
 #include "misc.h"
+#include <asm/asm.h>
 
 /* WARNING!!
  * This code is compiled with -fPIC and it is relocated dynamically
@@ -227,35 +228,21 @@ void *memset(void *s, int c, size_t n)
 		ss[i] = c;
 	return s;
 }
-#ifdef CONFIG_X86_32
-void *memcpy(void *dest, const void *src, size_t n)
-{
-	int d0, d1, d2;
-	asm volatile(
-		"rep ; movsl\n\t"
-		"movl %4,%%ecx\n\t"
-		"rep ; movsb\n\t"
-		: "=&c" (d0), "=&D" (d1), "=&S" (d2)
-		: "0" (n >> 2), "g" (n & 3), "1" (dest), "2" (src)
-		: "memory");
 
-	return dest;
-}
-#else
 void *memcpy(void *dest, const void *src, size_t n)
 {
 	long d0, d1, d2;
 	asm volatile(
-		"rep ; movsq\n\t"
-		"movq %4,%%rcx\n\t"
+		"rep ; " __ASM_SIZE(movs) "\n\t"
+		"mov %4,%0\n\t"
 		"rep ; movsb\n\t"
 		: "=&c" (d0), "=&D" (d1), "=&S" (d2)
-		: "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src)
+		: "0" (n / sizeof(long)), "g" (n & (sizeof(long) - 1)),
+		  "1" (dest), "2" (src)
 		: "memory");
 
 	return dest;
 }
-#endif
 
 static void error(char *x)
 {
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] x86, boot: Use common ELF header defines
  2011-02-26 17:54 ` [PATCH 1/3] x86, boot: Use common ELF header defines Brian Gerst
@ 2011-02-27 11:05   ` Pekka Enberg
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-02-27 11:05 UTC (permalink / raw)
  To: Brian Gerst; +Cc: hpa, x86, linux-kernel

On Sat, Feb 26, 2011 at 7:54 PM, Brian Gerst <brgerst@gmail.com> wrote:
> <linux/elf.h> defines elfhdr and elf_phdr appropriately for 32-bit
> and 64-bit.
>
> Signed-off-by: Brian Gerst <brgerst@gmail.com>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] x86, boot: Remove memptr
  2011-02-26 17:54 ` [PATCH 2/3] x86, boot: Remove memptr Brian Gerst
@ 2011-02-27 11:07   ` Pekka Enberg
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-02-27 11:07 UTC (permalink / raw)
  To: Brian Gerst; +Cc: hpa, x86, linux-kernel

On Sat, Feb 26, 2011 at 7:54 PM, Brian Gerst <brgerst@gmail.com> wrote:
> Use unsigned long for free memory pointers for both 32-bit and 64-bit.
>
> Signed-off-by: Brian Gerst <brgerst@gmail.com>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] x86, boot: merge memcpy()
  2011-02-26 17:54 ` [PATCH 3/3] x86, boot: merge memcpy() Brian Gerst
@ 2011-02-27 11:11   ` Pekka Enberg
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-02-27 11:11 UTC (permalink / raw)
  To: Brian Gerst; +Cc: hpa, x86, linux-kernel

On Sat, Feb 26, 2011 at 7:54 PM, Brian Gerst <brgerst@gmail.com> wrote:
> Merge the 32-bit and 64-bit memcpy functions.
>
> Signed-off-by: Brian Gerst <brgerst@gmail.com>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-27 11:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26 17:54 [PATCH 0/3] x86 boot cleanups Brian Gerst
2011-02-26 17:54 ` [PATCH 1/3] x86, boot: Use common ELF header defines Brian Gerst
2011-02-27 11:05   ` Pekka Enberg
2011-02-26 17:54 ` [PATCH 2/3] x86, boot: Remove memptr Brian Gerst
2011-02-27 11:07   ` Pekka Enberg
2011-02-26 17:54 ` [PATCH 3/3] x86, boot: merge memcpy() Brian Gerst
2011-02-27 11:11   ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox