section .text global memcpy32to64 memcpy32to64: push ebp mov ebp, esp push esi push edi push 0x28 call .p1 .p1: add dword [esp], .mode64 - .p1 retfd bits 64 .mode64: mov rdi, [rbp + 8] mov rsi, [rbp + 16] mov rcx, [rbp + 24] rep movsb push 0x18 call .p2 .p2: add qword [rsp], .mode32 - .p2 retfq bits 32 .mode32: pop edi pop esi pop ebp ret