Adding threadState.S: save/restoreThreadState