SlideShare a Scribd company logo
1 of 27
Download to read offline
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

8086 architecture and pin description
8086 architecture and pin description 8086 architecture and pin description
8086 architecture and pin description Aswini Dharmaraj
 
Register of 80386
Register of 80386Register of 80386
Register of 80386aviban
 
Addressing modes of 80386
Addressing modes of 80386Addressing modes of 80386
Addressing modes of 80386PDFSHARE
 
PAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 MicroporcessorPAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 MicroporcessorKanchanPatil34
 
8086 in minimum mode
8086 in minimum mode8086 in minimum mode
8086 in minimum modeSridari Iyer
 
Microprocessor 80386
Microprocessor 80386Microprocessor 80386
Microprocessor 80386yash sawarkar
 
INTEL 80386 MICROPROCESSOR
INTEL  80386  MICROPROCESSORINTEL  80386  MICROPROCESSOR
INTEL 80386 MICROPROCESSORAnnies Minu
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)Ashim Saha
 
8086 memory segmentation
8086 memory segmentation8086 memory segmentation
8086 memory segmentationSridari Iyer
 
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 microprocessorKanchanPatil34
 
8086 modes
8086 modes8086 modes
8086 modesPDFSHARE
 
COMPUTER ORGANIZATION NOTES Unit 5
COMPUTER ORGANIZATION NOTES Unit 5COMPUTER ORGANIZATION NOTES Unit 5
COMPUTER ORGANIZATION NOTES Unit 5Dr.MAYA NAYAK
 
Pin Description Diagram of Intel 80386 DX Microprocessor
Pin Description Diagram of Intel 80386 DX MicroprocessorPin Description Diagram of Intel 80386 DX Microprocessor
Pin Description Diagram of Intel 80386 DX MicroprocessorRaunaq Sahni
 
Addressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyAddressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyBinu Joy
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 MicroprocessorNahian Ahmed
 

What's hot (20)

8086 architecture and pin description
8086 architecture and pin description 8086 architecture and pin description
8086 architecture and pin description
 
Register of 80386
Register of 80386Register of 80386
Register of 80386
 
Addressing modes of 80386
Addressing modes of 80386Addressing modes of 80386
Addressing modes of 80386
 
PAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 MicroporcessorPAI Unit 3 Paging in 80386 Microporcessor
PAI Unit 3 Paging in 80386 Microporcessor
 
8086 in minimum mode
8086 in minimum mode8086 in minimum mode
8086 in minimum mode
 
Microprocessor 80386
Microprocessor 80386Microprocessor 80386
Microprocessor 80386
 
INTEL 80386 MICROPROCESSOR
INTEL  80386  MICROPROCESSORINTEL  80386  MICROPROCESSOR
INTEL 80386 MICROPROCESSOR
 
Intel+80286
Intel+80286Intel+80286
Intel+80286
 
Memory mgmt 80386
Memory mgmt 80386Memory mgmt 80386
Memory mgmt 80386
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 
8086 memory segmentation
8086 memory segmentation8086 memory segmentation
8086 memory segmentation
 
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
 
8086 modes
8086 modes8086 modes
8086 modes
 
COMPUTER ORGANIZATION NOTES Unit 5
COMPUTER ORGANIZATION NOTES Unit 5COMPUTER ORGANIZATION NOTES Unit 5
COMPUTER ORGANIZATION NOTES Unit 5
 
80386
8038680386
80386
 
Memory Reference instruction
Memory Reference instructionMemory Reference instruction
Memory Reference instruction
 
Pin Description Diagram of Intel 80386 DX Microprocessor
Pin Description Diagram of Intel 80386 DX MicroprocessorPin Description Diagram of Intel 80386 DX Microprocessor
Pin Description Diagram of Intel 80386 DX Microprocessor
 
Addressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu JoyAddressing modes of 8086 - Binu Joy
Addressing modes of 8086 - Binu Joy
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
 
Pentium processor
Pentium processorPentium processor
Pentium processor
 

Similar to PAI Unit 2 Protection in 80386 segmentation

Protection Mechanism.ppt
Protection Mechanism.pptProtection Mechanism.ppt
Protection Mechanism.pptPramodBorole2
 
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 KATARIADheeraj 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 ProgrammingAmogha 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 MicrocontrollersArti Parab Academics
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overviewLinaro
 
UNIT-V (PIC16F877-Microcontrollers).pdf
UNIT-V (PIC16F877-Microcontrollers).pdfUNIT-V (PIC16F877-Microcontrollers).pdf
UNIT-V (PIC16F877-Microcontrollers).pdfdhiyasrinivasan112
 
32- bit Microprocessor-Indtel 80386.pptx
32- bit Microprocessor-Indtel 80386.pptx32- bit Microprocessor-Indtel 80386.pptx
32- bit Microprocessor-Indtel 80386.pptxYuvraj994432
 
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 segmentationKanchanPatil34
 
Arm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_modelArm cm3 architecture_and_programmer_model
Arm cm3 architecture_and_programmer_modelGanesh 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_fa16John Todora
 
24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdf24-02-18 Rejender pratap.pdf
24-02-18 Rejender pratap.pdfFrangoCamila
 
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 MarriageSurendra Kancherla
 
chapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptxchapter-4-microprocessor-interfacing.pptx
chapter-4-microprocessor-interfacing.pptxJaypeeFajanil
 
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 ApplicationsIJERA 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 328PIRJET Journal
 
P3APS19001EN IEC 61850_Configuration_Instructions.pdf
P3APS19001EN IEC 61850_Configuration_Instructions.pdfP3APS19001EN IEC 61850_Configuration_Instructions.pdf
P3APS19001EN IEC 61850_Configuration_Instructions.pdfdongaduythuat123
 

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

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
 
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
 
Introduction to 80386
Introduction to 80386Introduction to 80386
Introduction to 80386
 
P3APS19001EN IEC 61850_Configuration_Instructions.pdf
P3APS19001EN IEC 61850_Configuration_Instructions.pdfP3APS19001EN IEC 61850_Configuration_Instructions.pdf
P3APS19001EN IEC 61850_Configuration_Instructions.pdf
 

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.pdfKanchanPatil34
 
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.pdfKanchanPatil34
 
Unit 1_SLL and DLL.pdf
Unit 1_SLL and DLL.pdfUnit 1_SLL and DLL.pdf
Unit 1_SLL and DLL.pdfKanchanPatil34
 
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.pdfKanchanPatil34
 
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 1KanchanPatil34
 
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 2KanchanPatil34
 
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 3KanchanPatil34
 
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 2KanchanPatil34
 
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 1KanchanPatil34
 
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 8051KanchanPatil34
 
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 2KanchanPatil34
 
Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1KanchanPatil34
 
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 idtKanchanPatil34
 
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 80386KanchanPatil34
 
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 callsKanchanPatil34
 
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 counterKanchanPatil34
 
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 registerKanchanPatil34
 

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

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

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