1 / 17

Protected Mode

Protected Mode. Protected Mode (1 of 2). 4 GB addressable RAM (00000000 to FFFFFFFFh) Each program assigned a memory partition which is protected from other programs Designed for multitasking Supported by Linux & MS-Windows. Protected Mode.

jerzy
Download Presentation

Protected Mode

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Protected Mode

  2. Protected Mode (1 of 2) • 4 GB addressable RAM • (00000000 to FFFFFFFFh) • Each program assigned a memory partition which is protected from other programs • Designed for multitasking • Supported by Linux & MS-Windows

  3. Protected Mode • memory segmentation is defined by a set of tables (descriptor tables) and the segment registers contain pointers into these tables. Each table entry is 8-bytes wide. • Global Descriptor Table (GDT), all applications can access • Local Descriptor Table (LDT), specific to a task or program. • Segment registers don't form part of the physical address in protected mode, but instead are used as pointers to table entries in the GDT or LDT

  4. Protected mode (2 of 2) • Segment descriptor tables • Program structure • code, data, and stack areas • CS, DS, SS segment descriptors • global descriptor table (GDT) • MASM Programs use the Microsoft flat memory model

  5. Memory Management • Protected Mode (flat model) • Allows the microprocessor to address up to 4G byte of memory space http://www.intel.com/design/pentium4/manuals/index_new.htm#1 • Selector, located in segment register, selects one of 8192 descriptors from one of two tables of descriptors

  6. Memory Management • Protected Mode (flat model) • Descriptor, describes the location, length, and access rights of the segment of memory • Global descriptor table (GDT) • Local descriptor table (LDT)

  7. Memory Management • Protected Mode (flat model) • Base address – indicates the starting location of the memory segment • 24-bit for the 80286 – segments begin at any location in its 16M bytes of memory • 32-bit for the 80386 and above - segments begin at any location in its 4G bytes of memory • Segment limit – contains the last offset address found in segment • Granularity bit (for 80386 and above)---- G=0, the limit specifies a segment limit of 00000H to FFFFFH; G=1, the value of limit is multiplied by 4K bytes (00000XXXH to FFFFFXXXH)

  8. Memory Management • Protected Mode (flat model) • AV bit – used by operating systems • AV=1, segment is available • AV=0, segment is not available • D bit – indicate how the instructions access register and memory data in protected mode • D=0, instructions are 16-bit instructions, with 16-bit offsets and 16-bit registers. Compatible with 8086 ~ 80286 • D=1, 32-bit is assumed

  9. Memory Management • Protected Mode (flat model) • The Access Right

  10. Which memory locations will be used as the data segment?

  11. Flat Segment Model • Single global descriptor table (GDT). • All segments mapped to entire 32-bit address space

  12. Multi-Segment Model • Each program has a local descriptor table (LDT) • holds descriptor for each segment used by the program

  13. Paging • Supported directly by the CPU • Divides each segment into 4096-byte blocks called pages • Sum of all programs can be larger than physical memory • Part of running program is in memory, part is on disk • Virtual memory manager (VMM) – OS utility that manages the loading and unloading of pages • Page fault – issued by CPU when a page must be loaded from disk

  14. Texteditor Assembler Linker Assembling, Linking and Running Source file (.asm) Object file (.obj) Listing file (.lst) ML Link library (.lib) Executable program(.exe) Map file (.map) Dos Loader Output

  15. Assembling, Linking and Running • Assembling • Two staged process: • Assemble: Converts assembly language into machine language. Uses source file, outputs object file and optionally the list file • Link: Connects (links) the different .obj and library files together to create the executable file. Uses the object file(s) and optionally a library. Outputs executable file and optionally map file • Both done with ML command

  16. MASM Installation • Insert CD in CD-Rom • Go to Desktop, select My Computer • Select CD-ROM directory • Double click “index.html” • On the new screen, follow the links, install MASM615 • Install TextPad Editor and follow the link to install appropriate Tool Menu Command for 32-bit MASM Program (See the following link for details: http://www.nuvisionmiami.com/books/asm/ide/textpad4/index.html#AddTools)

  17. MASM Installation • Corrections for the installation of Tool Commands in TextPad Should be $BaseName.exe • “Run MASM Prog” Command

More Related