]> xenbits.xensource.com Git - xen.git/commitdiff
x86/E820: improve insn selection
authorJan Beulich <jbeulich@suse.com>
Wed, 3 Jan 2018 10:04:26 +0000 (11:04 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 Jan 2018 10:04:26 +0000 (11:04 +0100)
..., 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@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/boot/mem.S

index ca90db0a5d350f58b5ffd3d7d6eb237a2d1fc464..c6a9bd4d3bac3aa26b6813b318066d559a87ae4b 100644 (file)
@@ -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