Re: [edk2] SMM Drivers in EDKII

Subject: Re: [edk2] SMM Drivers in EDKII

From: Lethom Legrand <>


Date: 2014-03-26 17:03:27

Thank you for your answer!

I was afraid it would be some thing like this.

Easy to anticipate my next question, but I will ask anyway: how can I debug SMM code? I heard about DuetPkg, that is a full emulation of UEFI, so maybe it is a solution?
Otherwise, I think my last hope is hardware debuging through USB port 0?


2014-03-25 17:53 GMT+01:00 Jordan Justen <>:
On Tue, Mar 25, 2014 at 3:03 AM, Lethom Legrand <> wrote:
> Hello everyone,
> I am trying to see how the things work in UEFI with the System Management
> Mode (SMM) of x86(-64) CPU.
> My understanding is the following:
> 1. When entering in SMM, the CPU sets itself in a real-like mode
> 2. A first SMM Dispatcher handles "legacy" SMM code: it executes them, one
> after the other
> 3. This first SMM Dispatcher sets the CPU in flat protected mode
> 4. A second SMM Dispatcher runs and executes SMM Drivers (SMM Drivers are
> Runtime Drivers that loaded themselves in SMRAM)
> 5. When every SMM Driver is executed, the RSM instruction is executed.
> I think I'm close to the truth. Unfortunately, when I'm searching in EDKII,
> I cannot find anything before the 4. statement. That is, it seems that EDKII
> misses the real-like mode part of SMM flow.
> So my question, actually, is simple: is it true that EDKII is not
> "complete". By that, I mean there are missing part that have to be implement
> by, for instance, hardware vendors that want to use it? I understand SMM
> Drivers code is the most hardware specific part of UEFI, so it makes sense.
> (another "bonus" question: have you any idea of how I can debug SMM code?
> For instance, in KVM?)

Initializing SMM and handling SMM entry is usually chipset specific
code. I don't think there is an example in EDK II.

I think QEMU (without KVM) supports SMM. Unfortunately, OVMF doesn't
support SMM so I don't think you'll be able debug SMM code with OVMF.


Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
edk2-devel mailing list