background image

Vol. 3D 41-81

SGX INSTRUCTION REFERENCES

EEXIT—Exits an Enclave

Instruction Operand Encoding

Description

The ENCLU[EEXIT] instruction exits the currently executing enclave and branches to the location specified in RBX. 
RCX receives the current AEP. If RBX is not within the CS (32-bit mode) or is not canonical (64-bit mode) a #GP(0) 
results.

EEXIT Memory Parameter Semantics

If RBX specifies an address that is inside the enclave, the instruction will complete normally. The fetch of the next 
instruction will occur in non-enclave mode, but will attempt to fetch from inside the enclave. This has the effect of 
abort page semantics on the next destination.
If secrets are contained in any registers, it is responsibility of enclave software to clear those registers.
If XCR0 was modified on enclave entry, it is restored to the value it had at the time of the most recent EENTER or 
ERESUME.
If the enclave is opt-out, RFLAGS.TF is loaded from the value previously saved on EENTER. 
Code and data breakpoints are unsuppressed.
Performance monitoring counters are unsuppressed.

Concurrency Restrictions

Opcode/

Instruction

Op/En

64/32 

bit Mode 

Support

CPUID 

Feature 

Flag

Description

 EAX = 04H

IR

V/V

SGX1

This leaf function is used to exit an enclave.

ENCLU[EEXIT]

Op/En

EAX

RBX

RCX

IR

EEXIT (In)

Target address outside the enclave (In)

Address of the current AEP (In)

Target Address

 Non-Enclave read and execute access

Table 41-54.  Concurrency Restrictions of EEXIT with Intel® SGX Instructions - 1of 2

Operation

EEXIT

EADD

EBLOCK

ECRE

ATE

EDBGRD/

WR

EENTER/

ERESUME

EEXTEND

EGETKEY

EINIT

ELDB/ELDU

EPA

Param Targ VA

SECS Targ SECS Targ SECS SECS

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

SECS VA

EEXIT

TCS

Y

Y

Y

Y

Y

N

Y

Y

Y

Y

Y

Y

Y

Y

Y

SSA

U

Y

Y

Y

Y

Y

Y

U

Y

Y

U

Y

Y

Y

Y

Y

SECS

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Table 41-55.  Concurrency Restrictions of EEXIT with Intel® SGX Instructions - 2 of 2

Operation

EREMOVE

EREPORT

ETRA

CK

EWB

EAUG

EMODPE

EMODPR

EMODT

EACCEPT

EACCEPTCOPY

Para

m

Targ SECS Param SECS SECS

SRC VA

SECS Targ SECS Targ SECI

NFO

Targ SECS Targ SECS Targ SECI

NFO

SECS Targ SRC SECI

NFO

EEXIT

TCS

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

SSA

Y

Y

Y

Y

Y

Y

Y

U

Y

Y

Y

U

Y

U

U

SECS Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y

Y