Skip to content
Henk-Jan Lebbink edited this page Jun 5, 2018 · 2 revisions

SGX INSTRUCTION REFERENCES EPA — Add Version Array

Opcode/ Instruction Op/En 64/32 bit Mode Support CPUID Feature Flag Description
EAX = 0AH ENCLS[EPA] IR V/V SGX1 This leaf function adds a Version Array to the EPC.

Instruction Operand Encoding

Op/En EAX RBX RCX
IR EPA (In) PT_VA (In, Constant) Effective address of the EPC page (In)

Description

This leaf function creates an empty version array in the EPC page whose logical address is given by DS:RCX, and sets up EPCM attributes for that page. At the time of execution of this instruction, the register RBX must be set to PT_VA.

The table below provides additional information on the memory parameter of EPA leaf function.

EPA Memory Parameter Semantics

EPCPAGE
Write access permitted by Enclave

Concurrency Restrictions

Table 40-37. Base Concurrency Restrictions of EPA

Leaf Parameter Base Concurrency Restrictions
Access On Conflict SGX_CONFLICT VM Exit Qualification
EPA VA [DS:RCX] Exclusive #GP EPC_PAGE_CONFLICT_EXCEPTION

Table 40-38. Additional Concurrency Restrictions of EPA

Leaf Parameter Additional Concurrency Restrictions
vs. EACCEPT, EACCEPTCOPY, EMODPE, EMODPR, EMODT vs. EADD, EEXTEND, EINIT vs. ETRACK, ETRACKC
Access On Conflict Access On Conflict Access On Conflict
EPA VA [DS:RCX] Concurrent L Concurrent Concurrent

Operation

IF (RBXPT_VA or 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 accessing the page) 
    THEN 
        IF (<<VMX non-root operation>> AND <<ENABLE_EPC_VIRTUALIZATION_EXTENSIONS>>)
40-62 Vol. 3D
                            SGX INSTRUCTION REFERENCES
            THEN
                VMCS.Exit_reasonSGX_CONFLICT;
                VMCS.Exit_qualification.codeEPC_PAGE_CONFLICT_EXCEPTION;
                VMCS.Exit_qualification.error0;
                VMCS.Guest-physical_address ←<< translation of DS:RCX produced by paging >>;
                VMCS.Guest-linear_addressDS:RCX;
        
            Deliver VMEXIT;
 
            ELSE
                #GP(0);
        FI;
FI;
(* Check EPC page must be empty *)
IF (EPCM(DS:RCX). VALID0)
    THEN #PF(DS:RCX); FI;
(* Clears EPC page *)
DS:RCX[32767:0] ← 0;
EPCM(DS:RCX).PTPT_VA;
EPCM(DS:RCX).ENCLAVEADDRESS0;
EPCM(DS:RCX).BLOCKED0;
EPCM(DS:RCX).PENDING0;
EPCM(DS:RCX).MODIFIED0;
EPCM(DS:RCX).PR0;
EPCM(DS:RCX).RWX0;
EPCM(DS:RCX).VALID1;

Flags Affected

None

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 another Intel SGX instruction is accessing the EPC page. If RBX is not set to PT_VA.

#PF(error code) If a page fault occurs in accessing memory operands. If a memory operand is not an EPC page. If the EPC page is valid.

64-Bit Mode Exceptions

#GP(0) If a memory operand is non-canonical form. If a memory operand is not properly aligned. If another Intel SGX instruction is accessing the EPC page. If RBX is not set to PT_VA.

#PF(error code) If a page fault occurs in accessing memory operands. If a memory operand is not an EPC page. If the EPC page is valid.

Vol. 3D 40-63


Source: Intel® Architecture Software Developer's Manual (May 2018)
Generated: 5-6-2018

Clone this wiki locally