background image

Vol. 3D 41-25

SGX INSTRUCTION REFERENCES

EDBGRD—Read From a Debug Enclave 

Instruction Operand Encoding

Description

This leaf function copies a quadword/doubleword from an EPC page belonging to a debug enclave into the RBX 
register. Eight bytes are read in 64-bit mode, four bytes are read in non-64-bit modes. The size of data read cannot 
be overridden.
The effective address of the source location inside the EPC is provided in the register RCX.

EDBGRD Memory Parameter Semantics

The error codes are: 

The instruction faults if any of the following: 

EDBGRD Faulting Conditions

This instruction ignores the EPCM RWX attributes on the enclave page. Consequently, violation of EPCM RWX attri-
butes via EDGBRD does not result in a #GP.

Opcode/

Instruction

Op/En

64/32 

bit Mode 

Support

CPUID 

Feature 

Flag

Description

 EAX = 04H

IR

V/V

SGX1

This leaf function reads a dword/quadword from a debug enclave.

ENCLS[EDBGRD]

Op/En

EAX

RBX

RCX

IR

EDBGRD (In)

Data read from a debug enclave (Out)

Address of source memory in the EPC (In)

EPCQW

Read access permitted by Enclave 

Table 41-14.  EDBGRD Return Value in RAX

 Error Code (see Table 41-3)

Description

No Error

EDBGRD successful

SGX_PAGE_NOT_DEBUGGABLE

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

RCX points into a page that is an SECS.

RCX does not resolve to a naturally aligned linear address.

RCX points to a page that does not belong to an 

enclave that is in debug mode.

RCX points to a location inside a TCS that is beyond the architectural size of the 

TCS (SGX_TCS_LIMIT).

An operand causing any segment violation.

May page fault.

CPL > 0.