## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### Description

The MOV instruction copies the second operand to the first operand.

If the destination operand is a segment register (DS, ES, SS, etc.), then data from a descriptor is also loaded into the shadow portion of the register. The data for the register is obtained from the descriptor table entry for the selector given. A null selector (values 0000-0003) can be loaded into the DS, ES, FS, and GS registers without causing an exception; however, use of these registers causes a #GP(0) exception, and no memory reference occurs.

A MOV into SS instruction inhibits all interrupts until after the processing of the next instruction (which should be a MOV into ESP instruction).

Loading a segment register under Protected Mode results in special checks and actions, as described in the following listing:

    IF SS is loaded;
    THEN
       IF selector is null THEN #GP(0);
       Selector index must be within its descriptor table limits else #GP(selector);
       Selector's RPL must equal CPL else #GP(selector);
       AR byte must indicate a writable data segment else #GP(selector);
       DPL in the AR byte must equal CPL else #GP(selector);
       Segment must be marked present else #SS(selector);
       Load SS with selector;
       Load SS with descriptor.
    FI;
    IF DS, ES, FS or GS is loaded with non-null selector;
    THEN
       Selector index must be within its descriptor table limits
          else #GP(selector);
       AR byte must indicate data or readable code segment else #GP(selector);
       IF data or nonconforming code segment
       THEN both the RPL and the CPL must be less than or equal to DPL in AR byte;
       ELSE #GP(selector);
       FI;
       Segment must be marked present else #NP(selector);
       Load segment register with selector;
       Load segment register with descriptor;
    FI;
    IF DS, ES, FS or GS is loaded with a null selector;
    THEN
       Load segment register with selector;
       Clear descriptor valid bit;
    FI;