x86: Move cache-as-RAM code into a common location