Created
June 29, 2014 13:26
-
-
Save haileys/636ba617a5f276b2abde to your computer and use it in GitHub Desktop.
This file contains 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 | |
global _main | |
extern _printf | |
%define SYSCALL_COUNT_EXPONENT 20 | |
%define SYSCALLS_PER_ITERATION 4 | |
fmt_lld db "%lld", 10, 0 | |
_main: | |
sub rsp, 8 | |
mov r15, (1 << SYSCALL_COUNT_EXPONENT) / SYSCALLS_PER_ITERATION | |
rdtsc | |
shl rdx, 32 | |
or rax, rdx | |
mov r14, rax | |
.begin: | |
%rep SYSCALLS_PER_ITERATION | |
mov rax, 0x2000000 | 20 ; getpid | |
syscall | |
%endrep | |
dec r15 | |
test r15, r15 | |
jnz .begin | |
rdtsc | |
shl rdx, 32 | |
or rax, rdx | |
sub rax, r14 | |
shr rax, SYSCALL_COUNT_EXPONENT | |
mov rdi, fmt_lld | |
mov rsi, rax | |
call _printf | |
xor rax, rax | |
add rsp, 8 | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment