Skip to content

Instantly share code, notes, and snippets.

@IJzerbaard
Created February 18, 2019 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IJzerbaard/25daf7a143525d4eda8e0e6dbc9d1b93 to your computer and use it in GitHub Desktop.
Save IJzerbaard/25daf7a143525d4eda8e0e6dbc9d1b93 to your computer and use it in GitHub Desktop.
section .data
align 64
buf1: dq 0
section .text
global storeload_L
proc_frame storeload_L
alloc_stack 8
[endprolog]
align 64
; 16 is good, 15 is bad
; 0 is inconsistent
times 16 nop
mov r8, rcx
rdtscp
mov rcx, r8
mov r8d, eax
jmp .entry
align 4096
.entry:
; these nops have to be here for some reason
; a single 3-byte nop does *not* work
times 3 nop
; this lea can only be right here,
; not before the align, not even before the 3 nops
lea rdx, [rel buf1]
.loop:
mov [rdx], rax
mov rax, [rdx]
sub ecx, 1
jnz .loop
rdtscp
sub eax, r8d
add rsp, 8
ret
endproc_frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment