segmentation

12
Segmentation Pradyumna

Upload: pradyumna-doddala

Post on 21-Dec-2014

261 views

Category:

Education


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Segmentation

Segmentation

Pradyumna

Page 2: Segmentation

Definition

• Way of offering protection to different data types and code.

Page 3: Segmentation

Descriptor Tables

• Descriptor table is a array of 8k Descriptors• 3 types – Global Descriptor Table (GDT)– Local Descriptor Table (LDT)– Interrupt Descriptor Table (IDT)

Page 4: Segmentation

GDT&LDT

GDT• Contains Global descriptors

common to all tasks• Contains al the descriptor

types except interrupt & trap descriptors

LDT• Contains descriptors specific

to a particular task• Contains segment , task

gate & call gate descriptors.

Page 5: Segmentation

IDT• The Interrupt Descriptor Table (IDT) is a data

structure used to implement an interrupt vector table.

• The IDT is used by the processor to determine the correct response to interrupts & exceptions.

• Use of the IDT is triggered by three types of events: hardware interrupts, software interrupts, and processor exceptions, which together are referred to as "interrupts".

• The IDT consists of 256 interrupt vectors

Page 6: Segmentation

Descriptors

• These carry all the info about a segment and its access rights

• These have 20 bit segment limit and 32-bit segment address.

• 5 types of descriptors– Code or data segment Descriptors– System Descriptors– Local Descriptors– TSS (Task State segment) Descriptors– GATE Descriptors

Page 7: Segmentation

Segment descriptor

• Segment descriptors are a part of the segmentation unit, used for translating a logical address to linear address. Segment descriptors describe the memory segment referred in the logical address

Page 8: Segmentation

TSS• The Task State Segment is a structure which

holds information about a task. • It is used by the OS kernel for task management. • Specifically, the following information is stored

in the TSS:– Processor register state– I/O Port permissions– Inner level stack pointers– Previous TSS link

Page 9: Segmentation

Gate Descriptors

• Mechanism, for changing the privilege level of the CPU when it executes a predefined function callusing a CALL FAR instruction.

Page 10: Segmentation

• A Accessed Bit• G Granularity Bit-1=Segment

Length is page granular,0=Segment length is byte granular

• D Default Operation Size-1=32 bit segment,0=16-segment

• 0 Bit must be zero for compatibility with future processors

• AVL Available field for user or OS

• BASE Base Address of the segment

• LIMIT the length of the segment

• P Present BIT-1=Present,0=Not Present

• DPL Descriptor Privilege Level 0-3

• S Segment Descriptor -0=System Descriptor ,1=Code or Data Segment Descriptor

• TYPE type of segment

Page 11: Segmentation

Advantages

• memory protection added to segment table like paging

• sharing of memory similar to paging (but per area rather than per page)

Page 12: Segmentation

Drawbacks

• Allocation algorithms as for memory partitions• External fragmentation, back to compaction

problem.