I was reading through this page on how sleep states work in Windows and I was intrigued by the reset vector. My current understanding is that;
When the system is in S2/S3, the processor is fully powered down, caches are lost and the bus is at least stopped, if not entirely unpowered. The contents of RAM are preserved to allow a quick resume.
On resume, the processor reads the address stored at the reset vector (on x86, that's 0xFFFFFFF0
) which is commonly mapped to ROM. It jumps to the address it's just read and begins executing.
Since it's ROM, I assume the memory can't be readily written and so must remain semi-constant (excluding BIOS flashes, etc)
So, the processor powers up, reads an address from ROM, jumps to that address and begins execution (presumably a POST or other initialisation).
At some point along the way, it needs to jump back to whatever it was executing before sleeping.
Where is the address to resume from stored and what causes the processor to look there?
In these states (S1-S3), volatile memory is kept refreshed to maintain the system state. Some components remain powered so the computer can wake from input from the keyboard, LAN, or a USB device.
I'm aware that Win8 logs off the user before hibernating (S4) instead of doing a real shutdown, so it can resume quickly (ending session means less memory to write to disk = faster)