background image

41-48 Vol. 3D

SGX INSTRUCTION REFERENCES

FI;

IF (EPCM(DS:RCX).PT is not PT_REG)

THEN #PF(DS:RCX); FI;

TMP_SECS  GET_SECS_ADDRESS

IF (TMP_SECS.ATTRIBUTES.INIT = 0)
  THEN #GP(0); FI;

(* Set the PR bit to indicate that permission restriction is in progress *)
EPCM(DS:RCX).PR  1;

(* Update EPCM permissions *)
EPCM(DS:RCX).R  EPCM(DS:RCX).R & SCRATCH_SECINFO.FLAGS.R;
EPCM(DS:RCX).W  EPCM(DS:RCX).W & SCRATCH_SECINFO.FLAGS.W;
EPCM(DS:RCX).X  EPCM(DS:RCX).X & SCRATCH_SECINFO.FLAGS.X;

RFLAGS.ZF  0;
RAX  0;

DONE:
RFLAGS.CF,PF,AF,OF,SF  0;

Flags Affected

Sets ZF if page is not modifiable or if other SGX2 instructions are executing concurrently, otherwise cleared. Clears 
CF, PF, AF, OF, SF.

Protected Mode Exceptions

#GP(0)

If a memory operand effective address is outside the DS segment limit.
If a memory operand is not properly aligned.
If a memory operand is locked.

#PF(error code)

If a page fault occurs in accessing memory operands.
If a memory operand is not an EPC page.

64-Bit Mode Exceptions

#GP(0)

If a memory operand is non-canonical form.
If a memory operand is not properly aligned.
If a memory operand is locked.

#PF(error code)

If a page fault occurs in accessing memory operands.
If a memory operand is not an EPC page.