The BIOS provides a number of services to the Operating Systems, most of which are related to power management:
- modifying the CPU and bus clocks
- enabling/disabling mainboard devices
- expansion port power control
- suspend-to-disk and suspend-to-RAM
- resume event settings
Suspend-to-disk is implemented in the OS most of the time as the OS can restore its state faster (only the kernel state is reloaded, and program state swapped in when required, which is significantly faster than reloading the entire RAM), but the feature remains in the specification.
Suspend-to-RAM can not be implemented by the OS, as it relies on the BIOS skipping the RAM initialization and test, so the OS needs an API to tell the BIOS that it intends to be resumed with the current RAM contents. In order to provide this service, the BIOS asks the OS to leave a certain RAM area intact.
The interface for the OS for all BIOS services is a piece of virtual machine code that needs to be run on an emulator, and which generates the necessary I/O operations into the hardware. For suspend, this is generally implemented so that executing one of the hardware writes then triggers an interrupt, which transfers control to the BIOS.
Related: Why must a computer have a BIOS? – Breakthrough – 2012-08-21T20:00:26.923