Assembly Language for Beginners
1.14. CONDITIONAL JUMPS .text:000000C8 ; all 3 conditions were false, so just finish: .text:000000C8 loc_C8: # CODE XREF: f_sign ...
1.14. CONDITIONAL JUMPS .text:00000178 or $at, $zero .text:0000017C sltu $v0, $v1, $v0 .text:00000180 beqz $v0, loc_1A8 .text:00 ...
1.14. CONDITIONAL JUMPS ; skip RSBS instruction then BGE |L0.6| ; subtract input value from 0: RSBS r0,r0,#0 |L0.6| BX lr ENDP A ...
1.14. CONDITIONAL JUMPS Here we see a new instruction:BLTZ(“Branch if Less Than Zero”). There is also theNEGUpseudo instruction, ...
1.14. CONDITIONAL JUMPS mov eax, OFFSET $SG792 ; 'it is ten' ; jump to $LN4@f if equal je SHORT $LN4@f mov eax, OFFSET $SG793 ; ...
1.14. CONDITIONAL JUMPS |L0.12| DCB "it is not ten",0 |L0.28| DCB "it is ten",0 ARM64 Optimizing GCC (Linaro) 4.9 for ARM64 also ...
1.14. CONDITIONAL JUMPS const char* f (int a) { if (a==10) return "it is ten"; else return "it is not ten"; }; Interestingly, op ...
1.14. CONDITIONAL JUMPS jge SHORT $LN2@my_min ; reload A to EAX if otherwise and jump to exit mov eax, DWORD PTR _a$[ebp] jmp SH ...
1.14. CONDITIONAL JUMPS |L0.14| ; return BX lr ENDP The functions differ in the branching instruction:BGTandBLT. It’s possible t ...
1.14. CONDITIONAL JUMPS int64_t my_max(int64_t a, int64_t b) { if (a>b) return a; else return b; }; int64_t my_min(int64_t a, ...
1.14. CONDITIONAL JUMPS cmovge rax, rdi ret my_min: ; RDI=A ; RSI=B ; compare A and B: cmp rdi, rsi ; prepare B in RAX for retur ...
1.14. CONDITIONAL JUMPS locret_28: jr $ra or $at, $zero ; branch delay slot, NOP Do not forget about thebranch delay slots: the ...
1.15 switch()/case/default Listing 1.146: Check for less than (unsigned) SLTU REG1, REG2, REG3 BEQ REG1, label Branchless If the ...
1.15. SWITCH()/CASE/DEFAULT f (2); // test }; x86 Non-optimizing MSVC Result (MSVC 2010): Listing 1.149: MSVC 2010 tv64 = -4 ; s ...
1.15. SWITCH()/CASE/DEFAULT This implies that switch() is like syntactic sugar for a large number of nested if()s. There is noth ...
1.15. SWITCH()/CASE/DEFAULT A similar case with the ARM compiler is described in “printf() with several arguments” section, here ...
1.15. SWITCH()/CASE/DEFAULT OllyDbg Since this example is tricky, let’s trace it in OllyDbg. OllyDbg can detect such switch() co ...
1.15. SWITCH()/CASE/DEFAULT 0 is subtracted from 2 inEAX. Of course,EAXstill contains 2. But theZFflag is now 0, indicating that ...
1.15. SWITCH()/CASE/DEFAULT DECis executed andEAXnow contains 1. But 1 is non-zero, so theZFflag is still 0: Figure 1.44:OllyDbg ...
1.15. SWITCH()/CASE/DEFAULT NextDECis executed.EAXis finally 0 and theZFflag gets set, because the result is zero: Figure 1.45:O ...
«
4
5
6
7
8
9
10
11
12
13
»
Free download pdf