background image

41-46 Vol. 3D

SGX INSTRUCTION REFERENCES

EMODPR—Restrict the Permissions of an EPC Page  

Instruction Operand Encoding

Description

This leaf function restricts the access rights associated with an EPC page in an initialized enclave. THE RWX bits of 
the SECINFO parameter are treated as a permissions mask; supplying a value that does not restrict the page 
permissions will have no effect. 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 EMODPR leaf function.

EMODPR Memory Parameter Semantics

The instruction faults if any of the following: 

EMODPR Faulting Conditions

The error codes are: 

Concurrency Restrictions

Opcode/

Instruction

Op/En

64/32 

bit Mode 

Support

CPUID 

Feature 

Flag

Description

 EAX = 0EH

IR

V/V

SGX2

This leaf function restricts the access rights associated with a 

EPC page in an initialized enclave.

ENCLS[EMODPR]

Op/En

EAX

RBX

RCX

IR

EMODPR (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-28.  EMODPR Return Value in RAX

 Error Code (see Table 41-3)

Description

No Error

EMODPR 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, EMODT, or EWB

Table 41-29.  Concurrency Restrictions of EMODPR 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

EMODPR

Targ

Y

N

Y

N

Y

Y

N

Y

N

N

SECS

Y

Y

N

Y

Y

Y

Y

Y

Y

Y

Y

Y

N

Y

Y

N

Y

Y

Y

Y