Title: Theory / Unimportant / CS / Programming / Assembly / Reverse Engineering for Beginners
On every note of this deck, unless a note says otherwise:
Chapter: 1
Chapter: 1

Question: What's the point of not optimizing compilation
Answer: Getting compilation to be done faster
Page: 1
Section: 1.1
Answer2: Gets compiled code more easily debuggable by being close to source code

Name: Instruction
Definition: A primitive CPU command.
Page: 1
Section: 2.1
Context: Assembly
Example: moving data between registers, working with memory, primitive arithmetic operations.

Name: Machine code
Definition: Code that the CPU directly processes.
Page: 1
Section: 2.1
Context: Assembly

Name: Assembly language
Definition: Mnemonic code
Page: 1
Section: 2.1
Context: Assembly
Definition2: some extensions, like macros
Intuition: intended to make a programmer’s life easier than assembler

Name: CPU Registry
Definition: an untyped temporary variable from a very small set close to the CPU
Page: 1
Section: 2.1
Context: Assembly

Name: Compiler
Definition: Program that translate code to assembly
Page: 1
Section: 2.1
Context: Assembly

Name: ARM Mode
Definition: A mode in which all instructions are 4 bytes long
Page: 3
Section: 2.1
Context: Assembly

Name: Radix
Definition: Number of digit in a numerical system
Page: 4
Section: 2.2

Name: Decimal
Definition: Numerical system in base 10
Page: 4
Section: 2.3
Denoted by: 012345789d

Name: Octal
Definition: Numerical system in base 8
Page: 5
Section: 2.3
Denoted by: 01234567 (starting with a 0)

Name: Hexadecimal
Definition: Numerical system in base 16
Page: 5
Section: 2.3
Denoted by: 0x123456789ABCD

Name: Binary
Definition: Numerical system in base 2
Page: 5
Section: 2.3
Denoted by: 0b10

Name: Portable executable
Page: 7
Section: 2.3
Abbreviation: PE

Name: Interactive Disassembler and Debugger
Page: 7
Section: 2.3
Abbreviation: IDA

Name: Link register
Page: 9
Section: 3.3
Abbreviation: LR

Instruction: NOP
Page: 9
Effect: Do nothing
Language: Assembly
Section: 3.3
Name: No operation

Question: Why can the compiler have to compile empty function?
Answer: all function content is between #if and #endif; hence preprocessor did remove the content. E.g. debug, or demo version
Page: 9
Chapter: 1
Section: 3.3

Instruction: ret
Page: 8
Effect: return to the caller
Language: x86
Section: 4

Instruction: BX foo
Page: 8
Effect: Jump to address saved in registry foo
Language: arm
Section: 4

Instruction: j foo
Page: 8, 11
Effect: Execute next instruction, then jump to address saved in registry foo
Language: mips
Section: 4

Instruction: mov foo, bar
Page: 10
Effect: Put the value bar in registry foo
Language: x86
Section: 4

Variable: EAX
Meaning: the returned value
Page: 10
Language: x86
Section: 4
Chapter: 1

Variable: r0
Meaning: the returned value
Page: 10
Language: ARM
Section: 4
Chapter: 1

Variable: $2 $v0
Meaning: the returned value
Page: 10
Language: MIPS
Section: 4
Chapter: 1

Instruction: li foo, bar
Page: 10
Effect: move the value bar in registry foo
Language: MIPS
Section: 4

Instruction: CONST SEGMENT
Page: 12
Effect: Start the list of data constants
Language: Intel syntax
Section: 5.1

Instruction: _TEXT SEGMENT
Page: 12
Effect: Start the listing of code
Language: Intel syntax
Section: 5.1

Instruction: _function_name PROC
Page: 12
Effect: Start the listing of the code of function_name
Language: Intel syntax
Section: 5.1

Instruction: _function_name ENDP
Page: 12
Effect: Ends the listing of the code of function_name
Language: Intel syntax
Section: 5.1

Instruction: FOO ENDS
Page: 12
Effect: Ends section FOO
Language: Intel syntax
Section: 5.1

Instruction: PUSH foo
Page: 12
Effect: Put foo on the stack
Language: Intel syntax
Section: 5.1

Instruction: call foo
Page: 12
Effect: jump to the code of method foo
Language: Intel syntax
Section: 5.1

Variable: ESP
Meaning: stack pointer
Page: 13
Section: 5.1
Chapter: 1

Instruction: add esp, 4*n
Page: 13
Effect: pop n elements from the stack
Language: intel
Section: 5.1

Instruction: xor reg, reg
Page: 13
Effect: set reg to 0
Section: 5.1
Intuition: It's shorter (2 bytes) than using a MOV

Instruction: $n
Page: 13
Effect: the number n
Language: AT&T
Section: 5.1

Instruction: %n
Page: 13
Language: AT&T
Section: 5.1
Returns: The n-th register

Instruction: fooq
Page: 13
Language: AT&T
Section: 5.1
Returns: instruction foo on quad operand (size 64 bits)

Instruction: fool
Page: 13
Language: AT&T
Section: 5.1
Returns: instruction foo on long operand (size 32 bits)

Instruction: foow
Page: 13
Language: AT&T
Section: 5.1
Returns: instruction foo on word operand (size 16 bits)

Instruction: foob
Page: 13
Language: AT&T
Section: 5.1
Returns: instruction foo on byte operand (size 8 bits)

Instruction: radare2
Page: 18
Section: 5.1
Returns: a software allowing to edit bytecode of files

Name: fastcall
Definition: Using register to pass arguments, instead of the standard use of the stack
Page: 19
Section: 5.2

Variable: Rfoo
Meaning: register foo but on 64 bits
Page: 19
Section: 5.2
Chapter: 1

Variable: Efoo
Meaning: register foo but on 32 bits.
Page: 19
Language: x86-64
Section: 5.2
Chapter: 1

Question: What's the relation between registers Rfoo and Efoo
Answer: Efoo is the lowest half of Rfoo
Page: 19
Chapter: 1
Section: 5.2
Context: x86-64

Question: What's the relation between registers Efoo and foo
Answer: Rfoo is the lowest half of foo
Page: 19
Chapter: 1
Section: 5.2
Context: x86-64

Question: What occurs when a number is put in a register with more bit than required
Answer: The extra bits are put to 0, so that the result is interpreted similarly as the input, even if we consider the full register unsigned int
Page: 26
Chapter: 1
Section: 5.2
Context: Assembly

Name: The global pointer
Definition: A pointer to the middle of a 64KiB area containing most important variables and methods
Page: 33
Section: 5.2
Context: MIPS

Name: Block started by symbol
Page: 33
Section: 5.2
Context: MIPS
Abbreviation: BSS

Name: Small BSS
Page: 33
Section: 5.2
Context: MIPS
Abbreviation: sbss

Instruction: $ZERO
Page: 35
Context: MIPS
Section: 5.2
Returns: register that always contain zero
Abbreviation: $0

Question: How is
MOVE DST, SRC
implemented
Answer: ADD DST, SRC, $ZERO
Page: 33
Chapter: 1
Section: 5.2
Context: MIPS

Name: macro
Definition: A name for a sequence of assembly instruction currently executed together
Page: 38
Section: 5.4
Context: Assembly
Name2: Pseudo-instruction

Question: How to implement NOP
Answer: OR $AT, $ZERO
Page: 38
Chapter: 1
Section: 5.4
Context: Assembly IDA

Name: A leaf function
Definition: A function that do not call other functions
Page: 38
Section: 5.4

Name: The prelude
Definition: A part of code starting a function and dealing with tasks that are not related to the compiled code itself
Page: 39
Section: 6
Context: Assembly
Example: pushing the base stack pointer on the stack, setting the new stack pointer

Name: The epilogue
Definition: A part of code ending a function and dealing with tasks that are not related to the compiled code itself
Page: 39
Section: 6
Context: Assembly
Example: popping the previous stack values.
Example2: Returning a value