fp state save, restore, and error handling