[FREELDR/x64] Merge x64 and x86 versions, to fix compilation with GAS x64

Upper bits of rcx are already checked to be 0. So, we can only take care of lower bits.
This also generates smaller code.
This commit is contained in:
Hervé Poussineau 2021-01-28 22:03:08 +01:00
parent 2a6d8465d6
commit ec7d874c18

View file

@ -119,12 +119,12 @@ reloc_down:
#if 0
rep movsb
#else
mov rdx, rcx // Copy the total number of bytes in EDX
and rdx, HEX(0FFFFFFFC) // Number of bytes we copy using DWORDs
xor rdx, rcx // Number of remaining bytes to copy after the DWORDs
shr rcx, 2 // Count number of DWORDs
mov edx, ecx // Copy the total number of bytes in EDX
and edx, HEX(0FFFFFFFC) // Number of bytes we copy using DWORDs
xor edx, ecx // Number of remaining bytes to copy after the DWORDs
shr ecx, 2 // Count number of DWORDs
rep movsd // Move DWORDs
mov rcx, rdx // Count number of remaining bytes
mov ecx, edx // Count number of remaining bytes
rep movsb // Move bytes
#endif
jmp after_reloc