mirror of https://github.com/acidanthera/audk.git
1. Add debug init flag DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 in Debug Agent Library.
2. Update Capsule modules to consume debug agent library to support source debugging in x64 code. 3. Update BootScriptExecutorDxe module to support source debugging on S3 path. signed-off-by: Jeff Fan <jeff.fan@intel.com> reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13680 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5df0877aff
commit
933d80a149
|
@ -15,17 +15,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#ifndef __DEBUG_AGENT_LIB_H__
|
#ifndef __DEBUG_AGENT_LIB_H__
|
||||||
#define __DEBUG_AGENT_LIB_H__
|
#define __DEBUG_AGENT_LIB_H__
|
||||||
|
|
||||||
#define DEBUG_AGENT_INIT_PREMEM_SEC 1
|
#define DEBUG_AGENT_INIT_PREMEM_SEC 1
|
||||||
#define DEBUG_AGENT_INIT_POSTMEM_SEC 2
|
#define DEBUG_AGENT_INIT_POSTMEM_SEC 2
|
||||||
#define DEBUG_AGENT_INIT_DXE_CORE 3
|
#define DEBUG_AGENT_INIT_DXE_CORE 3
|
||||||
#define DEBUG_AGENT_INIT_SMM 4
|
#define DEBUG_AGENT_INIT_SMM 4
|
||||||
#define DEBUG_AGENT_INIT_ENTER_SMI 5
|
#define DEBUG_AGENT_INIT_ENTER_SMI 5
|
||||||
#define DEBUG_AGENT_INIT_EXIT_SMI 6
|
#define DEBUG_AGENT_INIT_EXIT_SMI 6
|
||||||
#define DEBUG_AGENT_INIT_S3 7
|
#define DEBUG_AGENT_INIT_S3 7
|
||||||
#define DEBUG_AGENT_INIT_DXE_AP 8
|
#define DEBUG_AGENT_INIT_DXE_AP 8
|
||||||
#define DEBUG_AGENT_INIT_PEI 9
|
#define DEBUG_AGENT_INIT_PEI 9
|
||||||
#define DEBUG_AGENT_INIT_DXE_LOAD 10
|
#define DEBUG_AGENT_INIT_DXE_LOAD 10
|
||||||
#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
|
#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
|
||||||
|
#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
|
||||||
|
|
||||||
//
|
//
|
||||||
// Context for DEBUG_AGENT_INIT_POSTMEM_SEC
|
// Context for DEBUG_AGENT_INIT_POSTMEM_SEC
|
||||||
|
|
|
@ -45,21 +45,23 @@ S3BootScriptExecutorEntryFunction (
|
||||||
UINTN TempStackTop;
|
UINTN TempStackTop;
|
||||||
UINTN TempStack[0x10];
|
UINTN TempStack[0x10];
|
||||||
UINTN AsmTransferControl16Address;
|
UINTN AsmTransferControl16Address;
|
||||||
|
IA32_DESCRIPTOR IdtDescriptor;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disable interrupt of Debug timer, since new IDT table cannot handle it.
|
// Disable interrupt of Debug timer, since new IDT table cannot handle it.
|
||||||
//
|
//
|
||||||
SaveAndSetDebugTimerInterrupt (FALSE);
|
SaveAndSetDebugTimerInterrupt (FALSE);
|
||||||
|
|
||||||
|
AsmReadIdtr (&IdtDescriptor);
|
||||||
//
|
//
|
||||||
// Restore IDT for debug
|
// Restore IDT for debug
|
||||||
//
|
//
|
||||||
SetIdtEntry (AcpiS3Context);
|
SetIdtEntry (AcpiS3Context);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Debug Agent to support source level debug in S3 path.
|
// Initialize Debug Agent to support source level debug in S3 path, it will disable interrupt and Debug Timer.
|
||||||
//
|
//
|
||||||
InitializeDebugAgent (DEBUG_AGENT_INIT_S3, NULL, NULL);
|
InitializeDebugAgent (DEBUG_AGENT_INIT_S3, (VOID *)&IdtDescriptor, NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Because not install BootScriptExecute PPI(used just in this module), So just pass NULL
|
// Because not install BootScriptExecute PPI(used just in this module), So just pass NULL
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions
|
are licensed and made available under the terms and conditions
|
||||||
|
@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/PeCoffGetEntryPointLib.h>
|
#include <Library/PeCoffGetEntryPointLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
#include <Library/ReportStatusCodeLib.h>
|
#include <Library/ReportStatusCodeLib.h>
|
||||||
|
#include <Library/DebugAgentLib.h>
|
||||||
#include <IndustryStandard/PeImage.h>
|
#include <IndustryStandard/PeImage.h>
|
||||||
#include "Common/CommonHeader.h"
|
#include "Common/CommonHeader.h"
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
[LibraryClasses.IA32]
|
[LibraryClasses.IA32]
|
||||||
PeCoffGetEntryPointLib
|
PeCoffGetEntryPointLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
DebugAgentLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiCapsuleVendorGuid # ALWAYS_CONSUMED
|
gEfiCapsuleVendorGuid # ALWAYS_CONSUMED
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
BaseLib
|
BaseLib
|
||||||
DebugLib
|
DebugLib
|
||||||
CpuExceptionHandlerLib
|
CpuExceptionHandlerLib
|
||||||
|
DebugAgentLib
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
FALSE
|
FALSE
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Capsule update PEIM for UEFI2.0
|
Capsule update PEIM for UEFI2.0
|
||||||
|
|
||||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions
|
are licensed and made available under the terms and conditions
|
||||||
|
@ -349,6 +349,10 @@ Thunk32To64 (
|
||||||
//
|
//
|
||||||
AsmWriteCr3 ((UINTN) PageTableAddress);
|
AsmWriteCr3 ((UINTN) PageTableAddress);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Disable interrupt of Debug timer, since the IDT table cannot work in long mode
|
||||||
|
//
|
||||||
|
SaveAndSetDebugTimerInterrupt (FALSE);
|
||||||
//
|
//
|
||||||
// Transfer to long mode
|
// Transfer to long mode
|
||||||
//
|
//
|
||||||
|
|
|
@ -15,9 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/CpuExceptionHandlerLib.h>
|
#include <Library/CpuExceptionHandlerLib.h>
|
||||||
|
#include <Library/DebugAgentLib.h>
|
||||||
#include "CommonHeader.h"
|
#include "CommonHeader.h"
|
||||||
|
|
||||||
#define EXCEPTION_VECTOR_NUMBER 0x20
|
#define EXCEPTION_VECTOR_NUMBER 0x22
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The X64 entrypoint is used to process capsule in long mode then
|
The X64 entrypoint is used to process capsule in long mode then
|
||||||
|
@ -58,6 +59,11 @@ _ModuleEntryPoint (
|
||||||
// Setup the default CPU exception handlers
|
// Setup the default CPU exception handlers
|
||||||
//
|
//
|
||||||
SetupCpuExceptionHandlers ();
|
SetupCpuExceptionHandlers ();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize Debug Agent to support source level debug
|
||||||
|
//
|
||||||
|
InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64, (VOID *) &Ia32Idtr, NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call CapsuleDataCoalesce to process capsule.
|
// Call CapsuleDataCoalesce to process capsule.
|
||||||
|
@ -71,6 +77,10 @@ _ModuleEntryPoint (
|
||||||
|
|
||||||
ReturnContext->ReturnStatus = Status;
|
ReturnContext->ReturnStatus = Status;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Disable interrupt of Debug timer, since the new IDT table cannot work in long mode
|
||||||
|
//
|
||||||
|
SaveAndSetDebugTimerInterrupt (FALSE);
|
||||||
//
|
//
|
||||||
// Restore IA32 IDT table
|
// Restore IA32 IDT table
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue