A reliable, secure phase-change memory as a main memory