Operating Systems: Segments 1 Segmentation Hardware Support single user program system: – wish somehow to relocate address 0 to after operating system.

Slides:



Advertisements
Similar presentations
Virtual Memory. Invented on Manchester atlas 1962 It embodied many pioneering features, which we now take for granted. These include system features such.
Advertisements

1/1/ / faculty of Electrical Engineering eindhoven university of technology Memory Management and Protection Part 3:Virtual memory, mode switching,
Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than.
Intel MP.
Microprocessors system architectures – IA32 real and virtual-8086 mode Jakub Yaghob.
CSC 221 Computer Organization and Assembly Language
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
IA-32 Processor Architecture
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
X86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Microprocessors Introduction to ia32 Architecture Jan 31st, 2002.
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.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
UNIT 2 Memory Management Unit and Segment Description and Paging
An Introduction to 8086 Microprocessor.
80386DX.
Intel MP (32-bit microprocessor) Designed to overcome the limits of its predecessor while maintaining the software compatibility with the.
The Pentium Processor.
Microprocessor system architectures – IA32 segmentation Jakub Yaghob.
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.
The Intel Microprocessors. Real Mode Memory Addressing Real mode, also called real address mode, is an operating mode of and later x86-compatible.
Multitasking Mr. Mahendra B. Salunke Asst. Prof. Dept. of Computer Engg., STES SITS, Narhe, Pune-41 STES Sinhgad Institute of Tech. & Science Dept. of.
Types of Registers (8086 Microprocessor Based)
80386DX.
Module R3 Process Scheduling. Module R3 involves the creation of a simple “Round Robin” dispatcher. The successful completion of this module will require.
Virtual 8086 Mode  The supports execution of one or more 8086, 8088, 80186, or programs in an protected-mode environment.  An 8086.
(-133)*33+44* *33+44*14 Input device memory calculator Output device controller Control bus data bus memory.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Segment Descriptor Segments are areas of memory defined by a programmer and can be a code, data or stack segment. In segments need not be all the.
The Pentium Processor Chapter 7 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer, 
1 Microprocessors CSE Protected Mode Memory Addressing Remember using real mode addressing we were previously able to address 1M Byte of memory.
INTRODUCTION TO INTEL X-86 FAMILY
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Chapter 2 The Microprocessor Architecture Microprocessors prepared by Dr. Mohamed A. Shohla.
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
MODULE 5 INTEL TODAY WE ARE GOING TO DISCUSS ABOUT, FEATURES OF 8086 LOGICAL PIN DIAGRAM INTERNAL ARCHITECTURE REGISTERS AND FLAGS OPERATING MODES.
1 x86 Programming Model Microprocessor Computer Architectures Lab Components of any Computer System Control – logic that controls fetching/execution of.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
The Microprocessor & Its Architecture A Course in Microprocessor Electrical Engineering Department Universitas 17 Agustus 1945 Jakarta.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Computer Science 516 Intel x86 Overview. Intel x86 Family Eight-bit 8080, 8085 – 1970s 16-bit 8086 – was internally 16 bits, externally 8 bits.
Introduction to 8086 Microprocessor
8086 Microprocessor.
Chapter 2 The Microprocessor and its Architecture
Basic Microprocessor Architecture
x86 segmentation, page tables, and interrupts
Intel 8088 (8086) Microprocessor Structure
Subject Name: Microprocesor Subject Code: 10CS45
Chapter 2: The Microprocessor and its Architecture
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS 301 Fall 2002 Computer Organization
Page Replacement Implementation Issues
The Microprocessor & Its Architecture
Assembly Language (CSW 353)
Computer Architecture CST 250
Chapter 2: The Microprocessor and its Architecture
Unit-I 80386DX Architecture
Process.
CS444/544 Operating Systems II Virtual Memory
Presentation transcript:

Operating Systems: Segments 1 Segmentation Hardware Support single user program system: – wish somehow to relocate address 0 to after operating system in memory – can then compile and run program as if from address 0 automatic hardware relocation: – a Relocation Base Register (RBR) – contents added in to every address before use »set to 0 when running operating system »set to address after operating system when running user program – program generates virtual addresses – become physical addresses after adding in the RBR contents operating system user program address 0 for op. sys. address 0 for user prog.

Operating Systems: Segments 2 –used on the English Electric KDF9 »first ever mainframe in the University of Edinburgh »operating system very small and simple – called the Director »RBR cleared when system call to Director and restored when returning to user »48-bit words, zero-addressing for pushdown/popup evaluation stack –also used on the DEC System-10 »36-bit words »first mainframe in Dept. of Computer Science »used for Computer Aided Design RBR CPU + memory virtual address 2345 physical address

Operating Systems: Segments 3 multiprogramming system: –each program must be prevented from accessing another program’s area a Limit Register in addition to RBR: –all virtual addresses must be less than a limit – the partition size –an exception generated into the operating system when limit violated –each program has its own base and limit values –limit value is a virtual limit »hence limit check and base address addition can operate concurrently Op. Sys. Partition 1 Partition 2 Partition 3 RBR CPU + memory Limit < virtual address yes no

Operating Systems: Segments 4 Multiple base and limit registers –separate pairs for each module e.g. code, data: code: data: –in effect Segment Registers –CPU knows whether code or data access requested »hence can relocate using the correct base and limit pair RBR code LR code RBR data LR data codedata LR code LR data RBR code

Operating Systems: Segments 5 Example : Intel 8086 (and Pentium real-address mode) –a 16-bit machine with 16-bit registers : –appropriate segment registers are selected implicitly »executing code addresses imply code segment register »stack operations imply stack segment register »others depend on the registers used in the instruction: AX AH AL DX DH DL CX CH CL BX BH BL BP SI DI SP 7 0 multiply, divide & I/O loop, shift, repeat & count base registers index registers stack pointer CS DS SS ES code segment selector data segment selector stack segment selector extra segment selector F IP MSW flags instruction pointer machine status word 15 0 SP SS BP SS BX DS SI DS DI DS BP+SI/DI SS BX+SI/DI SS Register Implied Segment ES for string operations

Operating Systems: Segments 6 »implicit segment register selection can be overridden with an instruction prefix »new values can be loaded into segment registers at any time –segments are all 64Kb in length –physical address calculation: »CPU addresses generated are 16-bits – regarded as within-segment offset »segment register value shifted left 4 and added to within-segment offset: –no variable size segments and no limit checking –segments can overlap in memory –no differential read/write/execute protection base offset linear address + = 64K segment base 0

Operating Systems: Segments 7 Segment Tables –an indexed array of base & limit pairs: –virtual address partitioned into two parts »position of partition defines maximum number of segments and their size –other information also present in each index entry »presence bit – whether this segment exists and has a valid base and limit »protection bits – to allow read/write/execute etc. for this segment »cacheable bit – to allow data in this segment to be cached or not base limit segment number within-segment offset virtual address

Operating Systems: Segments 8 Example – 1Mb segments : virtual address space 0x x x x x main program library data stack main program data library stack 0x x0A0000 0x1C0000 0x x x0A physical address space 0x1C0000 0x x0A0000 0x0C0000 0x x100000

Operating Systems: Segments 9 Shared segments: process 1 virtual address space 0x x main program 1 shared library main program 1 shared library main program 2 0x x1C0000 0x x0A physical address space 0x1C0000 0x Process 1 process 1 segment table 0x0C0000 process 2 virtual address space 0x x main program 2 shared library 0x0C0000 0x0B x1C0000 0x Process 2 process 2 segment table 0x

Operating Systems: Segments 10 Example : the ARM processor MMU : –12-bit section (segment) number, 20-bit offset –Translation Table Base is a loadable processor register »new value loaded whenever running process switched –translation table (segment table) contains descriptors for sections

Operating Systems: Segments 11 –level-one descriptor formats : »AP : access permission bits, read/write, no access etc. ­together with other processor register bits R and S »Domain : level of access control, client/manager etc. »C : cacheable bit »B : bufferable bit – write-through write buffer enable bit –paging also possible »two page sizes available, 4Kb and 1Mb blocks

Operating Systems: Segments 12 –the full translation process for sections :

Operating Systems: Segments 13 Example : Intel Pentium protected mode : –32-bit registers with 16 and 8 bit versions available for backwards compatibility –implicit segment register selection as on 8086 –running program must ensure segment registers loaded with correct selectors »a selector is an index into a Descriptor Table »a descriptor table acts as a segment table but many other types of descriptor also exist: ­e.g. call, interrupt, trap and task gates AH AL DH DL CH CL BH BL CS DS SS ES code segment selector data segment selector stack segment selector extra segment selectors FS GS AX DX CX BX BP SI DI 31 SP EAX EDX ECX EBX EBP ESI EDI ESP EFLAGS EIP status and control registers

Operating Systems: Segments 14 –selector structure : »TI : table indicator, 0 = Global Descriptor Table, 1 = Local Descriptor Table »RPL : Requestor Privilege Level, 00 = most privileged, 11 = least privileged TI RPL index Global Descriptor Table base addresslimit Global Descriptor Table Base Register Local Descriptor Table base addresslimit Local Descriptor Table Base Register

Operating Systems: Segments 15 –two descriptor tables : »one for kernel segments and gates ­same table used all the time ­each process has its own local descriptor table ­saves reloading base register each time kernel entered »one for each process segments and gates ­local descriptor table base register changed as running process switched –selector index (13 bits) + TI bit + within-segment offset (32 bits) »effectively give a 46-bit virtual address : selectoroffset segment descriptor descriptor table + linear address base address bit linear address also possible on Pentium II up

Operating Systems: Segments 16 –descriptor table segment entry : »base : segment base address »G : granularity : ­0 = segment limit expressed in bytes, from 1 byte to 1Mb ­1 = segment limit expressed in 4Kb units, from 4Kb to 4Gb »D : default operation size, 0 = 16-bit, 1 = 32-bit ­for backwards compatibility »P : presence bit »DPL : descriptor privilege level »S : system/application descriptor type »type : segment type ­for access control base (31:24) G D P DPL S type base (23:16) base address (15:0) segment limit (15:0) seg lim (19:16)

Operating Systems: Segments 17 –A bit : set when selector has been loaded into a segment register –expand-down for stacks etc. »the limit check reversed –conforming associated with changing privilege levels in new segments

Operating Systems: Segments 18 –when a program loads a selector into a segment register : »hardware uses selector value to index into appropriate descriptor table and loads base and limit values into invisible part of the segment register: –access permission to segment validated at time of loading segment register »never needs to be done again whilst that segment is in use ­much more efficient –checks involve: »processes current privilege level (CPL) »descriptor privilege level (DPL) »requestor privilege level (RPL) CS DS SS ES FS GS visible part invisible part selector base address, limit etc.

Operating Systems: Segments 19 –CPL is held in the two lowest bits of the code segment (CS) register »normally is the same as the privilege level of the current code segment ­except for conforming segments called from a less privileged level »changes when control passes to a code segment with a different privilege level –instructions may only load a segment register if CPL  DPL »i.e. process has a greater or equal level of privilege as the segment »Rings of Protection –RPL is in the segment selector »represents the privilege level of the procedure which created the selector »when RPL  CPL, this value overrides the CPL for accesses using that selector »used to guard against a security violation in which a less privileged program requests a more privileged program to access protected data »data can be given a lower privilege RPL to protect it, even though the program doing the accessing might otherwise have sufficient privilege to do so higher privilege lower privilege

Operating Systems: Segments 20 Multitasking on Pentiums –Task State Segment (TSS) »for each process, holds volatile context (PCB) for that process »a segment with a descriptor in the Global Descriptor Table –Task Register (TR) »identifies the current TSS –Interrupt Descriptor Table Register (IDTR) »a segment register for the segment which holds the Interrupt Descriptor Table »when an interrupt occurs, this table is used as an interrupt vector