| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <meta charset="UTF-8"> |
| <link href="style.css" type="text/css" rel="stylesheet"> |
| <title>LLDT—Load Local Descriptor Table Register </title></head> |
| <body> |
| <h1>LLDT—Load Local Descriptor Table Register</h1> |
| <table> |
| <tr> |
| <th>Opcode</th> |
| <th>Instruction</th> |
| <th>Op/En</th> |
| <th>64-Bit Mode</th> |
| <th>Compat/Leg Mode</th> |
| <th>Description</th></tr> |
| <tr> |
| <td>0F 00 /2</td> |
| <td>LLDT <em>r/m</em>16</td> |
| <td>M</td> |
| <td>Valid</td> |
| <td>Valid</td> |
| <td>Load segment selector <em>r/m</em>16 into LDTR.</td></tr></table> |
| <h3>Instruction Operand Encoding</h3> |
| <table> |
| <tr> |
| <td>Op/En</td> |
| <td>Operand 1</td> |
| <td>Operand 2</td> |
| <td>Operand 3</td> |
| <td>Operand 4</td></tr> |
| <tr> |
| <td>M</td> |
| <td>ModRM:r/m (r)</td> |
| <td>NA</td> |
| <td>NA</td> |
| <td>NA</td></tr></table> |
| <h2>Description</h2> |
| <p>Loads the source operand into the segment selector field of the local descriptor table register (LDTR). The source operand (a general-purpose register or a memory location) contains a segment selector that points to a local descriptor table (LDT). After the segment selector is loaded in the LDTR, the processor uses the segment selector to locate the segment descriptor for the LDT in the global descriptor table (GDT). It then loads the segment limit and base address for the LDT from the segment descriptor into the LDTR. The segment registers DS, ES, SS, FS, GS, and CS are not affected by this instruction, nor is the LDTR field in the task state segment (TSS) for the current task.</p> |
| <p>If bits 2-15 of the source operand are 0, LDTR is marked invalid and the LLDT instruction completes silently. However, all subsequent references to descriptors in the LDT (except by the LAR, VERR, VERW or LSL instructions) cause a general protection exception (#GP).</p> |
| <p>The operand-size attribute has no effect on this instruction.</p> |
| <p>The LLDT instruction is provided for use in operating-system software; it should not be used in application programs. This instruction can only be executed in protected mode or 64-bit mode.</p> |
| <p>In 64-bit mode, the operand size is fixed at 16 bits.</p> |
| <h2>Operation</h2> |
| <pre>IF SRC(Offset) > descriptor table limit |
| THEN #GP(segment selector); FI; |
| IF segment selector is valid |
| Read segment descriptor; |
| IF SegmentDescriptor(Type) ≠ LDT |
| THEN #GP(segment selector); FI; |
| IF segment descriptor is not present |
| THEN #NP(segment selector); FI; |
| LDTR(SegmentSelector) ← SRC; |
| LDTR(SegmentDescriptor) ← GDTSegmentDescriptor; |
| ELSE LDTR ← INVALID |
| FI;</pre> |
| <h2>Flags Affected</h2> |
| <p>None.</p> |
| <h2>Protected Mode Exceptions</h2> |
| <table class="exception-table"> |
| <tr> |
| <td>#GP(0)</td> |
| <td> |
| <p>If the current privilege level is not 0.</p> |
| <p>If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit.</p> |
| <p>If the DS, ES, FS, or GS register contains a NULL segment selector.</p></td></tr> |
| <tr> |
| <td>#GP(selector)</td> |
| <td> |
| <p>If the selector operand does not point into the Global Descriptor Table or if the entry in the GDT is not a Local Descriptor Table.</p> |
| <p>Segment selector is beyond GDT limit.</p></td></tr> |
| <tr> |
| <td>#SS(0)</td> |
| <td>If a memory operand effective address is outside the SS segment limit.</td></tr> |
| <tr> |
| <td>#NP(selector)</td> |
| <td>If the LDT descriptor is not present.</td></tr> |
| <tr> |
| <td>#PF(fault-code)</td> |
| <td>If a page fault occurs.</td></tr> |
| <tr> |
| <td>#UD</td> |
| <td>If the LOCK prefix is used.</td></tr></table> |
| <h2>Real-Address Mode Exceptions</h2> |
| <table class="exception-table"> |
| <tr> |
| <td>#UD</td> |
| <td>The LLDT instruction is not recognized in real-address mode.</td></tr></table> |
| <h2>Virtual-8086 Mode Exceptions</h2> |
| <table class="exception-table"> |
| <tr> |
| <td>#UD</td> |
| <td>The LLDT instruction is not recognized in virtual-8086 mode.</td></tr></table> |
| <h2>Compatibility Mode Exceptions</h2> |
| <p>Same exceptions as in protected mode.</p> |
| <h2>64-Bit Mode Exceptions</h2> |
| <table class="exception-table"> |
| <tr> |
| <td>#SS(0)</td> |
| <td>If a memory address referencing the SS segment is in a non-canonical form.</td></tr> |
| <tr> |
| <td>#GP(0)</td> |
| <td> |
| <p>If the current privilege level is not 0.</p> |
| <p>If the memory address is in a non-canonical form.</p></td></tr> |
| <tr> |
| <td>#GP(selector)</td> |
| <td> |
| <p>If the selector operand does not point into the Global Descriptor Table or if the entry in the GDT is not a Local Descriptor Table.</p> |
| <p>Segment selector is beyond GDT limit.</p></td></tr> |
| <tr> |
| <td>#NP(selector)</td> |
| <td>If the LDT descriptor is not present.</td></tr> |
| <tr> |
| <td>#PF(fault-code)</td> |
| <td>If a page fault occurs.</td></tr> |
| <tr> |
| <td>#UD</td> |
| <td>If the LOCK prefix is used.</td></tr></table></body></html> |