Intro to Assembly Flashcards
Introduction to SLAE course on pentesteracademy.
What is Assembly Language?
Assembly is a low level programming language which allows for direct communication with the microprocessor. This is specific to processor type, and has an almost one to one correspondence with machine language.
How is Assembly Language processed, compiled and executed?
The .c or .cpp source code file is initially passed through a preprocessing stage. Following this, the preprocessor directs the output through to the compiler; which outputs an assembly language file. The compiled output is then passed to the assembler, to generate an object file. The Linker then takes the object files / any other shared libraries required, and produces an executable. Finally, the executable is loaded into memory via the Loader, where it is run.
What is the CPU
The CPU is the area in computer architecture in which instructions are decoded and executed. The CPU consists of 4 main components: Control Unit, Execution Unit, Registers and Flags.
What is the Control Unit in CPU architecture?
The Control Unit is responsible for retrieving and decoding instructions, as well as retrieving and storing data in memory.
What is the Execution Unit in CPU architecture?
The Execution Unit performs the execution of CPU instructions.
What are the Registers in CPU architecture?
Internal memory locations used as variables.
What are the Flags in CPU architecture?
Used to indicate various “events” during execution.
What are the Segment Registers?
CS: Code Segment DS: Data Segment 1 SS: Stack Segment ES: Data Segment 2 FS: Data Segment 3 GS: Data Segment 4
What is SIMD?
Single Instruction Multiple Data is an instruction extension implemented by Intel. Extensions include: - MMX - SSE - SSE2 - SSE3 Uses MMX and XMM registers.
What are the three IA 32 modes of operation?
Real Mode:
- At power up or reset
- Can only access up to 1 MB of memory
- No memory protection
- Privilege levels (Kernel vs User space) not possible
Protected Mode:
- Up to 4 GB of memory
- Memory protection / privilege level / multi-tasking
- Supports virtual-8086 Mode
System Management Mode:
- Used for power management tasks
What are the three Memory Models?
How does the processor address the memory? There are three options - Flat Model, Segmented Model & Real-Address Mode Model.
What is the Flat Model?
Addresses are linear across an address space, and any address can be accessed directly.
What is the Segmented Model?
A segment selector and an offset in that segment are used to access specific locations in memory.
What is the Real-Address Mode Model?
A special case of the Segmented Model.
What Mode of Operation and Memory Model is used by 32-Bit Linux systems?
32-Bit Linux uses Protected Mode and Flat Memory Model. As such, there is:
- 4 GB of addressable space (2^32)
- Memory Protection
- Privilege Levels of Code
- Segment registers which point to segment descriptors (Global/Local/Interrupt Descriptor Tables)
What are three commands that can be used to view memory mappings in 32-Bit Linux?
- pmap -d [PID]
- cat /proc/[PID]/maps
- gdb [filename], break main, info proc mappings