2 - x86 Processor Architecture Flashcards
What does the CPU do and have?
It is where calculations and logical operations take place. It has:
- Limited number of storage locations (registers)
- Clock to synchronize internal CPU operations with system
- Control Unit (CU) to coordinate sequence of steps when executing instructions
- Arithmetic Logic Unit (ALU) to perform arithmetic (add, subtracting) and logic operations (AND, OR, NOT).
How is the CPU attached to the rest of the computer?
The CPU is attached to the CPU socket in the computer’s motherboard. Most pins connect to the data bus, the control bus, and the address bus, all of which connect to everything else.
What is the memory storage unit?
Where instructions and data are held while a computer program is running. The storage unit receives requests for data from the CPU, transfers data from RAM to the CPU (to process all data), and transfers data from the CPU into memory.
What is a “bus”?
A group of parallel wires that transfer data from one part of the computer to another.
- Data bus transfers instructions and data between CPU and memory.
- I/O bus transfers data between CPU and system input/output devices.
- Control bus uses binary signals to synchronize actions of all devices attached to system bus.
- Address bus holds the addresses of instructions and data when the currently executing instruction transfers data between the CPU and memory.
What is a “machine cycle” or “clock cycle”?
The time required for one complete clock pulse (usually 1 billion ties per second).
Most machine require between 1-50 clocks. However, instructions needing memory access have empty clock cycles (wait states) because of the different speeds of the CPU, system bus, and memory circuits.
What are the steps of an instruction execution cycle?
- Fetch: the CPU has to fetch the instruction from an area of memory called the instruction queue.
- Decode: The CPU looks at the binary bit pattern. If operands are involved, the CPU fetches the operands from registers and memory (sometimes including address calculations).
- Execute: Executes the instruction, and if an output operand was part of the instruction, the CPU stores the result in the operand.
What is an operand?
A value that is either an input or an output to an operation.
For example, Z = X + Y has two input operators (X and Y) and a single output operand (Z).
What is the data flow within the typical CPU during the instruction execution cycle?
First, to read program instructions from memory, an address is placed on the address bus.
Next, the memory controller places the requested code on the data bus, making the code available in the code cache.
The instruction pointer’s value determines which instruction will be executed next, and the instruction is analyzed by the instruction decoder, causing digital signals to be sent to the control unit, which coordinates the ALU and floating-point unit.
What are the steps required to read from memory?
- Place the address of the value you want on the address bus
- Assert (change the value of) the processor’s RD (read) pin.
- Wait one clock cycle for the memory chips to respond.
- Copy the data from the data bus into the destination operand.
How does the cache speed up a computer?
The most recently used instructions and data are stored in high-speed memory (cache).
Also, when the CPU begins to execute a program, it can look ahead and load the next thousand instructions on the assumption that these instructions will be needed fairly soon.
What is a cache hit/miss?
A cache hit is if the processor is able to find its data in cache memory.
A cache miss is if the CPU tries to find something in cache and it’s not there.
What are the two types of cache memory in the x86 family?
Level-1 cache (primary cache) is stored right on the CPU.
Level-2 cache (secondary cache) is a little bit slower, and attached to the CPU by a high-speed data bus.
Why is cache memory faster than conventional RAM?
Cache memory is constructed from a special type of memory chip (static RAM) that is expensive, but does not have to be constantly refreshed to keep its contents.
Conventional RAM (dynamic RAM), must be refreshed constantly.
How is a program loaded and executed?
Before the program can run, it must be loaded into memory by a utility known as a program loader.
After loading, the operating system must point the CPU to the program’s entry point (the address at which the program is to begin execution).
Which two additional steps are required in the instruction execution cycle when a memory operand is used?
Fetch memory operands and store memory operands.
What are the three primary modes of operation of x86 processors?
- Protected mode (a sub mode of this is virtual-8086).
- Real-address mode
- System management mode
What is the protected mode?
The native state of the process, in which all instructions and features are available.
Programs are given separate memory areas called segments, and the processor prevents programs from referencing memory outside their assigned segments.
What is the virtual 8086 mode?
While in protected mode, the processor can directly execute real-address software like MS-DOS programs in a safe environment. That way, if a program crashes or attempts to write data into the system memory area, it will not affect other programs at the same time. Today, you can execute separate virtual 8086 sessions at the same time.
What is the real-address mode?
Real-address mode implements the programming environment of an early Intel processor with a few extra features (like the ability to switch into other modes). This is useful if a program needs direct access to system memory and hardware devices.
What is system management mode?
SMM provides an operating system with a mechanism for implementing functions like power management and system security. These are usually implemented by computer manufacturers who customize the processor for a particular system setup.
How much address space is there in a 32-bit environment?
In 32-bit protected mode, a task or program can address a linear space up to 4GB. Then, with extended physical addressing, a total of 64 GB could be addressed.
However, real-address mode programs can only address a range of 1 MB. Additionally, if the processor is in protected mode and running multiple programs in virtual 8086 mode, each program has its own 1MB memory area.
What are the basic program execution registers?
- Eight 32-bit general purpose registers.
- Six 16-bit segment registers.
- An EFLAGS register (processor status flags).
- An EIP register (instruction pointer).
What are the general purpose registers?
They are mostly for arithmetic and data movement.
Four of them (EAX, EBX, ECX, and EDX) can be addressed as 16-bit or 8-bit values. For example, the 16-bit of EAX is AX (the second half). The 8-bit ones are AH (high) and AL (low).
The others can ONLY be accessed by their 32-bit (ESI, EDI, EBP, ESP) or 16-bit names (SI, DI, BP, SP).
What specialized uses do some general purpose registers have?
- EAX (extended accumulator register) - automatically used by multiplication and division instructions.
- ECX automatically used as a loop counter by CPU.
- ESP (extended stack pointer) addresses data on the stack.
- ESI (extended source index) and EDI (extended destination) are used by high speed memory transfer instructions.
- EBP (extended frame pointer register) is used by high-level languages to reference function parameters and local variables on the stack.