1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC...

22
1 Hardware and Software Hardware and Software Architecture Architecture Chapter 2 Chapter 2 The Intel Processor Architecture The Intel Processor Architecture History of PC Memory Usage (Real Mode) History of PC Memory Usage (Real Mode)
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    220
  • download

    2

Transcript of 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC...

Page 1: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

1

Hardware and Software ArchitectureHardware and Software Architecture

Chapter 2Chapter 2 The Intel Processor ArchitectureThe Intel Processor Architecture History of PC Memory Usage (Real Mode)History of PC Memory Usage (Real Mode)

Page 2: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

2

Basic ComponentsBasic Components The x86 processor communicates with

main memory and I/O devices via buses Data bus for transferring data Address bus for the address of a memory

location or an I/O port Control bus for control signals (Interrupt

request, memory read/write …) Each operation must be synchronized by

the system clock Registers are high-speed storage within

the processor

Page 3: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

3

Simplified CPU DesignSimplified CPU Design

Data Registers

Address Registers

ControlUnit

ArithmeticLogic Unit

StatusFlags

Address Bus

Data Bus

Memory

Page 4: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

4

The Fetch-Decode-Execute CycleThe Fetch-Decode-Execute Cycle Is the basic cycle for instruction execution

Fetch the next instruction place it in queue update program counter

Decode the instruction perform address translation fetch operands from memory

Execute the instruction store result in memory or registers set status flags according to result

Before fetching next instruction, the CPU checks if an interrupt is pending (more on that later)

Page 5: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

5

The Intel x86 FamilyThe Intel x86 Family The instruction set of the x86 is backward

compatible with any one of its predecessors new additional instructions are introduced with

each new processor The 8086/8088 runs only in real mode (1MB)

segment registers contain the (real) physical address of memory segments

no protection is provided: a program can write anywhere (and corrupt the Operating System)

DOS is a real-mode Operating System Windows 3.x/95/98/NT are protected-mode OSs

that cannot run on the 8086/8088

Page 6: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

6

The Intel 286 Family (cont.)The Intel 286 Family (cont.) The 80286 and up can also operate in

protected mode (16MB) Provides segmented virtual memory

segment registers are selectors (indexes) of segment descriptor tables

each segment descriptor contains the real physical address of a memory segment

protection levels are provided (a user program cannot write anywhere and corrupt the OS...)

supports multitasking The 8086/8088 and 80286 have 16-bit registers. Later processors have 32-bit registers

Page 7: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

7

The Intel 386 Family (cont.)The Intel 386 Family (cont.)

The 80386 can also run in virtual 86 mode (4GB) enables to run multiple real-mode programs

in separate virtual 8086 machines The 80386 memory management

hardware supports paging each segment is partitioned into fixed-size

(4KB) pages (that are easier to swap) The variable-size segments are visible to

the programmer but pages are not.

Page 8: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

8

The Intel 486 Family (cont.)The Intel 486 Family (cont.)

The 80486 uses a pipeline of 5 stages for decoding and

executing each instruction uses an internal L1 cache of 8KB

The Pentium superscalar design with 2 instruction pipelines

(2 instructions can be executed per clock cycle) Two internal L1 caches (code and data)

The Pentium II uses a L2 cache (typically 512KB) on a

separate dye inside the same SEC cartridge

Page 9: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

9

16-16-bit Registersbit Registers

Page 10: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

10

General-Purpose RegistersGeneral-Purpose Registers

These are data registers where the upper and lower half can be accessed separately

AX = Accumulator (used in arithmetic) BX = Base (arithmetic, data movement…) CX = Counter (for looping instructions) DX = Data (multiplication & division)

Page 11: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

11

Segment RegistersSegment Registers

CS (code segment) holds the base location of all executable instructions in a program

DS (data segment) the default base location for memory variables

ES (extra segment) additional base location for memory variables

SS (stack segment) base location for stack

Page 12: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

12

Index RegistersIndex Registers

SP (stack pointer) contains the offset of the top of the stack

BP (base pointer) often contains the offset of a data/variable in the stack

SI (source index) and DI (destination index) are used in string movement instructions SI points to the source string DI points to the destination string

Page 13: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

13

Status and Control RegistersStatus and Control Registers IP (instruction pointer) always contains the offset

of the instruction to be executed next within the current code segment

The FLAGS register consist of individual bits indicating either the mode of operation of the CPU (control flag) the outcome of an arithmetic operation (status)

Page 14: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

14

Logical and Physical AddressesLogical and Physical Addresses To specify the location of a memory byte we can

use either a logical address or a physical address

Physical address: specify its absolute location. This is the number that goes onto the address bus For a bus of n lines, physical addresses go from 0

to 2^{n} - 1 Logical address = base:offset

base = location of a block of memory (ex: segment) containing the referenced memory byte

offset (displacement) = location of the referenced memory byte relative to its base

Page 15: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

15

Intel’s x86 Addresses in Real ModeIntel’s x86 Addresses in Real Mode

20 bits (1MB) are used for physical addresses from 00000h to FFFFFh

Logical address = [segment:offset] Segment = block of memory containing at

most 2^{16} bytes located at a physical address which is a multiple of 10h (16d) Ex: the segment 08F1h starts at physical address

08F10h Offset = displacement of the referenced byte

relative to its base segment

Page 16: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

16

Intel’s x86 Addresses in Real Mode (cont.)Intel’s x86 Addresses in Real Mode (cont.)

The base is stored in a segment register The offset is often stored in a index

register but can be stored anywhere else (data register, variable…)

Ex: a reference byte at logical address 08F1:0100 hex is located at physical address 08F10h + 0100h = 09010h

Page 17: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

17

32-32-bit registersbit registers

Upper halves do not have names

Page 18: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

18

Real Mode Memory ArchitectureReal Mode Memory Architecture

Only 1MB of memory is addressable with the 20 bits used for physical addresses RAM: from 0 to BFFFFh ROM: from C0000h to FFFFFh

The memory above 1MB (extended memory) is addressable only in protected mode

In this course we focus on real mode DOS is the dominant real-mode OS

Page 19: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

19

Real Mode Memory Architecture (cont.)Real Mode Memory Architecture (cont.)

The 1st KB of memory (from 0 to 3FFh) contains the interrupt vector table each entry of this table contains the

segment:offset address of an interrupt handler this is the routine invoked when an interrupt

has occurred (more later) the interrupt handler is normally located in the

ROM BIOS The ROM BIOS (from F0000h to FFFFFh)

contains low-level I/O routines and configuration/diagnostic software

Page 20: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

20

Real Mode Memory Architecture (cont.)Real Mode Memory Architecture (cont.) The BIOS data area is located (at 00400h)

just above the interrupt vector table contains serial and parallel port addresses,

time and date, keyboard buffer pointers … (for more see table 1)

Next comes more BIOS routines (loaded from io.sys) to manage this data

After comes various parts of DOS Addresses from A0000h to BFFFFh are

located on the video adapter (VRAM) The rest (< 640 KB) is for user programs

Page 21: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

21

io.sysmsdos.syscommand.com

Page 22: 1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)

22

System Startup ProcedureSystem Startup Procedure

1. CPU jumps to an initialization program in the ROM BIOS. (bootstrap loader loads io.sys, msdos.sys, command.com)

2. Command.com: the initialization part (config.sys, autoexec.bat) / the resident part / the transient part