Hello Dixit,
We are back to the SGX Explained document. In short, SGX memory is managed by the OS of the platform. If the OS implements demand paging then so does SGX.
"5.2.3 Address Translation for SGX Enclaves
Under SGX, the operating system and hypervisor are still in full control of the page tables and EPTs, and each enclave’s code uses the same address translation process and page tables (§ 2.5) as its host application. This minimizes the amount of changes required to add SGX support to existing system software."
Also read section 5.5 EPC Page Eviction:
"As illustrated in Figure 69, SGX supports evicting EPC pages to DRAM pages outside the PRM range. The system software is expected to use its existing page swapping implementation to evict the contents of these pages out of DRAM and onto a disk."
Regards,
Jesus
For more complete information about compiler optimizations, see our Optimization Notice.