/** @file
Debug Agent library implementition.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "SmmDebugAgentLib.h"
/**
Get Debug Agent Mailbox pointer.
@return Mailbox pointer.
**/
)
{
return mMailboxPointer;
}
/**
Get debug port handle.
@return Debug port handle.
**/
)
{
}
/**
Store debug register when SMI exit.
**/
)
{
mSavedDebugRegisters[0] = AsmReadDr0 ();
}
/**
Restore debug register when SMI exit.
**/
)
{
AsmWriteDr7 (0);
}
/**
Initialize debug agent.
This function is used to set up debug enviroment for source level debug
in SMM code.
If InitFlag is DEBUG_AGENT_INIT_SMM, it will overirde IDT table entries
and initialize debug port. It will get debug agent Mailbox from GUIDed HOB,
it it exists, debug agent wiil copied it into the local Mailbox in SMM space.
it will overirde IDT table entries and initialize debug port. Context will be
NULL.
If InitFlag is DEBUG_AGENT_INIT_ENTER_SMI, debug agent will save Debug
Registers and get local Mailbox in SMM space. Context will be NULL.
If InitFlag is DEBUG_AGENT_INIT_EXIT_SMI, debug agent will restore Debug
Registers. Context will be NULL.
@param[in] InitFlag Init flag is used to decide initialize process.
@param[in] Context Context needed according to InitFlag.
@param[in] Function Continue function called by debug agent library; it was
optional.
**/
)
{
switch (InitFlag) {
case DEBUG_AGENT_INIT_SMM:
}
break;
if (mMailboxPointer != NULL) {
//
// Initialize debug communication port
//
DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((DEBUG_PORT_HANDLE) (UINTN)mMailboxPointer->DebugPortHandle, NULL);
//
// If SMM entry break is set, SMM code will be break at here.
//
CpuBreakpoint ();
}
}
break;
break;
}
}