Skip to content

Instantly share code, notes, and snippets.

@travisdowns
Created April 17, 2017 17:34
Show Gist options
  • Save travisdowns/3204822a9ebdf5877a4287ac779ee4c4 to your computer and use it in GitHub Desktop.
Save travisdowns/3204822a9ebdf5877a4287ac779ee4c4 to your computer and use it in GitHub Desktop.
; compile this like:
; nasm -f elf64 decode-test.s
default rel
BITS 64
GLOBAL _start
_start:
; iteration count, doesn't really matter much for the purposes of this test
mov rsi, 1_000_000
xor eax, eax
ALIGN 32
; uncomment the nop below to misalign all the blocks by 1 byte
; nop
top:
; change the number below to affect the total size of the loop
%rep 50
test eax, eax
jne .dummy
test eax, eax
jne .dummy
xor ebx, ebx
xor ecx, ecx
%endrep
dec esi
jnz top
.end:
xor edi, edi
mov eax, 231 ; exit(0)
syscall
.dummy:
ud2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment