-
-
Save plvhx/fdc4b28079f730423156a666479b8838 to your computer and use it in GitHub Desktop.
helper #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section .text | |
.globl le32_to_be32 | |
.type le32_to_be32, @function | |
le32_to_be32: | |
pushl %ebp | |
movl %esp, %ebp | |
subl $0x14, %esp | |
pushl %ebx | |
pushl %ecx | |
pushl %edx | |
pushl %edi | |
pushl %esi | |
movl 0x08(%ebp), %ebx | |
xorl %edx, %edx | |
xorl %edi, %edi | |
movb %bl, %dl | |
shll $0x18, %edx | |
orl %edx, %edi | |
xorl %edx, %edx | |
movb %bh, %dl | |
shll $0x10, %edx | |
orl %edx, %edi | |
shrl $0x10, %ebx | |
xorl %edx, %edx | |
movb %bl, %dl | |
shll $0x08, %edx | |
orl %edx, %edi | |
xorl %edx, %edx | |
movb %bh, %dl | |
orl %edx, %edi | |
movl %edi, %eax | |
popl %esi | |
popl %edi | |
popl %edx | |
popl %ecx | |
popl %ebx | |
addl $0x14, %esp | |
popl %ebp | |
ret | |
.globl _start | |
_start: | |
movl $0x11223344, %ebx | |
int3 | |
subl $0x04, %esp | |
pushl %ebx | |
call le32_to_be32 | |
popl %ebx | |
addl $0x04, %esp | |
movl %eax, %ebx | |
int3 | |
nop | |
nop | |
nop | |
nop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment