SlideShare a Scribd company logo
1/23/20 1
Protection Mechanism in 80386
Subject : Processor Architecture &
Interfacing
Class : SEIT
Prepared By,
Ms. K. D. Patil, AP
Department of IT, Sanjivani COE,
Kopargaon.
1/23/20 1
1/23/20 1
1/23/20 2
why Security??
●
Computer system security measures prevent
-
Users from interfacing with one another
-
Users from examining secure data
-
Program bugs from damaging other programs
-
Program bugs from damaging data
-
Malicious attempts to compromise system integrity
-
Accidental damage to data
1/23/20 Prepared By: K.D.Patil 2
1/23/20 3
Protection Mechanism
●
80386 protection mechanism is divided into 2 parts
●
Memory Management : Segmentation & Paging
-Memory management hardware catches most
programming errors such as bad or illegal address
generation, runaway subscripts, call/return stack
corruption.
●
Privilege Protection : Catches more subtle errors
and malicious attempts to compromise the integrity
of the system.
1/23/20 Prepared By: K.D.Patil 3
1/23/20 4
Protection in Segmentation
●
When an attempt is made to access a segment first of all,
the 80386 checks to see if the descriptor table indexed
by the selector contains a valid descriptor for that
selector.
●
If the selector attempts to access a location outside the
limit of the descriptor table does not contain a valid
descriptor then an exception is produced.
●
The 80386 also checks to see if the segment descriptor is
of the right type to be loaded into the specified segment
register cache.
●
1/23/20 Prepared By: K.D.Patil 4
1/23/20 5
Protection in Segmentation
●
Example. The descriptor for read-only data segment,
loaded into the SS register, become a stack must be able
to be written to.
●
A selector for code segment which has been marked
‘execute only’ cannot be loaded into the DS register to
allow reading the contents of the segment.
●
Through the following two fields, protection can be provided
- Limit Checking
-Type Checking
●
1/23/20 Prepared By: K.D.Patil 5
1/23/20 6
Type Checking
●
The ‘type’ field of the descriptor specifies type of
the descriptor and the intended usage of the
segment.
●
W, R, C, A, ED bits from type field specify the
usage of the segment and restrict the segment for
particular use only.
●
Type checking is used the detect whether any
program is attempting to use segments in ways
not intended by the programmer.
1/23/20 Prepared By: K.D.Patil 6
1/23/20 7
Limit Checking
●
The 80386 uses limit field of a segment descriptor to prevent
programs from addressing outside the segments.
●
It interprets limit field depending on setting of the G (Granularity bit).
●
In case of data segments processor also checks ED (Expand
Downward) bit and B bit.
●
The 80386 causes a general protection exception when program
attempts to
– Access memory byte at an address > limit
– Access memory word at an address >= limit
– Access memory dword at an address >= (limit-2)
1/23/20 Prepared By: K.D.Patil 7
1/23/20 8
Privilege Level Protection
1/23/20 Prepared By: K.D.Patil 8
1/23/20 9
Privilege Level Protection
●
The privilege level protection consists of four levels of
privilege numbered from 0 to 3.
●
Privilege Level 0 is the most privileged level and PL3 is least
privileged
●
When running in protected mode, 80386 continuously checks
that the application is privileged enough to
- Execute certain instruction
- Reference data other than its own
- Transfer control to code other than its own
1/23/20 Prepared By: K.D.Patil 9
1/23/20 10
Privilege Level Protection
●
Descriptor contain a field called the descriptor privilege
level (DPL).
●
Selector contain a field called requestor’s privilege level
(RPL). The RPL is intended to represent the privilege
level of the procedure that originate a selector.
●
The 80386 stores the descriptors in the internal cache
for currently executing segments. Privilege level for
such descriptors are referred to as current privilege
level (CPL).
1/23/20 Prepared By: K.D.Patil 10
1/23/20 11
Restricting access to Data
1/23/20 Prepared By: K.D.Patil 11
1/23/20 12
Data Access
1/23/20 Prepared By: K.D.Patil 12
1/23/20 13
1/23/20 14
Restricting Control Transfer
●
In case of far JMP, CALL and RET, control is
transferred to the other segment.
●
To successfully transfer the control to other
segment, both the RPL and the CPL must be
a number less than or equal to DPL of the
segment.
●
MAX (CPL, RPL) <= DPL
1/23/20 Prepared By: K.D.Patil 14
1/23/20 15
Privileged Instructions
●
Privileged Instructions are those that
-
affect the segmentation and protected mechanism
-
alter the interrupt flag
-
perform peripheral I/O
●
To perform first two types of instructions code must be at
CPL 0 (Current Privilege Level 0)
●
Instructions on the next slide can be used in code
segments for which the descriptors‘ privilege level is
equal to 0.
1/23/20 Prepared By: K.D.Patil 15
1/23/20 16
Privileged Instructions
1/23/20 Prepared By: K.D.Patil 16
1/23/20 17
Privileged Instructions
1/23/20 Prepared By: K.D.Patil 17
●
The third type of instructions that perform I/O, same
as above but here CPL does not necessarily have
to be 0 for them to be executed, instead application
can be performed these I/O instruction if CPL is less
than or equal to IOPL field in EFLAGS.
1/23/20 18
Changing Privilege Levels
●
There are two ways to change privilege levels
– Conforming Code Segment
– Call gates
●
A restriction that the segment which has a higher
privilege level must be conforming code segment.
●
Allows to access the segment which has a higher
privilege level using special structure known as
Call Gate.
1/23/20 Prepared By: K.D.Patil 18
1/23/20 19
Conforming Code Segment
● A code segment is considered if bit 2 of the access rights byte of its decriptor is
set
● Conforming code segment can have read permission or not, just like a normal
non-conforming code descriptor
● Conforming code segments have no inherent privilege level of their own, they
conform to the level of code that calls them or jmps to them.
● eg. If the program in PL3 segment transfers control to a conforming code
segment, then the conforming code runs with CPL equal to 3.
● For these reasons, conforming code segments should never contain privilege
instructions
● When control is transfered to a conforming code segment, the RPL bits of
register CS are not changed to match segment’s DPL, as they normally would
be, instead they reflect the correct CPL, the DPL of non-conforming code
segment tha was executed.
1/23/20 20
Conforming Code Segment
● Can be defined with different privilege levels.
● Do not impart additional privileges.
● Do not remove existing privileges.
● Do not alter RPL bits in the code segment register.
● Can be shared by code at all privileg levels.
● DPL of conforming code segment descriptor must be always less than
or equal to current CPL.
DPL conforming code segment <= current CPL
● You can transfer control only across up. You can never transfer control
to segment whose DPL id greater (less privileged) than current
segment.
1/23/20 21
Call Gates
● Conforming code segments does not actually change your privilege
level but conforms to the level of its caller, it does allow programs running
at different privilege levels to share one piece of code. This is ideal for
shared libraries.
● To effect real change in privilege level, you need to use call gate.
● defined like special system segment descriptors.
● It acts as an interface layer between code at different privilege levels.
● Call gates are the only way to change privilege level in 80386. No gate,
No transfer.
● They do not define any memory space.
● They have no base or no limit fields.
● Technically they are not decriptors but it is convenient to place them in
the descriptor tables.
● Call gate is just put into GDT/LDT, just as segment of other descriptors.
1/23/20 22
Call Gates
● The call gate is a mechanism that allows to call a procedure located in any segment
which has highest privilege level.
● The call gate defines the code segment and exact offset where the control is to be
transferred.
● It is important that the CALL instrction must refer a call gate, not the destination code
segment. Applications can never reference a code segment at different privilege levels
directly.
● JMPs are not allowed.
● The call gate defines code segment to which control is to be transfered and the exact
offset within that segment where the execution will begin.
● You are not allowed to specify the desired offset in your program.
● When program does a CALL to procedure in another segment, the selector for that
segment’s call gate is placed into visible portion and call gate descriptor is placed into
hidden portion of CS register.
● Selectors pointing to the call gate decsriptor cannot be loaded into data segment
registers (DS, ES, FS and GS) or stack segment registers (SS). They can be loaded
into CS only.
1/23/20 23
Call Gate Format
Selector: Destination code segment
Offset: offset within destination code segment
DWORD Count: 0 to 31
DPL: Descriptor Privilege level
P: Descriptor present flag
1/23/20 24
During the process,validity of control transfer
is checked using four privilege levels
● The CPL
● The PRL of the selector used to specify the call gate
● The DPL of the gate descriptor
● The DPL of the descriptor of the target executable
segment
● for valid control transfer, the transfer must satisfy the
following privilege rules for CALL instruction:
Target DPL <= Max (RPL, CPL) <= Gate DPL
1/23/20 25
Calling through call gate
1/23/20 26
Privilege Level check via call gate
1/23/20 2727
References
●
James Turley, “Advanced 80386 programming
Techniques”, Tata McGraw Hill
●
Presentation shared by Prof. Tushar Kute at the
time of PAI FDP
1/23/20 Prepared By:K.D.Patil1/23/20 27

More Related Content

What's hot

Register Organization of 80386
Register Organization of 80386Register Organization of 80386
INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
Gurudev joshi
 
Special of 80386 registers
Special of 80386 registersSpecial of 80386 registers
Special of 80386 registers
Tanmoy Mazumder
 
INTEL 80386 MICROPROCESSOR
INTEL  80386  MICROPROCESSORINTEL  80386  MICROPROCESSOR
INTEL 80386 MICROPROCESSOR
Annies Minu
 
PAI Unit 2 Segmentation in 80386 microprocessor
PAI Unit 2 Segmentation in 80386 microprocessorPAI Unit 2 Segmentation in 80386 microprocessor
PAI Unit 2 Segmentation in 80386 microprocessor
KanchanPatil34
 
80386 Architecture
80386 Architecture80386 Architecture
80386 Architecture
Rohit Choudhury
 
Introduction to 80386 microprocessor
Introduction to 80386 microprocessorIntroduction to 80386 microprocessor
Introduction to 80386 microprocessor
Shehrevar Davierwala
 
Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)
muneer.k
 
Registers
RegistersRegisters
Registers
Sahil Bansal
 
80386 & 80486
80386 & 8048680386 & 80486
80386 & 80486
RakeshKumarSharma46
 
Modes of 80386
Modes of 80386Modes of 80386
Modes of 80386aviban
 
Protection 80386
Protection 80386Protection 80386
Protection 80386
Akshay Nagpurkar
 
80386 processor
80386 processor80386 processor
80386 processor
Rasmi M
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Mahalakshmiv11
 
Register of 80386
Register of 80386Register of 80386
Register of 80386aviban
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
prasadpawaskar
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessor
GurleenKaur408
 
Intel® 80386 microprocessor registers
Intel® 80386 microprocessor registersIntel® 80386 microprocessor registers
Intel® 80386 microprocessor registers
Neel Shah
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorNikhil Kumar
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
Gopikrishna Madanan
 

What's hot (20)

Register Organization of 80386
Register Organization of 80386Register Organization of 80386
Register Organization of 80386
 
INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
 
Special of 80386 registers
Special of 80386 registersSpecial of 80386 registers
Special of 80386 registers
 
INTEL 80386 MICROPROCESSOR
INTEL  80386  MICROPROCESSORINTEL  80386  MICROPROCESSOR
INTEL 80386 MICROPROCESSOR
 
PAI Unit 2 Segmentation in 80386 microprocessor
PAI Unit 2 Segmentation in 80386 microprocessorPAI Unit 2 Segmentation in 80386 microprocessor
PAI Unit 2 Segmentation in 80386 microprocessor
 
80386 Architecture
80386 Architecture80386 Architecture
80386 Architecture
 
Introduction to 80386 microprocessor
Introduction to 80386 microprocessorIntroduction to 80386 microprocessor
Introduction to 80386 microprocessor
 
Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)Architecture of 80386(www.munnuz.co.cc)
Architecture of 80386(www.munnuz.co.cc)
 
Registers
RegistersRegisters
Registers
 
80386 & 80486
80386 & 8048680386 & 80486
80386 & 80486
 
Modes of 80386
Modes of 80386Modes of 80386
Modes of 80386
 
Protection 80386
Protection 80386Protection 80386
Protection 80386
 
80386 processor
80386 processor80386 processor
80386 processor
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Register of 80386
Register of 80386Register of 80386
Register of 80386
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessor
 
Intel® 80386 microprocessor registers
Intel® 80386 microprocessor registersIntel® 80386 microprocessor registers
Intel® 80386 microprocessor registers
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 Microprocessor
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 

Similar to PAI Unit 2 Protection in 80386 segmentation

Unit-4 protection ppt of database m.pptx
Unit-4 protection ppt of database m.pptxUnit-4 protection ppt of database m.pptx
Unit-4 protection ppt of database m.pptx
yashdongare22
 
Protection Mechanism.ppt
Protection Mechanism.pptProtection Mechanism.ppt
Protection Mechanism.ppt
PramodBorole2
 
Microprocessor Protected Mode Memory addressing By DHEERAJ KATARIA
Microprocessor Protected Mode Memory addressing By DHEERAJ KATARIAMicroprocessor Protected Mode Memory addressing By DHEERAJ KATARIA
Microprocessor Protected Mode Memory addressing By DHEERAJ KATARIA
Dheeraj Kataria
 
Module 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and ProgrammingModule 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and Programming
Amogha Bandrikalli
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 MicrocontrollersSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
Arti Parab Academics
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overview
Linaro
 
UNIT-V (PIC16F877-Microcontrollers).pdf
UNIT-V (PIC16F877-Microcontrollers).pdfUNIT-V (PIC16F877-Microcontrollers).pdf
UNIT-V (PIC16F877-Microcontrollers).pdf
dhiyasrinivasan112
 
Memory mgmt 80386
Memory mgmt 80386Memory mgmt 80386
Memory mgmt 80386
Akshay Nagpurkar
 
32- bit Microprocessor-Indtel 80386.pptx
32- bit Microprocessor-Indtel 80386.pptx32- bit Microprocessor-Indtel 80386.pptx
32- bit Microprocessor-Indtel 80386.pptx
Yuvraj994432
 
SE PAI Unit 2_Data Structures in 80386 segmentation
SE PAI Unit 2_Data Structures in 80386 segmentationSE PAI Unit 2_Data Structures in 80386 segmentation
SE PAI Unit 2_Data Structures in 80386 segmentation
KanchanPatil34
 
Arm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_modelArm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_model
Ganesh Naik
 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16
John Todora
 
24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf
FrangoCamila
 
IoT based Auto Manufacturing Body to Chassis Marriage
IoT based Auto Manufacturing Body to Chassis MarriageIoT based Auto Manufacturing Body to Chassis Marriage
IoT based Auto Manufacturing Body to Chassis Marriage
Surendra Kancherla
 
Embedded system classes in mumbai
Embedded system classes in mumbaiEmbedded system classes in mumbai
Embedded system classes in mumbai
Vibrant Technologies & Computers
 
chapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptxchapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptx
JaypeeFajanil
 
MPI UNIT 4 - (Introduction to DMA and ADC)
MPI UNIT 4 - (Introduction to DMA and ADC)MPI UNIT 4 - (Introduction to DMA and ADC)
MPI UNIT 4 - (Introduction to DMA and ADC)
RaviKiranVarma4
 
Communication Protocols Augmentation in VLSI Design Applications
Communication Protocols Augmentation in VLSI Design ApplicationsCommunication Protocols Augmentation in VLSI Design Applications
Communication Protocols Augmentation in VLSI Design Applications
IJERA Editor
 
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328PImplementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
IRJET Journal
 

Similar to PAI Unit 2 Protection in 80386 segmentation (20)

Unit-4 protection ppt of database m.pptx
Unit-4 protection ppt of database m.pptxUnit-4 protection ppt of database m.pptx
Unit-4 protection ppt of database m.pptx
 
Protection Mechanism.ppt
Protection Mechanism.pptProtection Mechanism.ppt
Protection Mechanism.ppt
 
Microprocessor Protected Mode Memory addressing By DHEERAJ KATARIA
Microprocessor Protected Mode Memory addressing By DHEERAJ KATARIAMicroprocessor Protected Mode Memory addressing By DHEERAJ KATARIA
Microprocessor Protected Mode Memory addressing By DHEERAJ KATARIA
 
Module 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and ProgrammingModule 2 ARM CORTEX M3 Instruction Set and Programming
Module 2 ARM CORTEX M3 Instruction Set and Programming
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 MicrocontrollersSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III  The 8051 Microcontrollers
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT III The 8051 Microcontrollers
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overview
 
UNIT-V (PIC16F877-Microcontrollers).pdf
UNIT-V (PIC16F877-Microcontrollers).pdfUNIT-V (PIC16F877-Microcontrollers).pdf
UNIT-V (PIC16F877-Microcontrollers).pdf
 
Memory mgmt 80386
Memory mgmt 80386Memory mgmt 80386
Memory mgmt 80386
 
32- bit Microprocessor-Indtel 80386.pptx
32- bit Microprocessor-Indtel 80386.pptx32- bit Microprocessor-Indtel 80386.pptx
32- bit Microprocessor-Indtel 80386.pptx
 
SE PAI Unit 2_Data Structures in 80386 segmentation
SE PAI Unit 2_Data Structures in 80386 segmentationSE PAI Unit 2_Data Structures in 80386 segmentation
SE PAI Unit 2_Data Structures in 80386 segmentation
 
Arm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_modelArm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_model
 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16
 
24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf
 
Segmentation
SegmentationSegmentation
Segmentation
 
IoT based Auto Manufacturing Body to Chassis Marriage
IoT based Auto Manufacturing Body to Chassis MarriageIoT based Auto Manufacturing Body to Chassis Marriage
IoT based Auto Manufacturing Body to Chassis Marriage
 
Embedded system classes in mumbai
Embedded system classes in mumbaiEmbedded system classes in mumbai
Embedded system classes in mumbai
 
chapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptxchapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptx
 
MPI UNIT 4 - (Introduction to DMA and ADC)
MPI UNIT 4 - (Introduction to DMA and ADC)MPI UNIT 4 - (Introduction to DMA and ADC)
MPI UNIT 4 - (Introduction to DMA and ADC)
 
Communication Protocols Augmentation in VLSI Design Applications
Communication Protocols Augmentation in VLSI Design ApplicationsCommunication Protocols Augmentation in VLSI Design Applications
Communication Protocols Augmentation in VLSI Design Applications
 
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328PImplementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
 

More from KanchanPatil34

Unit 2_2 Binary Tree as ADT_General Tree.pdf
Unit 2_2 Binary Tree as ADT_General Tree.pdfUnit 2_2 Binary Tree as ADT_General Tree.pdf
Unit 2_2 Binary Tree as ADT_General Tree.pdf
KanchanPatil34
 
Unit 2_1 Tree.pdf
Unit 2_1 Tree.pdfUnit 2_1 Tree.pdf
Unit 2_1 Tree.pdf
KanchanPatil34
 
Unit 2_3 Binary Tree Traversals.pdf
Unit 2_3 Binary Tree Traversals.pdfUnit 2_3 Binary Tree Traversals.pdf
Unit 2_3 Binary Tree Traversals.pdf
KanchanPatil34
 
Unit 1_SLL and DLL.pdf
Unit 1_SLL and DLL.pdfUnit 1_SLL and DLL.pdf
Unit 1_SLL and DLL.pdf
KanchanPatil34
 
Unit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdfUnit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdf
KanchanPatil34
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
KanchanPatil34
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
KanchanPatil34
 
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
KanchanPatil34
 
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
KanchanPatil34
 
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
KanchanPatil34
 
SE PAI Unit 5_IO programming in 8051
SE PAI Unit 5_IO programming in 8051SE PAI Unit 5_IO programming in 8051
SE PAI Unit 5_IO programming in 8051
KanchanPatil34
 
Unit 5_Interrupt programming in 8051 micro controller - part 2
Unit 5_Interrupt programming in 8051 micro controller - part 2Unit 5_Interrupt programming in 8051 micro controller - part 2
Unit 5_Interrupt programming in 8051 micro controller - part 2
KanchanPatil34
 
Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1
KanchanPatil34
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
KanchanPatil34
 
Unit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idtUnit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idt
KanchanPatil34
 
Unit 2 se pai_registers in 80386
Unit 2 se pai_registers in 80386Unit 2 se pai_registers in 80386
Unit 2 se pai_registers in 80386
KanchanPatil34
 
Unit i se pai_dos function calls
Unit i se pai_dos function callsUnit i se pai_dos function calls
Unit i se pai_dos function calls
KanchanPatil34
 
DELD Unit V cpld_fpga
DELD Unit V cpld_fpgaDELD Unit V cpld_fpga
DELD Unit V cpld_fpga
KanchanPatil34
 
DELD Unit IV ring and twisted ring counter
DELD Unit IV ring and twisted ring counterDELD Unit IV ring and twisted ring counter
DELD Unit IV ring and twisted ring counter
KanchanPatil34
 
DELD Unit IV operation modes of shift register
DELD Unit IV operation modes of shift registerDELD Unit IV operation modes of shift register
DELD Unit IV operation modes of shift register
KanchanPatil34
 

More from KanchanPatil34 (20)

Unit 2_2 Binary Tree as ADT_General Tree.pdf
Unit 2_2 Binary Tree as ADT_General Tree.pdfUnit 2_2 Binary Tree as ADT_General Tree.pdf
Unit 2_2 Binary Tree as ADT_General Tree.pdf
 
Unit 2_1 Tree.pdf
Unit 2_1 Tree.pdfUnit 2_1 Tree.pdf
Unit 2_1 Tree.pdf
 
Unit 2_3 Binary Tree Traversals.pdf
Unit 2_3 Binary Tree Traversals.pdfUnit 2_3 Binary Tree Traversals.pdf
Unit 2_3 Binary Tree Traversals.pdf
 
Unit 1_SLL and DLL.pdf
Unit 1_SLL and DLL.pdfUnit 1_SLL and DLL.pdf
Unit 1_SLL and DLL.pdf
 
Unit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdfUnit 1_Stack and Queue using Linked Organization.pdf
Unit 1_Stack and Queue using Linked Organization.pdf
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 1
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
 
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
SE PAI Unit 5_Serial Port Programming in 8051 micro controller_Part 3
 
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 2
 
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
SE PAI Unit 5_Serial Port Programming in 8051 microcontroller_Part 1
 
SE PAI Unit 5_IO programming in 8051
SE PAI Unit 5_IO programming in 8051SE PAI Unit 5_IO programming in 8051
SE PAI Unit 5_IO programming in 8051
 
Unit 5_Interrupt programming in 8051 micro controller - part 2
Unit 5_Interrupt programming in 8051 micro controller - part 2Unit 5_Interrupt programming in 8051 micro controller - part 2
Unit 5_Interrupt programming in 8051 micro controller - part 2
 
Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
Unit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idtUnit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idt
 
Unit 2 se pai_registers in 80386
Unit 2 se pai_registers in 80386Unit 2 se pai_registers in 80386
Unit 2 se pai_registers in 80386
 
Unit i se pai_dos function calls
Unit i se pai_dos function callsUnit i se pai_dos function calls
Unit i se pai_dos function calls
 
DELD Unit V cpld_fpga
DELD Unit V cpld_fpgaDELD Unit V cpld_fpga
DELD Unit V cpld_fpga
 
DELD Unit IV ring and twisted ring counter
DELD Unit IV ring and twisted ring counterDELD Unit IV ring and twisted ring counter
DELD Unit IV ring and twisted ring counter
 
DELD Unit IV operation modes of shift register
DELD Unit IV operation modes of shift registerDELD Unit IV operation modes of shift register
DELD Unit IV operation modes of shift register
 

Recently uploaded

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 

Recently uploaded (20)

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 

PAI Unit 2 Protection in 80386 segmentation

  • 1. 1/23/20 1 Protection Mechanism in 80386 Subject : Processor Architecture & Interfacing Class : SEIT Prepared By, Ms. K. D. Patil, AP Department of IT, Sanjivani COE, Kopargaon. 1/23/20 1 1/23/20 1
  • 2. 1/23/20 2 why Security?? ● Computer system security measures prevent - Users from interfacing with one another - Users from examining secure data - Program bugs from damaging other programs - Program bugs from damaging data - Malicious attempts to compromise system integrity - Accidental damage to data 1/23/20 Prepared By: K.D.Patil 2
  • 3. 1/23/20 3 Protection Mechanism ● 80386 protection mechanism is divided into 2 parts ● Memory Management : Segmentation & Paging -Memory management hardware catches most programming errors such as bad or illegal address generation, runaway subscripts, call/return stack corruption. ● Privilege Protection : Catches more subtle errors and malicious attempts to compromise the integrity of the system. 1/23/20 Prepared By: K.D.Patil 3
  • 4. 1/23/20 4 Protection in Segmentation ● When an attempt is made to access a segment first of all, the 80386 checks to see if the descriptor table indexed by the selector contains a valid descriptor for that selector. ● If the selector attempts to access a location outside the limit of the descriptor table does not contain a valid descriptor then an exception is produced. ● The 80386 also checks to see if the segment descriptor is of the right type to be loaded into the specified segment register cache. ● 1/23/20 Prepared By: K.D.Patil 4
  • 5. 1/23/20 5 Protection in Segmentation ● Example. The descriptor for read-only data segment, loaded into the SS register, become a stack must be able to be written to. ● A selector for code segment which has been marked ‘execute only’ cannot be loaded into the DS register to allow reading the contents of the segment. ● Through the following two fields, protection can be provided - Limit Checking -Type Checking ● 1/23/20 Prepared By: K.D.Patil 5
  • 6. 1/23/20 6 Type Checking ● The ‘type’ field of the descriptor specifies type of the descriptor and the intended usage of the segment. ● W, R, C, A, ED bits from type field specify the usage of the segment and restrict the segment for particular use only. ● Type checking is used the detect whether any program is attempting to use segments in ways not intended by the programmer. 1/23/20 Prepared By: K.D.Patil 6
  • 7. 1/23/20 7 Limit Checking ● The 80386 uses limit field of a segment descriptor to prevent programs from addressing outside the segments. ● It interprets limit field depending on setting of the G (Granularity bit). ● In case of data segments processor also checks ED (Expand Downward) bit and B bit. ● The 80386 causes a general protection exception when program attempts to – Access memory byte at an address > limit – Access memory word at an address >= limit – Access memory dword at an address >= (limit-2) 1/23/20 Prepared By: K.D.Patil 7
  • 8. 1/23/20 8 Privilege Level Protection 1/23/20 Prepared By: K.D.Patil 8
  • 9. 1/23/20 9 Privilege Level Protection ● The privilege level protection consists of four levels of privilege numbered from 0 to 3. ● Privilege Level 0 is the most privileged level and PL3 is least privileged ● When running in protected mode, 80386 continuously checks that the application is privileged enough to - Execute certain instruction - Reference data other than its own - Transfer control to code other than its own 1/23/20 Prepared By: K.D.Patil 9
  • 10. 1/23/20 10 Privilege Level Protection ● Descriptor contain a field called the descriptor privilege level (DPL). ● Selector contain a field called requestor’s privilege level (RPL). The RPL is intended to represent the privilege level of the procedure that originate a selector. ● The 80386 stores the descriptors in the internal cache for currently executing segments. Privilege level for such descriptors are referred to as current privilege level (CPL). 1/23/20 Prepared By: K.D.Patil 10
  • 11. 1/23/20 11 Restricting access to Data 1/23/20 Prepared By: K.D.Patil 11
  • 12. 1/23/20 12 Data Access 1/23/20 Prepared By: K.D.Patil 12
  • 14. 1/23/20 14 Restricting Control Transfer ● In case of far JMP, CALL and RET, control is transferred to the other segment. ● To successfully transfer the control to other segment, both the RPL and the CPL must be a number less than or equal to DPL of the segment. ● MAX (CPL, RPL) <= DPL 1/23/20 Prepared By: K.D.Patil 14
  • 15. 1/23/20 15 Privileged Instructions ● Privileged Instructions are those that - affect the segmentation and protected mechanism - alter the interrupt flag - perform peripheral I/O ● To perform first two types of instructions code must be at CPL 0 (Current Privilege Level 0) ● Instructions on the next slide can be used in code segments for which the descriptors‘ privilege level is equal to 0. 1/23/20 Prepared By: K.D.Patil 15
  • 16. 1/23/20 16 Privileged Instructions 1/23/20 Prepared By: K.D.Patil 16
  • 17. 1/23/20 17 Privileged Instructions 1/23/20 Prepared By: K.D.Patil 17 ● The third type of instructions that perform I/O, same as above but here CPL does not necessarily have to be 0 for them to be executed, instead application can be performed these I/O instruction if CPL is less than or equal to IOPL field in EFLAGS.
  • 18. 1/23/20 18 Changing Privilege Levels ● There are two ways to change privilege levels – Conforming Code Segment – Call gates ● A restriction that the segment which has a higher privilege level must be conforming code segment. ● Allows to access the segment which has a higher privilege level using special structure known as Call Gate. 1/23/20 Prepared By: K.D.Patil 18
  • 19. 1/23/20 19 Conforming Code Segment ● A code segment is considered if bit 2 of the access rights byte of its decriptor is set ● Conforming code segment can have read permission or not, just like a normal non-conforming code descriptor ● Conforming code segments have no inherent privilege level of their own, they conform to the level of code that calls them or jmps to them. ● eg. If the program in PL3 segment transfers control to a conforming code segment, then the conforming code runs with CPL equal to 3. ● For these reasons, conforming code segments should never contain privilege instructions ● When control is transfered to a conforming code segment, the RPL bits of register CS are not changed to match segment’s DPL, as they normally would be, instead they reflect the correct CPL, the DPL of non-conforming code segment tha was executed.
  • 20. 1/23/20 20 Conforming Code Segment ● Can be defined with different privilege levels. ● Do not impart additional privileges. ● Do not remove existing privileges. ● Do not alter RPL bits in the code segment register. ● Can be shared by code at all privileg levels. ● DPL of conforming code segment descriptor must be always less than or equal to current CPL. DPL conforming code segment <= current CPL ● You can transfer control only across up. You can never transfer control to segment whose DPL id greater (less privileged) than current segment.
  • 21. 1/23/20 21 Call Gates ● Conforming code segments does not actually change your privilege level but conforms to the level of its caller, it does allow programs running at different privilege levels to share one piece of code. This is ideal for shared libraries. ● To effect real change in privilege level, you need to use call gate. ● defined like special system segment descriptors. ● It acts as an interface layer between code at different privilege levels. ● Call gates are the only way to change privilege level in 80386. No gate, No transfer. ● They do not define any memory space. ● They have no base or no limit fields. ● Technically they are not decriptors but it is convenient to place them in the descriptor tables. ● Call gate is just put into GDT/LDT, just as segment of other descriptors.
  • 22. 1/23/20 22 Call Gates ● The call gate is a mechanism that allows to call a procedure located in any segment which has highest privilege level. ● The call gate defines the code segment and exact offset where the control is to be transferred. ● It is important that the CALL instrction must refer a call gate, not the destination code segment. Applications can never reference a code segment at different privilege levels directly. ● JMPs are not allowed. ● The call gate defines code segment to which control is to be transfered and the exact offset within that segment where the execution will begin. ● You are not allowed to specify the desired offset in your program. ● When program does a CALL to procedure in another segment, the selector for that segment’s call gate is placed into visible portion and call gate descriptor is placed into hidden portion of CS register. ● Selectors pointing to the call gate decsriptor cannot be loaded into data segment registers (DS, ES, FS and GS) or stack segment registers (SS). They can be loaded into CS only.
  • 23. 1/23/20 23 Call Gate Format Selector: Destination code segment Offset: offset within destination code segment DWORD Count: 0 to 31 DPL: Descriptor Privilege level P: Descriptor present flag
  • 24. 1/23/20 24 During the process,validity of control transfer is checked using four privilege levels ● The CPL ● The PRL of the selector used to specify the call gate ● The DPL of the gate descriptor ● The DPL of the descriptor of the target executable segment ● for valid control transfer, the transfer must satisfy the following privilege rules for CALL instruction: Target DPL <= Max (RPL, CPL) <= Gate DPL
  • 26. 1/23/20 26 Privilege Level check via call gate
  • 27. 1/23/20 2727 References ● James Turley, “Advanced 80386 programming Techniques”, Tata McGraw Hill ● Presentation shared by Prof. Tushar Kute at the time of PAI FDP 1/23/20 Prepared By:K.D.Patil1/23/20 27