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

[Xen-devel] [PATCH 2/2] x86/E820: improve insn selection



..., largely to shrink code size a little:
- use TEST instead of CMP with zero immediate
- use MOVZWL instead of AND with 0xffff immediate
- compute final highmem_bk value in registers, accessing memory just
  once

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/boot/mem.S
+++ b/xen/arch/x86/boot/mem.S
@@ -29,8 +29,8 @@ get_memory_map:
         movw    %di,%ax
         addw    $20,%ax
         movw    %ax,%di
-        cmpl    $0,%ebx                         # check to see if
-        jne     1b                              # %ebx is set to EOF
+        testl   %ebx,%ebx                       # check to see if
+        jnz     1b                              # %ebx is set to EOF
 
 .Lmem88:
         movb    $0x88, %ah
@@ -48,17 +48,17 @@ get_memory_map:
         int     $0x15
         jc      .Lint12
 
-        cmpw    $0x0, %cx                       # Kludge to handle BIOSes
-        jne     1f                              # which report their extended
-        cmpw    $0x0, %dx                       # memory in AX/BX rather than
-        jne     1f                              # CX/DX.  The spec I have read
+        testw   %cx, %cx                        # Kludge to handle BIOSes
+        jnz     1f                              # which report their extended
+        testw   %dx, %dx                        # memory in AX/BX rather than
+        jnz     1f                              # CX/DX.  The spec I have read
         movw    %ax, %cx                        # seems to indicate AX/BX 
         movw    %bx, %dx                        # are more reasonable anyway...
-1:      andl    $0xffff,%edx                    # clear sign extend
+1:      movzwl  %dx, %edx
         shll    $6,%edx                         # and go from 64k to 1k chunks
+        movzwl  %cx, %ecx
+        addl    %ecx, %edx                      # add in lower memory
         movl    %edx,bootsym(highmem_kb)        # store extended memory size
-        andl    $0xffff,%ecx                    # clear sign extend
-        addl    %ecx,bootsym(highmem_kb)        # and add lower memory into
 
 .Lint12:
         int     $0x12




_______________________________________________
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®.