background image

Vol. 3D 41-51

SGX INSTRUCTION REFERENCES

IF ( (EPCM(DS:RCX).PENDING is not 0 or (EPCM(DS:RCX).MODIFIED is not 0) )

THEN 

RFLAGS  1;
RAX  SGX_PAGE_NOT_MODIFIABLE;
GOTO DONE;

FI;

TMP_SECS  GET_SECS_ADDRESS

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

(* Check concurrency with ETRACK *)
IF (ETRACK executed concurrently)

THEN #GP(0); FI;

(* Update EPCM fields *)
EPCM(DS:RCX).PR  0;
EPCM(DS:RCX).MODIFIED  1;
EPCM(DS:RCX).R  0;
EPCM(DS:RCX).W  0;
EPCM(DS:RCX).X  0;
EPCM(DS:RCX).PT  SCRATCH_SECINFO.FLAGS.PT;

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.