mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-11-02 20:44:39 +01:00 
			
		
		
		
	REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** @file
 | 
						|
  Set a IDT entry for debug purpose
 | 
						|
 | 
						|
  Set a IDT entry for interrupt vector 3 for debug purpose for IA32 platform
 | 
						|
 | 
						|
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
 | 
						|
 | 
						|
SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
						|
 | 
						|
**/
 | 
						|
#include "ScriptExecute.h"
 | 
						|
 | 
						|
/**
 | 
						|
  Set a IDT entry for interrupt vector 3 for debug purpose.
 | 
						|
 | 
						|
  @param  AcpiS3Context  a pointer to a structure of ACPI_S3_CONTEXT
 | 
						|
 | 
						|
**/
 | 
						|
VOID
 | 
						|
SetIdtEntry (
 | 
						|
  IN ACPI_S3_CONTEXT  *AcpiS3Context
 | 
						|
  )
 | 
						|
{
 | 
						|
  IA32_IDT_GATE_DESCRIPTOR  *IdtEntry;
 | 
						|
  IA32_DESCRIPTOR           *IdtDescriptor;
 | 
						|
  UINTN                     S3DebugBuffer;
 | 
						|
  EFI_STATUS                Status;
 | 
						|
 | 
						|
  //
 | 
						|
  // Restore IDT for debug
 | 
						|
  //
 | 
						|
  IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile);
 | 
						|
  AsmWriteIdtr (IdtDescriptor);
 | 
						|
 | 
						|
  //
 | 
						|
  // Setup the default CPU exception handlers
 | 
						|
  //
 | 
						|
  Status = InitializeCpuExceptionHandlers (NULL);
 | 
						|
  ASSERT_EFI_ERROR (Status);
 | 
						|
 | 
						|
  DEBUG_CODE_BEGIN ();
 | 
						|
  //
 | 
						|
  // Update IDT entry INT3 if the instruction is valid in it
 | 
						|
  //
 | 
						|
  S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress);
 | 
						|
  if (*(UINTN *)S3DebugBuffer != (UINTN)-1) {
 | 
						|
    IdtEntry                  = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
 | 
						|
    IdtEntry->Bits.OffsetLow  = (UINT16)S3DebugBuffer;
 | 
						|
    IdtEntry->Bits.Selector   = (UINT16)AsmReadCs ();
 | 
						|
    IdtEntry->Bits.Reserved_0 = 0;
 | 
						|
    IdtEntry->Bits.GateType   = IA32_IDT_GATE_TYPE_INTERRUPT_32;
 | 
						|
    IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
 | 
						|
  }
 | 
						|
 | 
						|
  DEBUG_CODE_END ();
 | 
						|
}
 |