background image

Vol. 3D 41-49

SGX INSTRUCTION REFERENCES

EMODT—Change the Type of an EPC Page  

Instruction Operand Encoding

Description

This leaf function modifies the type of an EPC page. The security attributes are configured to prevent access to the 
EPC page at its new type until a corresponding invocation of the EACCEPT leaf confirms the modification. This 
instruction can only be executed when current privilege level is 0.
RBX contains the effective address of a SECINFO structure while RCX contains the effective address of an EPC 
page. The table below provides additional information on the memory parameter of the EMODT leaf function.

EMODT Memory Parameter Semantics

The instruction faults if any of the following: 

EMODT Faulting Conditions

The error codes are: 

Concurrency Restrictions

Opcode/

Instruction

Op/En

64/32 

bit Mode 

Support

CPUID 

Feature 

Flag

Description

 EAX = 0FH

IR

V/V

SGX2

This leaf function changes the type of an existing EPC page.

ENCLS[EMODT]

Op/En

EAX

RBX

RCX

IR

EMODT (In)

Return Error Code (Out)

Address of a SECINFO (In)

Address of the destination EPC page (In)

SECINFO

EPCPAGE

Read access permitted by Non Enclave 

Read/Write access permitted by Enclave

The operands are not properly aligned.

If unsupported security attributes are set.

The Enclave is not initialized.

SECS is locked by another thread.

The EPC page is locked by another thread.

RCX does not contain an effective address of an EPC page in the running enclave.

The EPC page is not valid.

Table 41-31.  EMODT Return Value in RAX

 Error Code (see Table 41-3)

Description

No Error

EMODT successful

SGX_PAGE_NOT_MODIFIABLE

The EPC page cannot be modified because it is in the PENDING or MODIFIED state

SGX_LOCKFAIL

Page is being written by EADD, EAUG, ECREATE, ELDU/B, EMODPR, or EWB

Table 41-32.  Concurrency Restrictions of EMODT with Other Intel® SGX Operations 1 of 2

Operation

EEXIT

EADD

EBLOCK

ECRE

ATE

EDBGRD/

WR

EENTER/

ERESUME

EEXTEND

EGETKEY

EINIT

ELDB/ELDU

EP

A

Param TCS SSA SECS Targ SECS Targ SECS SECS

Targ SECS TCS SSA SECS Targ SECS Param SECS SECS Targ VA SECS VA

EMODT

Targ

Y

Y

C

C

C

C

C

C

Y

C

Y

N

C

C

C

SECS

Y

Y

N

Y

Y

Y

Y

Y

Y

Y

Y

Y

N

Y

Y

N

Y

Y

Y

Y