Assembly Language for Beginners
3.14. VARIADIC FUNCTIONS cdeclcalling conventions Listing 3.57: Optimizing MSVC 6.0 _v$ = 8 _arith_mean PROC NEAR mov eax, DWORD ...
3.14. VARIADIC FUNCTIONS Listing 3.58: Optimizing MSVC 2012 x64 $SG3013 DB '%d', 0aH, 00H v$ = 8 arith_mean PROC mov DWORD PTR [ ...
3.14. VARIADIC FUNCTIONS mov r8d, 1 mov QWORD PTR [rsp-56], rax jmp .L5 .L7: ; work out saved arguments lea rax, [rsp-48] mov ec ...
3.14. VARIADIC FUNCTIONS break; sum=sum+(*i); count++; i++; } return sum/count; }; int main() { printf ("%d\n", arith_mean (1, 2 ...
3.14. VARIADIC FUNCTIONS die PROC ; save first 4 arguments in Shadow Space mov QWORD PTR [rsp+8], rcx mov QWORD PTR [rsp+16], rd ...
3.15 Strings trimming printf ("%s"); }; Please note, thatprintf()has no additional arguments besides single format string. Now l ...
3.15. STRINGS TRIMMING break; }; return s; }; int main() { // test // strdup() is used to copy text string into data segment, // ...
3.15. STRINGS TRIMMING je SHORT $LN2@str_trim cmp al, 10 jne SHORT $LN15@str_trim $LN2@str_trim: ; the last character has a 13 o ...
3.15. STRINGS TRIMMING str_trim: push rbp mov rbp, rsp sub rsp, 32 mov QWORD PTR [rbp-24], rdi ; for() first part begins here mo ...
3.15. STRINGS TRIMMING 3.15.3 x64: Optimizing GCC 4.9.1 str_trim: push rbx mov rbx, rdi ; RBX will always be "s" call strlen ; c ...
3.15. STRINGS TRIMMING Apparently, GCC notices that the str_len-1 statement is used twice. So it’s better to allocate a variable ...
3.15. STRINGS TRIMMING ; return s ldr x0, [x29,24] ldp x29, x30, [sp], 48 ret 3.15.5 ARM64: Optimizing GCC (Linaro) 4.9. This is ...
3.15. STRINGS TRIMMING ; R0=s MOV r4,r0 ; R4=s BL strlen ; strlen() takes "s" value from R0 ; R0=str_len MOV r3,#0 ; R3 will alw ...
3.15. STRINGS TRIMMING 3.15.8 MIPS. Listing 3.69: Optimizing GCC 4.4.5 (IDA) str_trim: ; IDA is not aware of local variable name ...
3.16 toupper() function move $v0, $s0 lw $s0, 0x20+saved_S0($sp) jr $ra addiu $sp, 0x20 ; branch delay slot Registers prefixed w ...
3.16. TOUPPER() FUNCTION 10 movsx eax, BYTE PTR c$[rsp] 11 sub eax, 32 12 jmp SHORT $LN3@toupper 13 jmp SHORT $LN1@toupper ; com ...
3.16. TOUPPER() FUNCTION Thetmpvariable must be signed. This makes two subtraction operations in case of a transformation plus o ...
3.16. TOUPPER() FUNCTION strb w0, [sp,15] ldrb w0, [sp,15] cmp w0, 96 bls .L2 ldrb w0, [sp,15] cmp w0, 122 bhi .L2 ldrb w0, [sp, ...
3.17 Obfuscation Very old keyboards used to do Shift just by toggling the 32 or 16 bit, depending on the key; this is why the re ...
3.17. OBFUSCATION mov ebx, offset username cmp byte ptr [ebx], 'j' jnz fail cmp byte ptr [ebx+1], 'o' jnz fail cmp byte ptr [ebx ...
«
23
24
25
26
27
28
29
30
31
32
»
Free download pdf