Re: [edk2] Interrupt hooking mechanism in EFI

Subject: Re: [edk2] Interrupt hooking mechanism in EFI

From: Andrew Fish <>

To: "" <>

Date: 2012-01-24 15:27:12

In EFI the only difference between an application and a driver is when an application returns EFI_SUCCESS the memory used to contain the applications code is freed back to the system.

This means an application can not install a protocol or creat an event and exit, as this can cause the system to crash. For example the DXE Core has a list of event notification functions that get called, if an application returns the pointer to the notification function is memory that is freed back and could end up being reused causing junk to be executed.

Thus an application must close any open events before it exits.

An application must also free any memory it allocates or this memory will be leaked, and thus no longer usable. There is no automatic garbage collection in EFI.

Sent from my iPhone

On Jan 24, 2012, at 2:02 AM, Suraj Joshi <> wrote:

Hi Andrew,


My Timer handler function is finally called. I called Even after my program ends still my TimerHandler() called after regular interval. Whether this phenomenon is right? Once any interrupt is enabled whether we need to disable the same after throw error? Please guide me.




Suraj Joshi


From: Suraj Joshi []
Sent: Tuesday, January 24, 2012 2:20 PM
Subject: Re: [edk2] Interrupt hooking mechanism in EFI


Hi Andrew,


I tried with TPL_CALLBACK, TPL_APPLICATION, TPL_NOTIFY, in every case output is same. I.e. my TimerHandler() is not called


Please help me.



Suraj Joshi


From: Andrew Fish []
Sent: Tuesday, January 24, 2012 1:52 PM
Subject: Re: [edk2] Interrupt hooking mechanism in EFI


Just saw the bug!


You should set the EFI_TPL to EFI_TPL_CALLBACK. In general you should always use as low a TPL as possible.


From UEFI spec:


#define TPL_APPLICATION            4

#define TPL_CALLBACK            8

#define TPL_NOTIFY                       16

#define TPL_HIGH_LEVEL        31


The restriction on console output is the TPL has to be:

Simple Text Output Protocol  <=  TPL_NOTIFY




Very few EFI things are legal to do at such a high TPL.  


I would think that the BOOLEAN would still get set, so I'm not sure why that does not work? 


Andrew Fish





On Jan 24, 2012, at 12:07 AM, Suraj Joshi wrote:




Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
edk2-devel mailing list