Prelude to Multiprocessing Detecting cpu and system-board capabilities with CPUID and the MP Configuration Table.

Slides:



Advertisements
Similar presentations
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
Advertisements

Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
Microprocessors General Features To be Examined For Each Chip Jan 24 th, 2002.
Computer Organization and Assembly Languages Yung-Yu Chuang
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
Intel MP.
Computer Organization and Architecture
Computer Organization and Architecture
Multiprocessor Initialization
Facilities for x86 debugging
Introduction to 8086 emulation Using ‘Virtual-8086’ mode to execute real-mode procedures in a protected-mode environment.
Prelude to Multiprocessing Detecting cpu and system-board capabilities with CPUID and the MP Configuration Table.
8086 emulation Using Virtual-8086 mode to execute real-mode procedures in a protected-mode environment.
IA-32 Processor Architecture
The x86 Feature Flags On using the CPUID instruction for processor identification and feature determination.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
PC hardware and x86 3/3/08 Frans Kaashoek MIT
Prelude to Multiprocessing Detecting cpu and system-board capabilities with CPUID and the MP Configuration Table.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Facilities for x86 debugging Introduction to Pentium features that can assist programmers in their debugging of software.
The i/o-sensitive instructions An introduction to the software emulation of i/o-sensitive instructions in Virtual-8086 mode.
Multiprocessor Initialization
Microprocessors Introduction to ia32 Architecture Jan 31st, 2002.
Introduction to the Intel x86’s support for “virtual” memory
GNU/Linux assembly language Reviewing the basics of assembly language programming for Intel x86-based Linux systems.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 2: 80386DX Internal Architecture & Data Organization.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 15: Protected mode intro.
ECE 424 Embedded Systems Design Lecture 8 & 9 & 10: Embedded Processor Architecture Chapter 5 Ning Weng.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
8086 emulation Using Virtual-8086 mode to execute real-mode procedures in a protected-mode environment.
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Intel
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 2: IA-32 Processor Architecture (c) Pearson Education, All rights reserved. You.
6.828: PC hardware and x86 Frans Kaashoek
Windows Kernel Internals Traps, Interrupts, Exceptions
The Pentium Processor.
The Pentium Processor Chapter 3 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
The Pentium Processor Chapter 3 S. Dandamudi.
Computer architecture Lecture 6: Processor’s structure Piotr Bilski.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Introduction of Intel Processors
Intel Pentium II Processor Brent Perry Pat Reagan Brian Davis Umesh Vemuri.
The 8051 Microcontroller and Embedded Systems
Lecture 3. APIC ID Prof. Taeweon Suh Computer Science Education Korea University COM509 Computer Systems.
Interrupts in the guest VM A look at the steps needed to “reflect” hardware interrupts back into the ROM-BIOS for servicing.
1 ICS 51 Introductory Computer Organization Fall 2009.
26-Nov-15 (1) CSC Computer Organization Lecture 6: Pentium IA-32.
Virtual 8086 Mode  The supports execution of one or more 8086, 8088, 80186, or programs in an protected-mode environment.  An 8086.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Different Microprocessors Tamanna Haque Nipa Lecturer Dept. of Computer Science Stamford University Bangladesh.
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.
Computer Organization 1
The Microprocessor & Its Architecture A Course in Microprocessor Electrical Engineering Department Universitas 17 Agustus 1945 Jakarta.
x86 Processor Architecture
Anton Burtsev February, 2017
Basic Microprocessor Architecture
contains 8086 processor and several additional functional chips: clock generator 2 independent DMA channels PIC 3 programmable 16-bit timers.
Homework Reading Continue work on mp1
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
CS 301 Fall 2002 Computer Organization
The Microprocessor & Its Architecture
Computer Architecture and System Programming Laboratory
Presentation transcript:

Prelude to Multiprocessing Detecting cpu and system-board capabilities with CPUID and the MP Configuration Table

CPUID Recent Intel processors provide a ‘cpuid’ instruction (opcode 0x0F, 0xA2) to assist software in detecting a CPU’s capabilities If it’s implemented, this instruction can be executed in any of the processor modes, and at any privilege level But it may not be implemented (e.g., 8086, 80286, 80386)

Pentium EFLAGS register IDID VIPVIP VIFVIF ACAC VMVM RFRF 0 NTNT IOPL OFOF DFDF IFIF TFTF SFSF ZFZF 0 AFAF 0 PFPF 1 CFCF Software can ‘toggle’ the ID-bit (bit #21) in the 32-bit EFLAGS register if the processor is capable of executing the ‘cpuid’ instruction

But what if there’s no EFLAGS? The early Intel processors (8086, 80286) did not implement 32-bit registers The FLAGS register was only 16-bits wide So there was no ID-bit that software could try to ‘toggle’ How can software be sure that the 32-bit EFLAGS register exists within the CPU?

Detecting 32-bit processors There’s a subtle difference in the way the logical shift/rotate instructions work when register CL contains the shift-factor On the 32-bit processors (e.g., ) the value in CL is truncated to 5-bits, but not so on the 16-bit CPUs (8086, 80286) Software can exploit this distinction, in order to tell if EFLAGS is implemented

Detecting EFLAGS # Here’s a test for the presence of EFLAGS mov $-1, %ax# a nonzero value mov $32, %cl# shift-factor of 32 shl %cl, %ax# do logical shift or %ax, %ax# test result in AX jnz is32bit# EFLAGS present jmp is16bit# EFLAGS absent

Testing for ID-bit ‘toggle’ # Here’s a test for the presence of the CPUID instruction pushfl# copy EFLAGS contents pop%eax# to accumulator register mov%eax, %edx# save a duplicate image btc$21, %eax# toggle the ID-bit (bit 21) push%eax# copy revised contents popfl# back into EFLAGS pushfl# copy EFLAGS contents pop%eax# back into accumulator xor%edx, %eax# do XOR with prior value bt$21, %eax# did ID-bit get toggled? jcy_cpuid# yes, can execute ‘cpuid’ jmpn_cpuid# else ‘cpuid’ unimplemented

How does CPUID work? Step 1: load value 0 into register EAX Step 2: execute ‘cpuid’ instruction Step 3: Verify ‘GenuineIntel’ character- string in registers (EBX,EDX,ECX) Step 4: Find maximum CPUID input-value in the EAX register

load 1 into EAX and execute CPUID Processor model and stepping information is returned in register EAX Version and Features Extended Family ID Extended Model ID Type Family ID Model Stepping ID

Some Feature Flags in EDX HTTHTT APICAPIC PSEPSE DEDE VMEVME FPUFPU HTT = HyperThreading Technology (1 = yes, 0 = no) APIC = Advanced Programmable Interrupt Controller on-chip (1 = yes,0 = no) PSE = Page-Size Extensions (1 = yes, 0 = no) DE = Debugging Extensions (1=yes, 0=no) VME = Virtual-8086 Mode Enhancements (1 = yes, 0 = no) FPU = Floating-Point Unit on-chil (1=yes, 0=no) 120

Some Feature Flags in ECX VMXVMX 5 VMX = Virtual Machine Extensions (1 = yes, 0 = no)

Multiprocessor Specification It’s an industry standard, allowing OS software to use multiple processors in a uniform way Software searches in three regions of the physical address-space below 1-megabyte for a “paragraph-aligned” data-structure of length 16- bytes called the MP Floating Pointer Structure: –Search in lowest KB of Extended Bios Data Area –Search in topmost KB of conventional 640K RAM –Search in the 64KB ROM-BIOS (0xF0000-0xFFFFF)

MP Floating Pointer Structure This structure may contain an ID-number for one a small number of standard SMP system architectures, or may contain the memory address for a more extensive MP Configuration Table whose entries specify a “more customized” system architecture Our classroom machines employ the latter of these two options

The processor’s Local-APIC The purpose of each processor’s APIC is to allow CPUs in a multiprocessor system to transmit messages among one another and to manage the delivery of interrupts from the various peripheral devices to one or more CPUs in a dynamically determined way The Local-APIC has a variety of registers which are ‘memory mapped’ to paragraph-aligned addresses in the 4KB page at 0xFEE00000

Local-APIC’s register-space APIC 0xFEE GB physical address-space 0x RAM

Each CPU has its own timer! Four of the Local-APIC registers are used to implement a programmable timer It can privately deliver a periodic interrupt just to its own CPU –0xFEE00320: Timer Vector register –0xFEE00380: Initial Count register –0xFEE00390: Current Count register –0xFEE003E0: Divider Configuration register

Timer’s Local Vector Table Interrupt ID-number MODEMODE MASKMASK BUSYBUSY xFEE00320 MODE: 0=one-shot 1=periodic MASK: 0=unmasked 1=masked BUSY: 0=not busy 1=busy

In-class exercise Run the ‘cpuid.cpp’ Linux application (on our course website) to see if the CPUs in our classroom implement HyperThreading (i.e., multiple processors within one CPU) Then run the ‘smpinfo.cpp’ application, to see if the MP Base Configuration Table has entries for more than one processor If both results hold true, then we can write our own multiprocessing software in here!

In-class exercise #2 Run the ‘apictick.s’ demo (on our website) to observe the APIC’s periodic interrupt drawing bytes onto the screen It executes for ten-milliseconds (the 8254 is used to create this timed delay) Try reprogramming the APIC’s Divider Configuration register, to cut the interrupt frequency in half (or to double it)