54 lines
557 B
NASM
54 lines
557 B
NASM
format ms64 coff
|
|
|
|
section '.text' code readable writeable executable
|
|
|
|
use64
|
|
|
|
public _small
|
|
_small:
|
|
xor eax, eax
|
|
ret
|
|
|
|
public _rip_relative
|
|
_rip_relative:
|
|
mov rax, qword[seed]
|
|
mov ecx, 214013
|
|
mul ecx
|
|
add eax, 2531011
|
|
mov [seed], eax
|
|
|
|
shr eax, 16
|
|
and eax, 0x7FFF
|
|
ret
|
|
|
|
seed dd 1
|
|
|
|
public _branch
|
|
_branch:
|
|
and rax, 1
|
|
jz @branch_ret
|
|
xor rax, rax
|
|
|
|
nop ; Just some padding, so the function can't be copied entirely into the
|
|
nop ; trampoline
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
nop
|
|
@branch_ret:
|
|
ret
|
|
|