On the subject of RAM encryption, there's even an kernel modification that (ab)uses the x86 debug registers to store are AES key and transparently encrypts / decrypts RAM; Tresor.
> That [encrypted memory] in itself isn't sufficient to guard against all attacks
You might want to read about authenticated encryption [2]. The authenticity of the decrypted data often lies in the block cipher mode (for example OBS) rather than the block primitive, where Tresor uses the AES-NI instruction. I would imagine SGX does something along the same lines.
[1] https://www.usenix.org/legacy/event/sec11/tech/full_papers/M...