This leaf function provides the mechanism for hardware to track that software has completed the required TLB address clears successfully. The instruction can only be executed when the current privilege level is 0.
The content of RCX is an effective address of an EPC page.
The table below provides additional information on the memory parameter of ETRACK leaf function.
IF (DS:RCX is not 4KByte Aligned)
THEN #GP(0); FI;
IF (DS:RCX does not resolve within an EPC)
THEN #PF(DS:RCX); FI;
(* Check concurrency with other Intel SGX instructions *)
IF (Other Intel SGX instructions using tracking facility on this SECS)
THEN
IF (<<VMX non-root operation>> AND <<ENABLE_EPC_VIRTUALIZATION_EXTENSIONS>>)
THEN
VMCS.Exit_reason := SGX_CONFLICT;
VMCS.Exit_qualification.code := TRACKING_RESOURCE_CONFLICT;
VMCS.Exit_qualification.error := 0;
VMCS.Guest-physical_address := SECS(TMP_SECS).ENCLAVECONTEXT;
VMCS.Guest-linear_address := 0;
Deliver VMEXIT;
ELSE
#GP(0);
FI;
FI;
IF (EPCM(DS:RCX). VALID = 0)
THEN #PF(DS:RCX); FI;
IF (EPCM(DS:RCX).PT ≠ PT_SECS)
THEN #PF(DS:RCX); FI;
(* All processors must have completed the previous tracking cycle*)
IF ( (DS:RCX).TRACKING ≠ 0) )
THEN
IF (<<VMX non-root operation>> AND <<ENABLE_EPC_VIRTUALIZATION_EXTENSIONS>>)
THEN
VMCS.Exit_reason := SGX_CONFLICT;
VMCS.Exit_qualification.code := TRACKING_REFERENCE_CONFLICT;
VMCS.Exit_qualification.error := 0;
VMCS.Guest-physical_address := SECS(TMP_SECS).ENCLAVECONTEXT;
VMCS.Guest-linear_address := 0;
Deliver VMEXIT;
FI;
RFLAGS.ZF := 1;
RAX := SGX_PREV_TRK_INCMPL;
GOTO DONE;
ELSE
RAX := 0;
RFLAGS.ZF := 0;
FI;
DONE:
RFLAGS.CF,PF,AF,OF,SF := 0;