[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 1/6] x86/boot: Remove gratuitous call back into low-memory code



From: David Woodhouse <dwmw@xxxxxxxxxxxx>

We appear to have implemented a memcpy() in the low-memory trampoline
which we then call into from __start_xen(), for no adequately defined
reason.

Kill it with fire.

Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
v2: Minor fixups from Andrew.

 xen/arch/x86/boot/mem.S    | 27 +++++----------------------
 xen/arch/x86/setup.c       | 10 ++++++++++
 xen/include/asm-x86/e820.h |  5 ++---
 3 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/xen/arch/x86/boot/mem.S b/xen/arch/x86/boot/mem.S
index c6a9bd4d3b..2d61d28835 100644
--- a/xen/arch/x86/boot/mem.S
+++ b/xen/arch/x86/boot/mem.S
@@ -7,7 +7,7 @@ get_memory_map:
 
 .Lmeme820:
         xorl    %ebx, %ebx                      # continuation counter
-        movw    $bootsym(e820map), %di             # point into the whitelist
+        movw    $bootsym(bios_e820map), %di     # point into the whitelist
                                                 # so we can have the bios
                                                 # directly write into it.
 
@@ -22,8 +22,8 @@ get_memory_map:
         cmpl    $SMAP,%eax                      # check the return is `SMAP'
         jne     .Lmem88
 
-        incw    bootsym(e820nr)
-        cmpw    $E820_BIOS_MAX,bootsym(e820nr)  # up to this many entries
+        incw    bootsym(bios_e820nr)
+        cmpw    $E820_BIOS_MAX,bootsym(bios_e820nr) # up to this many entries
         jae     .Lmem88
 
         movw    %di,%ax
@@ -66,27 +66,10 @@ get_memory_map:
 
         ret
 
-/*
- * Copy E820 map obtained from BIOS to a buffer allocated by Xen.
- * Input: %rdi: target address of e820 entry array
- *        %esi: maximum number of entries to copy
- * Output: %eax: number of entries copied
- */
-        .code64
-ENTRY(e820map_copy)
-        mov     %esi, %eax
-        lea     e820map(%rip), %rsi
-        mov     e820nr(%rip), %ecx
-        cmp     %ecx, %eax
-        cmova   %ecx, %eax                      # number of entries to move
-        imul    $5, %eax, %ecx
-        rep movsl                               # do the move
-        ret
-
         .align  4
-e820map:
+GLOBAL(bios_e820map)
         .fill   E820_BIOS_MAX*20,1,0
-e820nr:
+GLOBAL(bios_e820nr)
         .long   0
 GLOBAL(lowmem_kb)
         .long   0
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d2011910fa..decea2e77a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -672,6 +672,16 @@ static char * __init cmdline_cook(char *p, const char 
*loader_name)
     return p;
 }
 
+static unsigned int __init copy_bios_e820(struct e820entry *map, unsigned int 
limit)
+{
+    unsigned int n = min(bootsym(bios_e820nr), limit);
+
+    if ( n )
+        memcpy(map, bootsym(bios_e820map), sizeof(*map) * n);
+
+    return n;
+}
+
 void __init noreturn __start_xen(unsigned long mbi_p)
 {
     char *memmap_type = NULL;
diff --git a/xen/include/asm-x86/e820.h b/xen/include/asm-x86/e820.h
index ee317b17aa..52916fb75d 100644
--- a/xen/include/asm-x86/e820.h
+++ b/xen/include/asm-x86/e820.h
@@ -37,8 +37,7 @@ extern struct e820map e820_raw;
 
 /* These symbols live in the boot trampoline. */
 extern unsigned int lowmem_kb, highmem_kb;
-unsigned int e820map_copy(struct e820entry *map, unsigned int limit);
-
-#define copy_bios_e820 bootsym(e820map_copy)
+extern struct e820map bios_e820map[];
+extern unsigned int bios_e820nr;
 
 #endif /*__E820_HEADER*/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.