Foundation for state save/restore. Missing is the per-module/area code to actually dump state.