Your SlideShare is downloading. ×
0
Memory Segmentation
Segment <ul><li>Different method of defining memory segments as compared to 8086. </li></ul><ul><li>User’s program can not...
Segment …cntd…. <ul><li>Segment definition includes </li></ul><ul><ul><li>Its starting address </li></ul></ul><ul><ul><li>...
Segment <ul><li>Segments are </li></ul><ul><ul><li>Areas of memory </li></ul></ul><ul><ul><li>Defined by the programmer </...
Segment Descriptors <ul><li>A special structure used to describe a segment. </li></ul><ul><li>Exactly one descriptor must ...
A segment Descriptor <ul><li>Describes a segment </li></ul><ul><li>Must be created for every segemnt </li></ul><ul><li>Is ...
Segment Descriptors field Base Address of segment (0-FFFFFFFF) Length  of segment (0-FFFFFFFF) Segment Type Privilege Leve...
Segment Descriptor format
Segment types <ul><li>000=Data, read only  </li></ul><ul><li>001=Data, read/write </li></ul><ul><li>010=Stack, read only <...
Segments can be defined in eight basic types <ul><li>Executable code segments with or without data read permission </li></...
Descriptor Table <ul><li>Group arrangement of descriptors is known as a descriptor table . </li></ul><ul><li>Order is not ...
Descriptors are stored in three tables: <ul><li>Global Descriptor table(GDT) </li></ul><ul><ul><li>Maintains a list of mos...
<ul><li>After u have placed each descriptor in a descriptor table, you need to inform the processor </li></ul><ul><li>U ca...
GDTR,IDTR,LDTR contains <ul><li>Base address of table </li></ul><ul><li>Limit </li></ul>
Segment Selectors <ul><li>Once the descriptors are defined , how does the processor make use of them? </li></ul><ul><li>An...
80386 segment registers <ul><li>80386 has 6 segment registers </li></ul><ul><ul><li>One for current code segment(CS) </li>...
Loading Segment Selectors <ul><li>Any given selector value selects one and only one descriptor </li></ul><ul><li>When load...
GDT GDT 0 GDT 1 GDT 2 GDTR Offset Index 2  1  0 TI RPL
SEGMENTATION Addressing  GDT Prog GDT Main Memory Index 2  1  0 TI RPL GD 0 GD 1 GD 2 GDTR Offset
Addressing  GDT GD 0 GD 1 GD 2 Main Memory Base Address Seg Limit Attrib Index 3  2  1  0 TI RPL GDTR Offset
GD 0 GD 1 GD 2 GDTR Index 2  1  0 TI RPL GDT Base Address Seg Limit Attrib + Offset
Local Descriptor Tables(LDT’s) <ul><li>LDT’s act like extension to GDT </li></ul><ul><li>Are assigned to individual tasks ...
Descriptor LDT Descriptor Descriptor Descriptor Data Descriptor Descriptor GDT LDT GDTR LDTR 1 DS ESI
Local Descriptor table <ul><li>Hold segment descriptors </li></ul><ul><li>May be used in addition to the global descriptor...
Upcoming SlideShare
Loading in...5
×

Memory mgmt 80386

2,019

Published on

Memory Management

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,019
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
140
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Memory mgmt 80386"

  1. 1. Memory Segmentation
  2. 2. Segment <ul><li>Different method of defining memory segments as compared to 8086. </li></ul><ul><li>User’s program can not access any processor's address space merely by asking. </li></ul><ul><li>In 80386, a program can not access an area of memory unless that area has been described to it. </li></ul><ul><li>Segment violation if try to access </li></ul><ul><li>80386 processor does not enforce segment boundaries and alignment, as it did in 8086. </li></ul><ul><li>Systems programmer defines what each segment will be. </li></ul>
  3. 3. Segment …cntd…. <ul><li>Segment definition includes </li></ul><ul><ul><li>Its starting address </li></ul></ul><ul><ul><li>Its length </li></ul></ul><ul><ul><li>Its intended use </li></ul></ul><ul><ul><li>Other attributes </li></ul></ul><ul><li>Segment length is variable form 1 byte to 4 GB. </li></ul><ul><li>Base address defines actual address so sixteen byte alignment is no longer required </li></ul>
  4. 4. Segment <ul><li>Segments are </li></ul><ul><ul><li>Areas of memory </li></ul></ul><ul><ul><li>Defined by the programmer </li></ul></ul><ul><ul><li>Used for different purposes, such as code, data and stack </li></ul></ul><ul><li>Segments are not </li></ul><ul><ul><li>All the same size. </li></ul></ul><ul><ul><li>Necessarily paragraph aligned </li></ul></ul><ul><ul><li>Limited to 64KB </li></ul></ul>
  5. 5. Segment Descriptors <ul><li>A special structure used to describe a segment. </li></ul><ul><li>Exactly one descriptor must be defined for each segment. </li></ul><ul><li>U can define virtually any number of segment descriptors. </li></ul><ul><li>Ability to define segment descriptors carries considerable power and responsibility for system security. </li></ul>
  6. 6. A segment Descriptor <ul><li>Describes a segment </li></ul><ul><li>Must be created for every segemnt </li></ul><ul><li>Is created by the programmer </li></ul><ul><li>Determines a segment’s base address </li></ul><ul><li>Determines a segment’s size </li></ul><ul><li>Determines a segment's use </li></ul><ul><li>Determines a segment’s use </li></ul><ul><li>Determines a segment’s privilege level </li></ul>
  7. 7. Segment Descriptors field Base Address of segment (0-FFFFFFFF) Length of segment (0-FFFFFFFF) Segment Type Privilege Level Miscellaneous
  8. 8. Segment Descriptor format
  9. 9. Segment types <ul><li>000=Data, read only </li></ul><ul><li>001=Data, read/write </li></ul><ul><li>010=Stack, read only </li></ul><ul><li>011=stack read/write </li></ul><ul><li>100=code, execute only </li></ul><ul><li>101=code, execute/read </li></ul><ul><li>110=code, execute only, conforming </li></ul><ul><li>111=code, execute/read, conforming </li></ul>
  10. 10. Segments can be defined in eight basic types <ul><li>Executable code segments with or without data read permission </li></ul><ul><li>Executable code segments with or without privilege protection </li></ul><ul><li>Data segments with or without write permission </li></ul><ul><li>Stack segments with or without write permission </li></ul>
  11. 11. Descriptor Table <ul><li>Group arrangement of descriptors is known as a descriptor table . </li></ul><ul><li>Order is not important. </li></ul><ul><li>Max size of table=64 Kb, so can have only one descriptor or as many as 8192. </li></ul>
  12. 12. Descriptors are stored in three tables: <ul><li>Global Descriptor table(GDT) </li></ul><ul><ul><li>Maintains a list of most segement </li></ul></ul><ul><ul><li>May contains special “System descriptors” </li></ul></ul><ul><li>Interrupt Descriptor Table (IDT) </li></ul><ul><ul><li>Maintains a list of interrupt service routine </li></ul></ul><ul><li>Local Descriptor Table (LDT) </li></ul><ul><ul><li>Is optional </li></ul></ul><ul><ul><li>Extends range of GDT </li></ul></ul><ul><ul><li>Is allocated to each task when multitasking is enabled </li></ul></ul>
  13. 13. <ul><li>After u have placed each descriptor in a descriptor table, you need to inform the processor </li></ul><ul><li>U can place theses tables anywhere in the processor’s address space and u need not keep them together. </li></ul><ul><li>To allow processor to locate the GDT, IDT and current LDT, u load three special purpose registers, GDTR, IDTR,LDTR resply. </li></ul>
  14. 14. GDTR,IDTR,LDTR contains <ul><li>Base address of table </li></ul><ul><li>Limit </li></ul>
  15. 15. Segment Selectors <ul><li>Once the descriptors are defined , how does the processor make use of them? </li></ul><ul><li>Any 16 bit value that u write into a segment register is called a selector, because it selects a segment descriptor from a descriptor table. </li></ul><ul><li>15 2 1 0 </li></ul>INDEX RPL TI
  16. 16. 80386 segment registers <ul><li>80386 has 6 segment registers </li></ul><ul><ul><li>One for current code segment(CS) </li></ul></ul><ul><ul><li>One for current stack segment (SS) </li></ul></ul><ul><ul><li>Four for general data segments (DS, ES,FS,GS) </li></ul></ul><ul><li>Segment registers select segment descriptors: </li></ul><ul><ul><li>Thirteen bits select descriptors </li></ul></ul><ul><ul><li>One bit selects descriptor table </li></ul></ul><ul><ul><li>Two bits privilege checking </li></ul></ul>
  17. 17. Loading Segment Selectors <ul><li>Any given selector value selects one and only one descriptor </li></ul><ul><li>When loading segment selector ,the 80386 check that </li></ul><ul><ul><li>The selector index is within the descriptor table limit </li></ul></ul><ul><ul><li>The selector references the correct descriptor table </li></ul></ul><ul><ul><li>The descriptor is of correct type </li></ul></ul><ul><ul><li>The selector uses the correct privilege level </li></ul></ul>
  18. 18. GDT GDT 0 GDT 1 GDT 2 GDTR Offset Index 2 1 0 TI RPL
  19. 19. SEGMENTATION Addressing GDT Prog GDT Main Memory Index 2 1 0 TI RPL GD 0 GD 1 GD 2 GDTR Offset
  20. 20. Addressing GDT GD 0 GD 1 GD 2 Main Memory Base Address Seg Limit Attrib Index 3 2 1 0 TI RPL GDTR Offset
  21. 21. GD 0 GD 1 GD 2 GDTR Index 2 1 0 TI RPL GDT Base Address Seg Limit Attrib + Offset
  22. 22. Local Descriptor Tables(LDT’s) <ul><li>LDT’s act like extension to GDT </li></ul><ul><li>Are assigned to individual tasks when task switching is done. </li></ul><ul><li>While running, any program can assess descriptors from GDT and LDT </li></ul><ul><li>The way in which the processor locates LDT’s is much different, however. </li></ul>
  23. 23. Descriptor LDT Descriptor Descriptor Descriptor Data Descriptor Descriptor GDT LDT GDTR LDTR 1 DS ESI
  24. 24. Local Descriptor table <ul><li>Hold segment descriptors </li></ul><ul><li>May be used in addition to the global descriptor table </li></ul><ul><li>Are defined by special “system descriptor” in GDT. </li></ul><ul><li>May be larger or smaller than GDT. </li></ul><ul><li>May not be define other LDTs </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×