200 lines
6.6 KiB
HTML
200 lines
6.6 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:x86="http://www.felixcloutier.com/x86"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" href="style.css"></link><title>EPA
|
||
— Add Version Array</title></head><body><header><nav><ul><li><a href='index.html'>Index</a></li><li>December 2023</li></ul></nav></header><h1>EPA
|
||
— Add Version Array</h1>
|
||
|
||
<table>
|
||
<tr>
|
||
<th>Opcode/Instruction</th>
|
||
<th>Op/En</th>
|
||
<th>64/32 bit Mode Support</th>
|
||
<th>CPUID Feature Flag</th>
|
||
<th>Description</th></tr>
|
||
<tr>
|
||
<td>EAX = 0AH ENCLS[EPA]</td>
|
||
<td>IR</td>
|
||
<td>V/V</td>
|
||
<td>SGX1</td>
|
||
<td>This leaf function adds a Version Array to the EPC.</td></tr></table>
|
||
<h2 id="instruction-operand-encoding">Instruction Operand Encoding<a class="anchor" href="#instruction-operand-encoding">
|
||
¶
|
||
</a></h2>
|
||
<table>
|
||
<tr>
|
||
<td>Op/En</td>
|
||
<td>EAX</td>
|
||
<td>RBX</td>
|
||
<td>RCX</td></tr>
|
||
<tr>
|
||
<td>IR</td>
|
||
<td>EPA (In)</td>
|
||
<td>PT_VA (In, Constant)</td>
|
||
<td>Effective address of the EPC page (In)</td></tr></table>
|
||
<h3 id="description">Description<a class="anchor" href="#description">
|
||
¶
|
||
</a></h3>
|
||
<p>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.</p>
|
||
<p>The table below provides additional information on the memory parameter of EPA leaf function.</p>
|
||
<h2 id="epa-memory-parameter-semantics">EPA Memory Parameter Semantics<a class="anchor" href="#epa-memory-parameter-semantics">
|
||
¶
|
||
</a></h2>
|
||
<table>
|
||
<tr>
|
||
<td>EPCPAGE</td></tr>
|
||
<tr>
|
||
<td>Write access permitted by Enclave</td></tr></table>
|
||
<h3 id="concurrency-restrictions">Concurrency Restrictions<a class="anchor" href="#concurrency-restrictions">
|
||
¶
|
||
</a></h3>
|
||
<figure id="tbl-38-37">
|
||
<table>
|
||
<tr>
|
||
<th rowspan="2">Leaf</th>
|
||
<th rowspan="2">Parameter</th>
|
||
<th colspan="3">Base Concurrency Restrictions</th></tr>
|
||
<tr>
|
||
<th></th>
|
||
<th>On Conflict </th>
|
||
<th></th></tr>
|
||
<tr>
|
||
<td>EPA EPA
|
||
VA [DS:RCX]
|
||
Exclusive #GP EPA
|
||
VA [DS:RCX]
|
||
</td>
|
||
<td>VA [DS:RCX]</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td></tr></table>
|
||
<figcaption><span class="not-imported">Table 38-37</span>. Base Concurrency Restrictions of EPA</figcaption></figure>
|
||
<figure id="tbl-38-38">
|
||
<table>
|
||
<tr>
|
||
<td rowspan="3"><strong>Leaf Access On Conflict
|
||
Access On Conflict
|
||
</strong>EPA
|
||
VA [DS:RCX]
|
||
Concurrent <strong>Access On Conflict
|
||
Access On Conflict
|
||
</strong>EPA
|
||
VA [DS:RCX]
|
||
</td>
|
||
<td rowspan="3"><strong>Parameter</strong></td>
|
||
<td colspan="6"><strong>Additional Concurrency Restrictions</strong></td></tr>
|
||
<tr>
|
||
<td colspan="2"><strong>vs. EACCEPT, EACCEPTCOPY, vs. EADD, EEXTEND, EINIT
|
||
vs. ETRACK, ETRACKC
|
||
Access vs. ETRACK, ETRACKC
|
||
Access On Conflict
|
||
Access vs. ETRACK, ETRACKC
|
||
Access On Conflict
|
||
EMODPE, EMODPR, EMODT</strong></td>
|
||
<td colspan="2"><strong>vs. EADD, EEXTEND, EINIT vs. EADD, EEXTEND, EINIT
|
||
vs. ETRACK, ETRACKC
|
||
</strong></td>
|
||
<td colspan="2"><strong>vs. ETRACK, ETRACKC</strong></td></tr>
|
||
<tr>
|
||
<td><strong>Access On Conflict
|
||
Access On Conflict
|
||
Access Access On Conflict
|
||
Access On Conflict
|
||
</strong></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td>
|
||
<td></td></tr>
|
||
<tr>
|
||
<td>EPA</td>
|
||
<td>VA [DS:RCX]</td>
|
||
<td></td>
|
||
<td></td>
|
||
<td>Concurrent</td>
|
||
<td></td>
|
||
<td>Concurrent</td>
|
||
<td></td></tr></table>
|
||
<figcaption><span class="not-imported">Table 38-38</span>. Additional Concurrency Restrictions of EPA</figcaption></figure>
|
||
<h3 id="operation">Operation<a class="anchor" href="#operation">
|
||
¶
|
||
</a></h3>
|
||
<pre>IF (RBX ≠ PT_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>>)
|
||
THEN
|
||
VMCS.Exit_reason := SGX_CONFLICT;
|
||
VMCS.Exit_qualification.code := EPC_PAGE_CONFLICT_EXCEPTION;
|
||
VMCS.Exit_qualification.error := 0;
|
||
VMCS.Guest-physical_address := << translation of DS:RCX produced by paging >>;
|
||
VMCS.Guest-linear_address := DS:RCX;
|
||
Deliver VMEXIT;
|
||
ELSE
|
||
#GP(0);
|
||
FI;
|
||
FI;
|
||
(* Check EPC page must be empty *)
|
||
IF (EPCM(DS:RCX). VALID ≠ 0)
|
||
THEN #PF(DS:RCX); FI;
|
||
(* Clears EPC page *)
|
||
DS:RCX[32767:0] := 0;
|
||
EPCM(DS:RCX).PT := PT_VA;
|
||
EPCM(DS:RCX).ENCLAVEADDRESS := 0;
|
||
EPCM(DS:RCX).BLOCKED := 0;
|
||
EPCM(DS:RCX).PENDING := 0;
|
||
EPCM(DS:RCX).MODIFIED := 0;
|
||
EPCM(DS:RCX).PR := 0;
|
||
EPCM(DS:RCX).RWX := 0;
|
||
EPCM(DS:RCX).VALID := 1;
|
||
</pre>
|
||
<h3 id="flags-affected">Flags Affected<a class="anchor" href="#flags-affected">
|
||
¶
|
||
</a></h3>
|
||
<p>None</p>
|
||
<h3 class="exceptions" id="protected-mode-exceptions">Protected Mode Exceptions<a class="anchor" href="#protected-mode-exceptions">
|
||
¶
|
||
</a></h3>
|
||
<table>
|
||
<tr>
|
||
<td rowspan="4">#GP(0)</td>
|
||
<td>If a memory operand effective address is outside the DS segment limit.</td></tr>
|
||
<tr>
|
||
<td>If a memory operand is not properly aligned.</td></tr>
|
||
<tr>
|
||
<td>If another Intel SGX instruction is accessing the EPC page.</td></tr>
|
||
<tr>
|
||
<td>If RBX is not set to PT_VA.</td></tr>
|
||
<tr>
|
||
<td rowspan="3">#PF(error</td>
|
||
<td>code) If a page fault occurs in accessing memory operands.</td></tr>
|
||
<tr>
|
||
<td>If a memory operand is not an EPC page.</td></tr>
|
||
<tr>
|
||
<td>If the EPC page is valid.</td></tr></table>
|
||
<h3 class="exceptions" id="64-bit-mode-exceptions">64-Bit Mode Exceptions<a class="anchor" href="#64-bit-mode-exceptions">
|
||
¶
|
||
</a></h3>
|
||
<table>
|
||
<tr>
|
||
<td rowspan="4">#GP(0)</td>
|
||
<td>If a memory operand is non-canonical form.</td></tr>
|
||
<tr>
|
||
<td>If a memory operand is not properly aligned.</td></tr>
|
||
<tr>
|
||
<td>If another Intel SGX instruction is accessing the EPC page.</td></tr>
|
||
<tr>
|
||
<td>If RBX is not set to PT_VA.</td></tr>
|
||
<tr>
|
||
<td rowspan="3">#PF(error</td>
|
||
<td>code) If a page fault occurs in accessing memory operands.</td></tr>
|
||
<tr>
|
||
<td>If a memory operand is not an EPC page.</td></tr>
|
||
<tr>
|
||
<td>If the EPC page is valid.</td></tr></table><footer><p>
|
||
This UNOFFICIAL, mechanically-separated, non-verified reference is provided for convenience, but it may be
|
||
inc<span style="opacity: 0.2">omp</span>lete or b<sub>r</sub>oke<sub>n</sub> in various obvious or non-obvious
|
||
ways. Refer to <a href="https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4">Intel® 64 and IA-32 Architectures Software Developer’s Manual</a> for anything serious.
|
||
</p></footer></body></html>
|