From 6f0e865d0e9b875c2770b5634a002a0a531aceca Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 3 Jan 2018 11:04:26 +0100 Subject: [PATCH] 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 Reviewed-by: Andrew Cooper --- xen/arch/x86/boot/mem.S | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/boot/mem.S b/xen/arch/x86/boot/mem.S index ca90db0a5d..c6a9bd4d3b 100644 --- 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 -- 2.30.2