xsave is an x86 assembly instruction that will backup all the registers except the GPRs.
xrstor is the corresponding assembly instruction that will restore all registers to their values held at the most recent use of xsave.
Unfortunately, GPRs must be backed-up manually by the programmer and restored manually by the programmer.
The program posted here will demonstrate how to use the xsave and xrstor instruction. There is a verbose example of xsave and xrstor posted near this concise example.