Created
August 22, 2012 09:23
-
-
Save upsuper/3423998 to your computer and use it in GitHub Desktop.
"xor rax, rax" vs. "mov rax, 0"
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
| Environment: Mac OS X 10.7.4 | |
| Compiler: yasm 1.2.0 |
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
| all: mov xor | |
| mov: mov.o | |
| ld -o mov mov.o | |
| xor: xor.o | |
| ld -o xor xor.o | |
| mov.o: mov.asm | |
| yasm -f macho64 -o mov.o mov.asm | |
| xor.o: xor.asm | |
| yasm -f macho64 -o xor.o xor.asm |
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
| global start | |
| start: | |
| mov rcx, 1048576 | |
| loop0: | |
| times 1024 mov rax, 0 | |
| dec rcx | |
| jnz loop0 | |
| mov rax, 0x2000001 | |
| mov rdi, 0 | |
| syscall |
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
| global start | |
| start: | |
| mov rcx, 1048576 | |
| loop0: | |
| times 1024 xor rax, rax | |
| dec rcx | |
| jnz loop0 | |
| mov rax, 0x2000001 | |
| mov rdi, 0 | |
| syscall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment