background image

41-28 Vol. 3D

SGX INSTRUCTION REFERENCES

EDBGWR—Write to a Debug Enclave 

Instruction Operand Encoding

Description

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

EDBGWR Memory Parameter Semantics

The instruction faults if any of the following: 

EDBGWR Faulting Conditions

The error codes are: 

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 = 05H

IR

V/V

SGX1

This leaf function writes a dword/quadword to a debug enclave.

ENCLS[EDBGWR]

Op/En

EAX

RBX

RCX

IR

EDBGWR (In)

Data to be written to a debug enclave (In) Address of Target memory in the EPC (In)

EPCQW

Write access permitted by Enclave 

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 not the FLAGS word.

An operand causing any segment violation.

May page fault.

CPL > 0.

Table 41-17.  EDBGWR Return Value in RAX

 Error Code (see Table 41-3)

Description

No Error

EDBGWR successful

SGX_PAGE_NOT_DEBUGGABLE

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