2
Most read
3
Most read
4
Most read
06/02/20 1
Paging
Subject : Processor Architecture & Interfacing
Class : SEIT
Prepared By,
Ms. K. D. Patil, AP
Department of IT, Sanjivani COE, Kopargaon.
06/02/20 2
Paging Introduction
● Memory Management is the challenge for multitasking. To combat this
difficulty. 80386 has a method for managing memory called as Paging.
● The use of paging feature is optional & it is not available with real mode
operation of 80386.
● Paging is required if you want to run multiple 8086 Tasks on single
80386.
● Paging is beneficial in a multi-user system, in an open architecture,
bus structured system.
● The paging MMU works beneath the segmentation MMU & it
augments rather than replaces segmentation mechanism.
● When paging is disabled, the 4 Gb physical address space is organized
into segments that can be of any size from 1 byte to 4 Gb.
06/02/20 3
Paging Introduction
● However, when paging is enabled
the paging unit arranges the 4 Gb
physical address space into
1048496 (1 M) pages that are
each 4096 bytes (4 Kb) long as
shown in the figure
● The fixed size blocks of paged
memory are disadvantageous as
4 K addresses are allocated even
though not all of them are used.
This creation of unused sections
of memory is called fragmentation,
which results in less efficient use
of memory.
06/02/20 4
Support Registers
● Various control registers used in paging are – CR0, CR2 & CR3.
● In CR0, the MSB (bit 31) i.e. PG is used to control the paging
operation. If the PG bit is set, it enables the paging operation
(paging MMU) otherwise paging is disabled.
● CR2 is a read only register. During the page translation
mechanism if the page fault occurs then 80386 saves the address
at which the page fault occurred into CR2 register. This
address is known as page fault linear address.
● CR3 (most significant 20 bits) is also known as page directory base
register (PDBR) & holds 20-bit page directory base address which
points to the start of page directory which is 4KB aligned.
06/02/20 5
PDE Descriptor
06/02/20 6
PDE Descriptor
● Page table address: The most significant 20 bits of PDE point to the base of a
page table. It is a physical address. The least significant 12 bits of this address
are all 0s.
● User: Bits 9, 10 & 11 are not used by 80386. Programmer can use them as
they wish. User may uses these bits for demand paging.
● Accessed: 80386 automatically sets the bit 5 (A) whenever this PDE is used
in address translation. It is never cleared unless you write code for it.
● User/Supervisor: Bit 2 is U/S protection bit. If this bit is set the memory
pages that this PDE covers are accessible from all privilege levels. If it is
cleared the pages are accessible only by PL 0, 1 & 2 (supervisor) code.
● Present: Bit 0 is P bit. If this bit is set the page table pointed by this PDE is
present in physical memory
06/02/20 7
PDE Descriptor
● Read/Write: Bit 1 is R/W protection bit. If U/S bit is clear this bit has
no effect. If U/S bit is set, this bit determines whether the pages
covered by this PDE are write protected or not.
If R/W = 1 write operation is allowed.
If R/W = 0 Read and code fetch is allowed.
● If P bit is clear, the page table is not present in physical memory & the
rest of this PDE is available for use by programmer. The format of not
present page descriptor is as shown in earlier figure.
06/02/20 8
PTE Descriptor
06/02/20 9
PTE Descriptor
● Page table is an array of 1024 descriptor but PTE brings you one step
closer to the real memory.
● Page frame address: The most significant 20 bits of PTE point to the
base of a page frame or simply page. It is a physical address. The least
significant 12 bits of this address are all 0s.
● User: Bits 9, 10 & 11 are not used by 80386. Programmer can use
them as he/she wish.
● Accessed: 80386 automatically sets the bit 5 (A) whenever this PTE is
used in address translation.
● User/Supervisor: Bit 2 is U/S protection bit. If this bit is set the memory
page that this PTE covers is accessible from all privilege levels. If it is
cleared the page is accessible only by PL 0, 1 & 2 (supervisor) code.
06/02/20 10
PTE Descriptor
● Read/Write: Bit 1 is R/W protection bit. If U/S bit is clear this bit has
no effect. If U/S bit is set, this bit determines whether the page
covered by this PTE is write protected or not. If R/W = 1 write
operation is allowed otherwise not.
● Present: Bit 0 is P bit. If this bit is set the page pointed by this PTE is
present in physical memory otherwise not.
● Dirty: Bit 6 is D bit. It is automatically set by 80386 whenever the
page frame which this PTE covers is written into. Processor never
clears this bit. By periodically Testing and clearing this bit, you can
find out what pages of memory are being written to most.
06/02/20 11
3 Major Capabilities of Paging
Hardware
● Address Translation
- Page Translation converts 32 bit linear address To 32 bit physical
address transparently to add one more indirection to suit your
particular needs.
● Page level Protection
- This feature can only be used to make access more restrictive. They
cannot loosen permissions already denied by the segmentation.
● Demand Paging ( Virtual Memory )
- Used for virtual memory management. Virtual means being in effect
but not in fact. Creates illusion of infinite memory by using primary
memory as cache between processor & secondary memory – Based
on principle of locality
06/02/20 12
Address Translation
● Address Translation
● The segmentation & paging mechanism convert 48 bit logical addresses into
32 bit physical addresses required by the hardware.
● The block diagram of address translation is shown in the next figure.
● At first, the segment translation is performed on the logical address. Then if
paging is disabled, the linear address produced is equal to the physical address.
● However, if the paging is enabled, the linear address goes through a second
translation process, known as page translation, to produce the physical address.
It is this physical address that will finally be driven onto the address bus to the
outside world.
● Paging implementation is at the top of segmentation.
06/02/20 13
06/02/20 14
Linear to Physical Address
Translation : Linear Address Format
● As shown in figure, the linear address
produced by the segment translation is not
used as physical address, as it undergoes a
second translation called the page
translation.
● It has 3 fields: 12 bit offset field, 10 bit
page field & 10 bit directory field.
● Directory field is used to select one of the
1024 PDEs from the page Directory.
● Page field is used to select one of the
1024 PTEs to which the PDE is pointing.
● Offset field selects one of the 4096 bytes
of the memory from the page frame to
which PTE is pointing.
06/02/20 15
06/02/20 16
Linear to Physical address
Translation
● The diagram, shows how a linear address is translated into its equivalent
physical address.
● The address in the page directory base register (PDBR) in CR3 locates the
page directory table in memory. This address is 32 bits long. The upper 20
bits are from the CR3 & the lower 12 bits are assumed to be 000 H at the
beginning of the directory & range to FFF H at its end.
● Therefore, the page directory is of size 4 K. It consists of 1024, addresses
each of size 32 bit. These addresses each point to a separate page table.
● The 10 bit directory field of the linear address is the offset from the start of
the page directory table & selects one of 1024 entries.
● This pointer (32 bit address) of the desired page table is cached into
translation look- aside buffer (TLB).
06/02/20 17
Linear to Physical address
Translation
● This value is used as the base address of a page table in memory.
● Each page table is also 4 Kb long & contain 1024, 32 bit addresses. These
addresses are called page frame addresses. Each page frame address points to
a 4 K frame of data storage locations in physical memory.
● The 10 bit page field, of the linear address selects one of the 1024, 32 bit page
table entries & is cached into TLB.
● This frame of memory locations is used for storage of data. The 12 bit offset
part of the linear address identifies the location of the operand in the active
page frame.
● The TLB is capable of maintaining 32 sets of table entries. So 128 Kb of
paged memory is always directly accessible. Operands in this part of memory
can be accessed without first reading new entries from the page table.
06/02/20 18
Page Level Protection
● The least significant 3 bits (i.e. P bit, U/S bit & R/W bit) of the PDE & PTE
are used in page level protection.
● P Bit
- If P bit of PDE is cleared & 80386 tries to use this PDE, it will generate a
page fault (exception 14). The paging function will be aborted, no memory
will be accessed, & control will be transferred to page fault handler.
- Thus, if P bit is not set, 80386 will never be able to access any of the 1024
PTEs of the page table to which this PDE points.
- When there are holes in the linear address space & user intentionally
wants to omit that portion of memory, it is recommended to clear the P bit.
- The use of P bit in PTE is very similar to that of P bit in PDE but on a
smaller scale.
06/02/20 19
Page Level Protection
● U/S Bit
- If U/S bit of PDE is cleared the 4 Mb physical space pointed by this
PDE is accessible only to programs running at the supervisor level.
- Thus, one can deny access of the physical space even if the
segmentation mechanism & segment level privilege protection allows
it.
- The use of U/S bit in PTE is very similar to that of U/S bit in PDE but
on a smaller scale. (4 kB memory space.)
- If U/S bits in PDE or PTE cause a privilege violation the processor
will generate a page fault (exception 14). The paging function will be
aborted, no memory will be accessed, & control will be transferred to
page fault handler..
06/02/20 20
Page Level Protection
● R/W Bit
- Bit 1 of PDE or PTE sets read/ write permission for a 4 MB block
or 4 KB page frame respectively.
- This bit has an effect only if U/S = 1 i.e. read write permission does
not apply to supervisor level programs.
- In a PDE, if U/S =1 & R/W =1 all privilege levels can freely read &
write into the physical space pointed by PDE. If R/W = 0, write
permission is not allowed to PL 3 code.
- If a program attempts to write in such area, it will generate a page
fault (exception 14). The paging function will be aborted, no memory
will be accessed, & control will be transferred to page fault handler.
06/02/20 21
References
● James Turley, “Advanced 80386 programming
Techniques”, Tata McGraw Hill Edition

More Related Content

PPTX
Interrupts on 8086 microprocessor by vijay kumar.k
PPTX
3.programmable interrupt controller 8259
PPT
80486 microprocessor
PPTX
8051 Microcontroller
PDF
8086 memory segmentation
PPT
PPTX
Architecture of 80286 microprocessor
PPT
8086 pin details
Interrupts on 8086 microprocessor by vijay kumar.k
3.programmable interrupt controller 8259
80486 microprocessor
8051 Microcontroller
8086 memory segmentation
Architecture of 80286 microprocessor
8086 pin details

What's hot (20)

PPT
Addressing modes of 8051
PPTX
4.programmable dma controller 8257
PPTX
8237 dma controller
PPT
Memory & I/O interfacing
PPT
8251 communication interface
PPTX
Timer counter in arm7(lpc2148)
PPTX
8259 Operating Modes.pptx
DOCX
8085 interfacing with memory chips
PPTX
80386 & 80486
PPTX
HDLC(High level Data Link Control)
PPTX
8086 Microprocessor
PPTX
INTEL 80386 MICROPROCESSOR
PDF
Special of 80386 registers
PPTX
Presentation on 8086 microprocessor
PPTX
Unit 4 - Network Layer
DOCX
Control Units : Microprogrammed and Hardwired:control unit
PPT
Basic operational concepts.ppt
PPTX
Microprocessor Fundamentals
PPT
8251 usart programmable communication interface by aniket bhute
PPTX
8255 PPI
Addressing modes of 8051
4.programmable dma controller 8257
8237 dma controller
Memory & I/O interfacing
8251 communication interface
Timer counter in arm7(lpc2148)
8259 Operating Modes.pptx
8085 interfacing with memory chips
80386 & 80486
HDLC(High level Data Link Control)
8086 Microprocessor
INTEL 80386 MICROPROCESSOR
Special of 80386 registers
Presentation on 8086 microprocessor
Unit 4 - Network Layer
Control Units : Microprogrammed and Hardwired:control unit
Basic operational concepts.ppt
Microprocessor Fundamentals
8251 usart programmable communication interface by aniket bhute
8255 PPI
Ad

Similar to PAI Unit 3 Paging in 80386 Microporcessor (20)

ODP
Unix Memory Management - Operating Systems
PPTX
UNIT-3.pptx digital electronics system 34
PDF
PAI Unit 2 Segmentation in 80386 microprocessor
PDF
Microprocessor Unit-1( Introduction to 80386 Microprocessors)Second Year ppt
PDF
80386 Basic Programming Model and Application
PPT
Address translation-mechanism-of-80386 by aniket bhute
PDF
Cs14 406 80386-mod1
PPT
Csc4320 chapter 8 2
PPT
Deco_Module 4.5_Virtual Memory.pptg kghgohg
PPT
PAGING MECHANISM Pentium.ppt
PPT
address-translation-mechanism-of-80386 (1).ppt
PPTX
jdsbfvkjsdbfvbasibgvyisbvilawbvslaksbvlawbvrab
PDF
CSN221_Lec_27 Computer Architecture and Microprocessor
PPTX
Intel 8086-8088 Microprocessor & Assembly Language.pptx
PPTX
The Role of Memory Locations in Program ExecutionMemory Location.pptx
PPTX
Microprocessor Unit -1 SE computer-II.pptx
PPTX
Presentataion
PPTX
Paging and Segmentation in Operating System
PPT
ADVANCED MICROPROCESSORS featuers, block diagram and register organization.ppt
PPTX
Memory Segmentation of 8086
Unix Memory Management - Operating Systems
UNIT-3.pptx digital electronics system 34
PAI Unit 2 Segmentation in 80386 microprocessor
Microprocessor Unit-1( Introduction to 80386 Microprocessors)Second Year ppt
80386 Basic Programming Model and Application
Address translation-mechanism-of-80386 by aniket bhute
Cs14 406 80386-mod1
Csc4320 chapter 8 2
Deco_Module 4.5_Virtual Memory.pptg kghgohg
PAGING MECHANISM Pentium.ppt
address-translation-mechanism-of-80386 (1).ppt
jdsbfvkjsdbfvbasibgvyisbvilawbvslaksbvlawbvrab
CSN221_Lec_27 Computer Architecture and Microprocessor
Intel 8086-8088 Microprocessor & Assembly Language.pptx
The Role of Memory Locations in Program ExecutionMemory Location.pptx
Microprocessor Unit -1 SE computer-II.pptx
Presentataion
Paging and Segmentation in Operating System
ADVANCED MICROPROCESSORS featuers, block diagram and register organization.ppt
Memory Segmentation of 8086
Ad

More from KanchanPatil34 (20)

PDF
Unit 3_Classification_Decision Tree_ASM.pdf
PDF
Unit 2_Logistic Regression_Types_Regularization.pdf
PDF
Unit 2_Linear Regression_Evaluation Metrics.pdf
PDF
Unit 1_Data Validation_Validation Techniques.pdf
PDF
Unit 1_Concet of Feature-Feature Selection Methods.pdf
PDF
Unit 1_Introduction to ML_Types_Applications.pdf
PDF
Unit 6_Cyber Laws Indian Act_Digital Signature.pdf
PDF
Unit 6_DoS and DDoS_SQL Injection_tools.pdf
PDF
Unit 6_keylogger_Spywares_virus_worms.pdf
PDF
Unit 6_Introduction_Phishing_Password Cracking.pdf
PDF
Unit 5_Social Engineering and Cyberstalking.pdf
PDF
Unit 5_Classification of Cyber Crimes.pdf
PDF
Unit 5_Introduction to Cyber Security.pdf
PDF
Unit 4_SSL_Handshake Protocol_Record Layer Protocol.pdf
PDF
Unit 4_IPSec_AH_ESP_IKE_SA_Tunnel_Transport.pdf
PDF
Unit 3_Private Key Management_Protection.pdf
PDF
Unit 3_Kerberos Protocol_Working_Version.pdf
PDF
Unit 3_Digital Certificate_Intro_Types.pdf
PDF
Unit 3_Digital Signature Model Details.pdf
PDF
Unit 3_Hash function and MD5 working.pdf
Unit 3_Classification_Decision Tree_ASM.pdf
Unit 2_Logistic Regression_Types_Regularization.pdf
Unit 2_Linear Regression_Evaluation Metrics.pdf
Unit 1_Data Validation_Validation Techniques.pdf
Unit 1_Concet of Feature-Feature Selection Methods.pdf
Unit 1_Introduction to ML_Types_Applications.pdf
Unit 6_Cyber Laws Indian Act_Digital Signature.pdf
Unit 6_DoS and DDoS_SQL Injection_tools.pdf
Unit 6_keylogger_Spywares_virus_worms.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 5_Social Engineering and Cyberstalking.pdf
Unit 5_Classification of Cyber Crimes.pdf
Unit 5_Introduction to Cyber Security.pdf
Unit 4_SSL_Handshake Protocol_Record Layer Protocol.pdf
Unit 4_IPSec_AH_ESP_IKE_SA_Tunnel_Transport.pdf
Unit 3_Private Key Management_Protection.pdf
Unit 3_Kerberos Protocol_Working_Version.pdf
Unit 3_Digital Certificate_Intro_Types.pdf
Unit 3_Digital Signature Model Details.pdf
Unit 3_Hash function and MD5 working.pdf

Recently uploaded (20)

PPTX
MMW-CHAPTER-1-final.pptx major Elementary Education
PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
PPTX
Neurological complocations of systemic disease
PDF
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
DOCX
THEORY AND PRACTICE ASSIGNMENT SEMESTER MAY 2025.docx
PPTX
4. Diagnosis and treatment planning in RPD.pptx
PDF
Disorder of Endocrine system (1).pdfyyhyyyy
PPTX
CHROMIUM & Glucose Tolerance Factor.pptx
PPTX
operating_systems_presentations_delhi_nc
PPT
hsl powerpoint resource goyloveh feb 07.ppt
DOCX
EDUCATIONAL ASSESSMENT ASSIGNMENT SEMESTER MAY 2025.docx
PPTX
Theoretical for class.pptxgshdhddhdhdhgd
PPTX
IT infrastructure and emerging technologies
PDF
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
PDF
anganwadi services for the b.sc nursing and GNM
PDF
Laparoscopic Imaging Systems at World Laparoscopy Hospital
PDF
Diabetes Mellitus , types , clinical picture, investigation and managment
PPTX
Neurology of Systemic disease all systems
PDF
faiz-khans about Radiotherapy Physics-02.pdf
MMW-CHAPTER-1-final.pptx major Elementary Education
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
Neurological complocations of systemic disease
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
THEORY AND PRACTICE ASSIGNMENT SEMESTER MAY 2025.docx
4. Diagnosis and treatment planning in RPD.pptx
Disorder of Endocrine system (1).pdfyyhyyyy
CHROMIUM & Glucose Tolerance Factor.pptx
operating_systems_presentations_delhi_nc
hsl powerpoint resource goyloveh feb 07.ppt
EDUCATIONAL ASSESSMENT ASSIGNMENT SEMESTER MAY 2025.docx
Theoretical for class.pptxgshdhddhdhdhgd
IT infrastructure and emerging technologies
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
anganwadi services for the b.sc nursing and GNM
Laparoscopic Imaging Systems at World Laparoscopy Hospital
Diabetes Mellitus , types , clinical picture, investigation and managment
Neurology of Systemic disease all systems
faiz-khans about Radiotherapy Physics-02.pdf

PAI Unit 3 Paging in 80386 Microporcessor

  • 1. 06/02/20 1 Paging Subject : Processor Architecture & Interfacing Class : SEIT Prepared By, Ms. K. D. Patil, AP Department of IT, Sanjivani COE, Kopargaon.
  • 2. 06/02/20 2 Paging Introduction ● Memory Management is the challenge for multitasking. To combat this difficulty. 80386 has a method for managing memory called as Paging. ● The use of paging feature is optional & it is not available with real mode operation of 80386. ● Paging is required if you want to run multiple 8086 Tasks on single 80386. ● Paging is beneficial in a multi-user system, in an open architecture, bus structured system. ● The paging MMU works beneath the segmentation MMU & it augments rather than replaces segmentation mechanism. ● When paging is disabled, the 4 Gb physical address space is organized into segments that can be of any size from 1 byte to 4 Gb.
  • 3. 06/02/20 3 Paging Introduction ● However, when paging is enabled the paging unit arranges the 4 Gb physical address space into 1048496 (1 M) pages that are each 4096 bytes (4 Kb) long as shown in the figure ● The fixed size blocks of paged memory are disadvantageous as 4 K addresses are allocated even though not all of them are used. This creation of unused sections of memory is called fragmentation, which results in less efficient use of memory.
  • 4. 06/02/20 4 Support Registers ● Various control registers used in paging are – CR0, CR2 & CR3. ● In CR0, the MSB (bit 31) i.e. PG is used to control the paging operation. If the PG bit is set, it enables the paging operation (paging MMU) otherwise paging is disabled. ● CR2 is a read only register. During the page translation mechanism if the page fault occurs then 80386 saves the address at which the page fault occurred into CR2 register. This address is known as page fault linear address. ● CR3 (most significant 20 bits) is also known as page directory base register (PDBR) & holds 20-bit page directory base address which points to the start of page directory which is 4KB aligned.
  • 6. 06/02/20 6 PDE Descriptor ● Page table address: The most significant 20 bits of PDE point to the base of a page table. It is a physical address. The least significant 12 bits of this address are all 0s. ● User: Bits 9, 10 & 11 are not used by 80386. Programmer can use them as they wish. User may uses these bits for demand paging. ● Accessed: 80386 automatically sets the bit 5 (A) whenever this PDE is used in address translation. It is never cleared unless you write code for it. ● User/Supervisor: Bit 2 is U/S protection bit. If this bit is set the memory pages that this PDE covers are accessible from all privilege levels. If it is cleared the pages are accessible only by PL 0, 1 & 2 (supervisor) code. ● Present: Bit 0 is P bit. If this bit is set the page table pointed by this PDE is present in physical memory
  • 7. 06/02/20 7 PDE Descriptor ● Read/Write: Bit 1 is R/W protection bit. If U/S bit is clear this bit has no effect. If U/S bit is set, this bit determines whether the pages covered by this PDE are write protected or not. If R/W = 1 write operation is allowed. If R/W = 0 Read and code fetch is allowed. ● If P bit is clear, the page table is not present in physical memory & the rest of this PDE is available for use by programmer. The format of not present page descriptor is as shown in earlier figure.
  • 9. 06/02/20 9 PTE Descriptor ● Page table is an array of 1024 descriptor but PTE brings you one step closer to the real memory. ● Page frame address: The most significant 20 bits of PTE point to the base of a page frame or simply page. It is a physical address. The least significant 12 bits of this address are all 0s. ● User: Bits 9, 10 & 11 are not used by 80386. Programmer can use them as he/she wish. ● Accessed: 80386 automatically sets the bit 5 (A) whenever this PTE is used in address translation. ● User/Supervisor: Bit 2 is U/S protection bit. If this bit is set the memory page that this PTE covers is accessible from all privilege levels. If it is cleared the page is accessible only by PL 0, 1 & 2 (supervisor) code.
  • 10. 06/02/20 10 PTE Descriptor ● Read/Write: Bit 1 is R/W protection bit. If U/S bit is clear this bit has no effect. If U/S bit is set, this bit determines whether the page covered by this PTE is write protected or not. If R/W = 1 write operation is allowed otherwise not. ● Present: Bit 0 is P bit. If this bit is set the page pointed by this PTE is present in physical memory otherwise not. ● Dirty: Bit 6 is D bit. It is automatically set by 80386 whenever the page frame which this PTE covers is written into. Processor never clears this bit. By periodically Testing and clearing this bit, you can find out what pages of memory are being written to most.
  • 11. 06/02/20 11 3 Major Capabilities of Paging Hardware ● Address Translation - Page Translation converts 32 bit linear address To 32 bit physical address transparently to add one more indirection to suit your particular needs. ● Page level Protection - This feature can only be used to make access more restrictive. They cannot loosen permissions already denied by the segmentation. ● Demand Paging ( Virtual Memory ) - Used for virtual memory management. Virtual means being in effect but not in fact. Creates illusion of infinite memory by using primary memory as cache between processor & secondary memory – Based on principle of locality
  • 12. 06/02/20 12 Address Translation ● Address Translation ● The segmentation & paging mechanism convert 48 bit logical addresses into 32 bit physical addresses required by the hardware. ● The block diagram of address translation is shown in the next figure. ● At first, the segment translation is performed on the logical address. Then if paging is disabled, the linear address produced is equal to the physical address. ● However, if the paging is enabled, the linear address goes through a second translation process, known as page translation, to produce the physical address. It is this physical address that will finally be driven onto the address bus to the outside world. ● Paging implementation is at the top of segmentation.
  • 14. 06/02/20 14 Linear to Physical Address Translation : Linear Address Format ● As shown in figure, the linear address produced by the segment translation is not used as physical address, as it undergoes a second translation called the page translation. ● It has 3 fields: 12 bit offset field, 10 bit page field & 10 bit directory field. ● Directory field is used to select one of the 1024 PDEs from the page Directory. ● Page field is used to select one of the 1024 PTEs to which the PDE is pointing. ● Offset field selects one of the 4096 bytes of the memory from the page frame to which PTE is pointing.
  • 16. 06/02/20 16 Linear to Physical address Translation ● The diagram, shows how a linear address is translated into its equivalent physical address. ● The address in the page directory base register (PDBR) in CR3 locates the page directory table in memory. This address is 32 bits long. The upper 20 bits are from the CR3 & the lower 12 bits are assumed to be 000 H at the beginning of the directory & range to FFF H at its end. ● Therefore, the page directory is of size 4 K. It consists of 1024, addresses each of size 32 bit. These addresses each point to a separate page table. ● The 10 bit directory field of the linear address is the offset from the start of the page directory table & selects one of 1024 entries. ● This pointer (32 bit address) of the desired page table is cached into translation look- aside buffer (TLB).
  • 17. 06/02/20 17 Linear to Physical address Translation ● This value is used as the base address of a page table in memory. ● Each page table is also 4 Kb long & contain 1024, 32 bit addresses. These addresses are called page frame addresses. Each page frame address points to a 4 K frame of data storage locations in physical memory. ● The 10 bit page field, of the linear address selects one of the 1024, 32 bit page table entries & is cached into TLB. ● This frame of memory locations is used for storage of data. The 12 bit offset part of the linear address identifies the location of the operand in the active page frame. ● The TLB is capable of maintaining 32 sets of table entries. So 128 Kb of paged memory is always directly accessible. Operands in this part of memory can be accessed without first reading new entries from the page table.
  • 18. 06/02/20 18 Page Level Protection ● The least significant 3 bits (i.e. P bit, U/S bit & R/W bit) of the PDE & PTE are used in page level protection. ● P Bit - If P bit of PDE is cleared & 80386 tries to use this PDE, it will generate a page fault (exception 14). The paging function will be aborted, no memory will be accessed, & control will be transferred to page fault handler. - Thus, if P bit is not set, 80386 will never be able to access any of the 1024 PTEs of the page table to which this PDE points. - When there are holes in the linear address space & user intentionally wants to omit that portion of memory, it is recommended to clear the P bit. - The use of P bit in PTE is very similar to that of P bit in PDE but on a smaller scale.
  • 19. 06/02/20 19 Page Level Protection ● U/S Bit - If U/S bit of PDE is cleared the 4 Mb physical space pointed by this PDE is accessible only to programs running at the supervisor level. - Thus, one can deny access of the physical space even if the segmentation mechanism & segment level privilege protection allows it. - The use of U/S bit in PTE is very similar to that of U/S bit in PDE but on a smaller scale. (4 kB memory space.) - If U/S bits in PDE or PTE cause a privilege violation the processor will generate a page fault (exception 14). The paging function will be aborted, no memory will be accessed, & control will be transferred to page fault handler..
  • 20. 06/02/20 20 Page Level Protection ● R/W Bit - Bit 1 of PDE or PTE sets read/ write permission for a 4 MB block or 4 KB page frame respectively. - This bit has an effect only if U/S = 1 i.e. read write permission does not apply to supervisor level programs. - In a PDE, if U/S =1 & R/W =1 all privilege levels can freely read & write into the physical space pointed by PDE. If R/W = 0, write permission is not allowed to PL 3 code. - If a program attempts to write in such area, it will generate a page fault (exception 14). The paging function will be aborted, no memory will be accessed, & control will be transferred to page fault handler.
  • 21. 06/02/20 21 References ● James Turley, “Advanced 80386 programming Techniques”, Tata McGraw Hill Edition