Assembly Language and Disassembly Primer
Assembly Language and Disassembly Primer
mov dst,src
mov eax,10 ; moves 10 into EAX register, same
as eax=10
mov bx,7 ; moves 7 in bx register, same as bx=7
mov eax,64h ; moves hex value 0x64 (i.e 100)
into EAX
mov eax,ebx ; moves content of ebx into eax, i.e
eax=ebx
mov eax,[0x403000] ; move 4B from given addr
lea ebx,[0x403000] ; loads the address 0x403000
into ebx
lea eax, [ebx] ; if ebx = 0x403000, then eax will also
contain 0x403000
Malware Analysis, PIEAS
Disassembly Challenge
not eax
and bl,cl ; same as bl = bl & cl
The shr (shift right) and shl (shift left)
instructions take two operands (the
destination and the count). The destination
can be either a register or a memory
reference.
shl dst,count
rol (rotate left) and ror (rotate right)
instructions
rol al,2
Unconditional Jumps
jmp <jump address>
Calling a function:
call <some_function>
Returning From a Function:
ret
Return val
function prologue
test()
Return val
function epilogue
CALLER CALLEE
Malware Analysis, PIEAS
X86 Calling Conventions: __fastcall
__fastcall
only applies to the x86 architecture
64-bit registers:
rax, rbx, rcx, rdx, rsi, rdi, rbp, and rsp
8 new registers: r8, r9, r10, r11, r12, r13, r14, and
r15
64-bit addresses and pointers
supports rip-relative addressing
Function Calling: first four parameters are
passed in the rcx, rdx, r8, and r9 registers,
and if the program contains additional
parameters they are stored on the stack.