MPL Assignment-7 Protected Mode
MPL Assignment-7 Protected Mode
MPL Assignment-7 Protected Mode
ASSIGNMENT NO: 7
TITLE: Write X86/64 ALP to switch from real mode to protected mode and display the
values of GDTR, LDTR, IDTR, TR and MSW Registers.
OBJECTIVES:
1. To be familiar with the format of assembly language program structure and
instructions.
2. To study GDTR, LDTR and IDTR.
PROBLEM DEFINITION:
Write X86/64 ALP to switch from real mode to protected mode and display the values of
GDTR, LDTR, IDTR, TR and MSW Registers.
THEORY:
Four registers of the 80386 locate the data structures that control segmented memory
management called as memory management registers:
These registers point to the segment descriptor tables GDT. Before any segment register
is changed in protected mode, the GDT register must point to a valid GDT. Initialization
of the GDT and GDTR may be done in real-address mode. The GDT (as well as LDTs)
should reside in RAM, because the processor modifies the accessed bit of descriptors.
The instructions LGDT and SGDT give access to the GDTR.
These registers point to the segment descriptor tables LDT. The LLDT instruction loads
a linear base address and limit value from a six-byte data operand in memory into the
LDTR. The SLDT instruction always stores all 48 bits of the six-byte data operand.
This register points to a table of entry points for interrupt handlers (the IDT). The LIDT
instruction loads a linear base address and limit value from a six-byte data operand in
memory into the IDTR. The SIDT instruction always stores all 48 bits of the six-byte
data operand.
This register points to the information needed by the processor to define the current task.
These registers store the base addresses of the descriptor tables (A descriptor table is
simply a memory array of 8-byte entries that contain Descriptors and the descriptor
stores all the information about segments) in the linear address space and store the
segment limits.
Description: SLDT stores the Local Descriptor Table Register (LDTR) in the two-byte register
or memory location indicated by the effective address operand. This register is a selector that
points into the Global Descriptor Table. SLDT is used only in operating system software. It is
not used in application programs.
Description: SGDT copies the contents of the descriptor table register the six bytes of memory
indicated by the operand. The LIMIT field of the register is assigned to the first word at the
effective address. If the operand-size attribute is 32 bits, the next three bytes are assigned the
BASE field of the register, and the fourth byte is written with zero. The last byte is undefined.
Otherwise, if the operand-size attribute is 16 bits, the next 4 bytes are assigned the 32-bit BASE
field of the register. SGDT and SIDT are used only in operating system software; they are not
used in application programs.
Description: SIDT copies the contents of the descriptor table register the six bytes of memory
indicated by the operand. The LIMIT field of the register is assigned to the first word at the
effective address. If the operand-size attribute is 32 bits, the next three bytes are assigned the
BASE field of the register, and the fourth byte is written with zero. The last byte is undefined.
Otherwise, if the operand-size attribute is 16 bits, the next 4 bytes are assigned the 32-bit BASE
field of the register. SGDT and SIDT are used only in operating system software; they are not
used in application programs.
ALGORITHM:
FLOWCHART:
JSCOE 210257: Microprocessor Laboratory 2019
CONCLUSION:
In this way, we use GDTR, LDTR and IDTR in Real mode.
JSCOE 210257: Microprocessor Laboratory 2019
QUESTIONS: