32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
# Day 1: C & Reverse Engineering Anki Cards
|
|
|
|
## Card 1
|
|
**Front:** In x64 Assembly, what does `DWORD PTR` indicate about the size of the data?
|
|
**Back:** It indicates a 32-bit (4-byte) value, typically used for an `int` in C.
|
|
|
|
## Card 2
|
|
**Front:** Translate the C code `int x = 10;` into a conceptual x64 assembly instruction.
|
|
**Back:** `mov DWORD PTR [rbp-offset], 0xa`
|
|
|
|
## Card 3
|
|
**Front:** Why can't a CPU usually add two memory locations directly (e.g., `add [mem1], [mem2]`)?
|
|
**Back:** Architecture constraints. It must follow the **Load-Modify-Store** pattern: move values into registers, perform the addition, and store the result back.
|
|
|
|
## Card 4
|
|
**Front:** What is the relationship between `RAX` and `EAX`?
|
|
**Back:** `EAX` is the lower 32-bit half of the 64-bit `RAX` register.
|
|
|
|
## Card 5
|
|
**Front:** Match the C type to its Assembly size prefix:
|
|
1. `char`
|
|
2. `short`
|
|
3. `int`
|
|
**Back:**
|
|
1. `BYTE PTR` (1 byte)
|
|
2. `WORD PTR` (2 bytes)
|
|
3. `DWORD PTR` (4 bytes)
|
|
|
|
## Card 6
|
|
**Front:** What does the `RBP` register represent in the context of local variables?
|
|
**Back:** The **Base Pointer**. It serves as a fixed reference point on the stack from which local variables are accessed via offsets (e.g., `[rbp-4]`).
|