About the Author |
|
ix | |
About the Technical Reviewer |
|
xi | |
Preface |
|
xiii | |
|
Chapter 1 Memory, Registers, and Simple Arithmetic |
|
|
1 | (18) |
|
Memory and Registers Inside an Idealized Computer |
|
|
1 | (1) |
|
Memory and Registers Inside Intel 64-Bit PC |
|
|
2 | (1) |
|
"Arithmetic" Project: Memory Layout and Registers |
|
|
3 | (2) |
|
"Arithmetic" Project: A Computer Program |
|
|
5 | (1) |
|
"Arithmetic" Project: Assigning Numbers to Memory Locations |
|
|
5 | (3) |
|
Assigning Numbers to Registers |
|
|
8 | (1) |
|
"Arithmetic" Project: Adding Numbers to Memory Cells |
|
|
8 | (3) |
|
Incrementing/Decrementing Numbers in Memory and Registers |
|
|
11 | (3) |
|
|
14 | (3) |
|
|
17 | (2) |
|
Chapter 2 Code Optimization |
|
|
19 | (8) |
|
"Arithmetic" Project: C/C++ Program |
|
|
19 | (1) |
|
|
20 | (1) |
|
GDB Disassembly Output - No Optimization |
|
|
20 | (5) |
|
GDB Disassembly Output - Optimization |
|
|
25 | (1) |
|
|
26 | (1) |
|
Chapter 3 Number Representations |
|
|
27 | (6) |
|
Numbers and Their Representations |
|
|
27 | (1) |
|
Decimal Representation (Base Ten) |
|
|
28 | (1) |
|
Ternary Representation (Base Three) |
|
|
29 | (1) |
|
Binary Representation (Base Two) |
|
|
29 | (1) |
|
Hexadecimal Representation (Base Sixteen) |
|
|
30 | (1) |
|
Why Are Hexadecimals Used? |
|
|
30 | (2) |
|
|
32 | (1) |
|
|
33 | (20) |
|
|
33 | (1) |
|
"Pointers" Project: Memory Layout and Registers |
|
|
34 | (2) |
|
"Pointers" Project: Calculations |
|
|
36 | (1) |
|
Using Pointers to Assign Numbers to Memory Cells |
|
|
36 | (6) |
|
Adding Numbers Using Pointers |
|
|
42 | (3) |
|
Incrementing Numbers Using Pointers |
|
|
45 | (3) |
|
Multiplying Numbers Using Pointers |
|
|
48 | (3) |
|
|
51 | (2) |
|
Chapter 5 Bytes, Words, Double, and Quad Words |
|
|
53 | (6) |
|
Using Hexadecimal Numbers |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
55 | (3) |
|
|
58 | (1) |
|
Chapter 6 Pointers to Memory |
|
|
59 | (22) |
|
|
59 | (1) |
|
|
59 | (6) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
66 | (1) |
|
|
67 | (1) |
|
Initialized and Uninitialized Data |
|
|
67 | (1) |
|
|
68 | (1) |
|
"Memory Pointers" Project: Memory Layout |
|
|
68 | (11) |
|
|
79 | (2) |
|
Chapter 7 Logical Instructions and RIP |
|
|
81 | (6) |
|
|
81 | (1) |
|
Logical Shift Instructions |
|
|
82 | (1) |
|
|
82 | (1) |
|
Zeroing Memory or Registers |
|
|
83 | (1) |
|
|
84 | (1) |
|
|
85 | (1) |
|
|
86 | (1) |
|
Chapter 8 Reconstructing a Program with Pointers |
|
|
87 | (10) |
|
Example of Disassembly Output: No Optimization |
|
|
87 | (3) |
|
Reconstructing C/C++ Code: Part 1 |
|
|
90 | (2) |
|
Reconstructing C/C++ Code: Part 2 |
|
|
92 | (1) |
|
Reconstructing C/C++ Code: Part 3 |
|
|
93 | (1) |
|
Reconstructing C/C++ Code: C/C++ Program |
|
|
94 | (1) |
|
Example of Disassembly Output: Optimized Program |
|
|
95 | (1) |
|
|
96 | (1) |
|
Chapter 9 Memory and Stacks |
|
|
97 | (20) |
|
|
97 | (1) |
|
Stack Implementation in Memory v |
|
|
98 | (2) |
|
|
100 | (1) |
|
|
101 | (1) |
|
|
101 | (1) |
|
|
102 | (3) |
|
Application Memory Simplified |
|
|
105 | (1) |
|
|
105 | (1) |
|
|
106 | (2) |
|
|
108 | (2) |
|
|
110 | (2) |
|
|
112 | (3) |
|
|
115 | (2) |
|
Chapter 10 Frame Pointer and Local Variables |
|
|
117 | (12) |
|
|
117 | (1) |
|
|
118 | (1) |
|
Addressing Array Elements |
|
|
118 | (1) |
|
Stack Structure (No Function Parameters) |
|
|
119 | (2) |
|
|
121 | (1) |
|
Raw Stack (No Local Variables and Function Parameters) |
|
|
121 | (2) |
|
|
123 | (1) |
|
"Local Variables" Project |
|
|
124 | (3) |
|
Disassembly of Optimized Executable |
|
|
127 | (1) |
|
|
128 | (1) |
|
Chapter 11 Function Parameters |
|
|
129 | (10) |
|
"Function Parameters" Project |
|
|
129 | (1) |
|
|
130 | (2) |
|
Function Prolog and Epilog |
|
|
132 | (1) |
|
Project Disassembled Code with Comments |
|
|
133 | (4) |
|
Parameter Mismatch Problem |
|
|
137 | (1) |
|
|
138 | (1) |
|
Chapter 12 More Instructions |
|
|
139 | (10) |
|
|
139 | (1) |
|
The Fast Way to Fill Memory |
|
|
140 | (1) |
|
|
141 | (1) |
|
|
142 | (1) |
|
CMP - Compare Two Operands |
|
|
143 | (1) |
|
|
144 | (1) |
|
|
144 | (1) |
|
The Structure of Registers |
|
|
145 | (1) |
|
|
146 | (1) |
|
|
146 | (1) |
|
|
147 | (2) |
|
Chapter 13 Function Pointer Parameters |
|
|
149 | (12) |
|
"Function Pointer Parameters" Project |
|
|
149 | (1) |
|
|
150 | (9) |
|
|
159 | (2) |
|
Chapter 14 Summary of Code Disassembly Patterns |
|
|
161 | (6) |
|
|
161 | (3) |
|
LEA (Load Effective Address) |
|
|
164 | (1) |
|
|
164 | (1) |
|
Accessing Parameters and Local Variables |
|
|
165 | (1) |
|
|
166 | (1) |
Index |
|
167 | |