IA-32 Architecture Flashcards
What are the four main components of the CPU?
- Control unit
- Execution unit
- Registers
- Flags
Control Unit
- retrieve/decode instructions
- retrieve/store data in memory
Execution Unit
- actual execution of instruction happens here
Registers
- internal memory locations used as “variables”
Flags
- used to indicate various ‘events’ when execution is happening
What are the 6 different IA-32 Registers?
- General Purpose Registers
- Segment Registers
- Flags, EIP
- Floating Point Unit Registers
- MMX Registers
- XMM Registers
What is the structure of the first 4 General Purpose Registers?
- Each register is 32-bits wide (0-31)
1. EAX - AX (16-bits wide)
- — AH (8-15), AL (0-7) (each are 8-bits wide)
2. EBX - BX (16-bits wide)
- — BH (8-15), BL (0-7) (each are 8-bits wide)
3. ECX - CX (16-bits wide)
- — CH (8-15), CL (0-7) (each are 8-bits wide)
4. EDX - DX (16-bits wide)
- — DH (8-15), DL (0-7) (each are 8-bits wide)
What is the structure of the second 4 General Purpose Registers?
- Each register is 32-bits wide (0-31)
- There are no further divisions into 8-bit halves like the first 4 general purpose registers
1. ESP - SP (16-bits wide)
2. EBP
- SP (16-bits wide)
- BP (16-bits wide)
3. ESI
- BP (16-bits wide)
- SI (16-bits wide)
4. EDP
- SI (16-bits wide)
- DI (16-bits wide)
What is the common functionality of each of the 8 General Purpose Registers?
- EAX: accumulator register, used for storing operands and result data
- EBX: base register, pointer to data
- ECX: counter register, loop operations
- EDX: data register, I/O pointer
- ESI/EDI: data pointer registers for memory operations
- ESP: stack pointer registers
- EBP: stack data pointer register
What are the 6 Segment Registers and what is the purpose and length of each?
- Each Segment Register is 16-bits wide
- CS: code
- DS: data
- SS: stack
- ES: data
- FS: data
- GS: data
EIP
- Instruction Point (the next instruction executed)
- Holy Grail for Shellcoding, Exploit Research, etc.
- 32 bits wide
- Not like a register where you can change the value with MOV, ADD, SUB, etc
- Instead, EIP is changed by using JMP operations
How wide is the FPU?
- Floating Point Unit (x87)
- 80 bits wide
SIMD
- Single Instruction Multiple Data
- 4 extensions
- Uses MMX and XMM registers
What are the four extensions of SIMD?
- MMX
- SSE
- SSE2
- SSE3
How wide is the MMX register?
64 bits
How wide is the XMM register?
128 bits
How do you start the GDB debugger?
gdb /bin/bash
What command do you need to execute before running GDB?
break main
What command do you execute after creating the break point?
run
What command do you run to view the default set of registers?
info registers
What command would you execute to see the contents of the EAX register?
display /x $eax
What command shows you the next instruction set to be run?
disassemble $eip
By default, GDB doesn’t show what three registers?
- FPU
- MMX
- XMM