System Management Mode

From OSDev.wiki
Revision as of 13:56, 4 April 2014 by osdev>Johnburger (Quick typo fix)
Jump to navigation Jump to search

System Management Mode, or typically abbriviated to SMM, is an operating mode on Intel processors

What does system management mode do

SMM is to your kernel as what your kernel is to its processes. The firmware uses it to perform the needed things to keep your computer healthy, such as spinning up and down fans, or shutting off power when the CPU overheats. It also does tasks to emulate old hardware with modern devices. A very common scenario on modern computers is where SMM is used to emulate a PS/2 keyboard when there's only an USB keyboard attached. SMM is meant to be mostly invisible from the user's perspective, but it can induce latencies and not all emulations are as accurate as the original hardware it is meant to emulate.

SMM is triggered externally from the CPU, which means that only the chipset can trigger entry into SMM by signaling a system management interrupt. Triggering SMM from code therefore needs a roundabout through hardware - which is device-specific. The chipset typically changes the physical memory layout during SMM so that certain portions of memory are not accessible during normal operation. For this reason you can't even see the SMM code sitting in RAM during normal operation.

What can I do with system management mode?

Nothing. SMM is the sole property of the firmware and it's shielded from you. Especially so since it is bad design to have it do the things you probably thought of doing with it. A kernel or VM exists to provide such features without you touching or even damaging the computer's internal safety mechanisms.

System Management Mode and ACPI

An advanced kernel that's aware of power management can opt to take over some of the SMM functionality using ACPI. This also allows you to handle someone pushing the power button where it would normally power down your computer immediately.