On Jan 24, 2014, at 4:25 PM, Toto Lebolo <toto_leb...@yahoo.com> wrote:
> Hello team,
> I am looking for an example of a UEFI shell program that has an exception
> handler.
>
> More specifically I am interested in hooking up a routine on top of the CMCI
> (Corrected machine-check error interrupt) on an x86 platfrom (Haswell).
>
> Any example using Interrupt, NMI, SMI, err[0] will be helpfull.
> Thanks for the help…
The PI Cpu Architectural Protocol is all you need. Do a
RegisterInterruptHandler() and your handler will get called with the system
context and can just return when it is done. the CPU driver handles all the
magic.
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Protocol/Cpu.h
/**
EFI_CPU_INTERRUPT_HANDLER that is called when a processor interrupt occurs.
@param InterruptType Defines the type of interrupt or exception that
occurred on the processor.This parameter is
processor architecture specific.
@param SystemContext A pointer to the processor context when
the interrupt occurred on the processor.
@return None
**/
typedef
VOID
(EFIAPI *EFI_CPU_INTERRUPT_HANDLER)(
IN CONST EFI_EXCEPTION_TYPE InterruptType,
IN CONST EFI_SYSTEM_CONTEXT SystemContext
);
/**
This function registers and enables the handler specified by InterruptHandler
for a processor
interrupt or exception type specified by InterruptType. If InterruptHandler
is NULL, then the
handler for the processor interrupt or exception type specified by
InterruptType is uninstalled.
The installed handler is called once for each processor interrupt or
exception.
@param This The EFI_CPU_ARCH_PROTOCOL instance.
@param InterruptType A pointer to the processor's current interrupt
state. Set to TRUE if interrupts
are enabled and FALSE if interrupts are disabled.
@param InterruptHandler A pointer to a function of type
EFI_CPU_INTERRUPT_HANDLER that is called
when a processor interrupt occurs. If this parameter
is NULL, then the handler
will be uninstalled.
@retval EFI_SUCCESS The handler for the processor interrupt was
successfully installed or uninstalled.
@retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for
InterruptType was
previously installed.
@retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for
InterruptType was not
previously installed.
@retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not
supported.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_CPU_REGISTER_INTERRUPT_HANDLER)(
IN EFI_CPU_ARCH_PROTOCOL *This,
IN EFI_EXCEPTION_TYPE InterruptType,
IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
);
SMM is very very different.
Thanks,
Andrew Fish
> MiKL~
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel