TianoCore EDK2 master
Loading...
Searching...
No Matches
Processor.c File Reference

Go to the source code of this file.

Data Structures

struct  ARM_SOFTWARE_BREAKPOINT
 

Macros

#define GDB_ARM_BKPT   0xefdbdbdb
 
#define ARM_SOFTWARE_BREAKPOINT_SIGNATURE   SIGNATURE_64('A', 'R', 'M', 'B', 'R', 'K', 'P', 'T')
 
#define ARM_SOFTWARE_BREAKPOINT_FROM_LINK(a)   CR(a, ARM_SOFTWARE_BREAKPOINT, Link, ARM_SOFTWARE_BREAKPOINT_SIGNATURE)
 

Functions

UINTN MaxEfiException (VOID)
 
UINTN MaxRegisterCount (VOID)
 
BOOLEAN CheckIsa (IN EFI_INSTRUCTION_SET_ARCHITECTURE Isa)
 
UINTNFindPointerToRegister (IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber)
 
CHAR8 * BasicReadRegister (IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *OutBufPtr)
 
VOID ReadNthRegister (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
 
VOID EFIAPI ReadGeneralRegisters (IN EFI_SYSTEM_CONTEXT SystemContext)
 
CHAR8 * BasicWriteRegister (IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber, IN CHAR8 *InBufPtr)
 
VOID WriteNthRegister (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
 
VOID EFIAPI WriteGeneralRegisters (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer)
 
VOID AddSingleStep (IN EFI_SYSTEM_CONTEXT SystemContext)
 
VOID RemoveSingleStep (IN EFI_SYSTEM_CONTEXT SystemContext)
 
VOID EFIAPI ContinueAtAddress (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
 
VOID EFIAPI SingleStep (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
 
UINTN GetBreakpointDataAddress (IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN BreakpointNumber)
 
UINTN GetBreakpointDetected (IN EFI_SYSTEM_CONTEXT SystemContext)
 
BREAK_TYPE GetBreakpointType (IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN BreakpointNumber)
 
ARM_SOFTWARE_BREAKPOINTSearchBreakpointList (IN UINT32 Address)
 
VOID SetBreakpoint (IN UINT32 Address)
 
VOID ClearBreakpoint (IN UINT32 Address)
 
VOID EFIAPI InsertBreakPoint (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
 
VOID EFIAPI RemoveBreakPoint (IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
 
VOID InitializeProcessor (VOID)
 
BOOLEAN ValidateAddress (IN VOID *Address)
 
BOOLEAN ValidateException (IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
 

Variables

EFI_EXCEPTION_TYPE_ENTRY gExceptionType []
 
UINTN gRegisterOffsets []
 
BOOLEAN mSingleStepActive = FALSE
 
UINT32 mSingleStepPC
 
UINT32 mSingleStepData
 
UINTN mSingleStepDataSize
 
LIST_ENTRY BreakpointList
 

Detailed Description

Processor specific parts of the GDB stub

Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Processor.c.

Macro Definition Documentation

◆ ARM_SOFTWARE_BREAKPOINT_FROM_LINK

#define ARM_SOFTWARE_BREAKPOINT_FROM_LINK (   a)    CR(a, ARM_SOFTWARE_BREAKPOINT, Link, ARM_SOFTWARE_BREAKPOINT_SIGNATURE)

Definition at line 376 of file Processor.c.

◆ ARM_SOFTWARE_BREAKPOINT_SIGNATURE

#define ARM_SOFTWARE_BREAKPOINT_SIGNATURE   SIGNATURE_64('A', 'R', 'M', 'B', 'R', 'K', 'P', 'T')

Definition at line 375 of file Processor.c.

◆ GDB_ARM_BKPT

#define GDB_ARM_BKPT   0xefdbdbdb

Definition at line 361 of file Processor.c.

Function Documentation

◆ AddSingleStep()

VOID AddSingleStep ( IN EFI_SYSTEM_CONTEXT  SystemContext)

Insert Single Step in the SystemContext

Parameters
SystemContextRegister content at time of the exception

Definition at line 386 of file Processor.c.

◆ BasicReadRegister()

CHAR8 * BasicReadRegister ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN UINTN  RegNumber,
IN CHAR8 *  OutBufPtr 
)

Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr

Parameters
SystemContextRegister content at time of the exception
RegNumberthe number of the register that we want to read
OutBufPtrpointer to the output buffer's end. the new data will be added from this point on.
Return values
thepointer to the next character of the output buffer that is available to be written on.

Definition at line 144 of file Processor.c.

◆ BasicWriteRegister()

CHAR8 * BasicWriteRegister ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN UINTN  RegNumber,
IN CHAR8 *  InBufPtr 
)

Adds the RegNumber-th register's value to the output buffer, starting at the given OutBufPtr

Parameters
SystemContextRegister content at time of the exception
RegNumberthe number of the register that we want to write
InBufPtrpointer to the output buffer. the new data will be extracted from the input buffer from this point on.
Return values
thepointer to the next character of the input buffer that can be used

Definition at line 246 of file Processor.c.

◆ CheckIsa()

BOOLEAN CheckIsa ( IN EFI_INSTRUCTION_SET_ARCHITECTURE  Isa)

Check to see if the ISA is supported. ISA = Instruction Set Architecture

Return values
TRUEif Isa is supported

Definition at line 105 of file Processor.c.

◆ ClearBreakpoint()

VOID ClearBreakpoint ( IN UINT32  Address)

Definition at line 549 of file Processor.c.

◆ ContinueAtAddress()

VOID EFIAPI ContinueAtAddress ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  PacketData 
)

Continue. addr is Address to resume. If addr is omitted, resume at current Address.

Parameters
SystemContextRegister content at time of the exception

Definition at line 444 of file Processor.c.

◆ FindPointerToRegister()

UINTN * FindPointerToRegister ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN UINTN  RegNumber 
)

This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering It is, by default, set to find the register pointer of the ARM member

Parameters
SystemContextRegister content at time of the exception
RegNumberThe register to which we want to find a pointer
Return values
thepointer to the RegNumber-th pointer

Definition at line 124 of file Processor.c.

◆ GetBreakpointDataAddress()

UINTN GetBreakpointDataAddress ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN UINTN  BreakpointNumber 
)

Definition at line 471 of file Processor.c.

◆ GetBreakpointDetected()

UINTN GetBreakpointDetected ( IN EFI_SYSTEM_CONTEXT  SystemContext)

Definition at line 480 of file Processor.c.

◆ GetBreakpointType()

BREAK_TYPE GetBreakpointType ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN UINTN  BreakpointNumber 
)

Definition at line 488 of file Processor.c.

◆ InitializeProcessor()

VOID InitializeProcessor ( VOID  )

Definition at line 640 of file Processor.c.

◆ InsertBreakPoint()

VOID EFIAPI InsertBreakPoint ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  PacketData 
)

‘Z1, [addr], [length]’ ‘Z2, [addr], [length]’ ‘Z3, [addr], [length]’ ‘Z4, [addr], [length]’

Insert hardware breakpoint/watchpoint at address addr of size length

Parameters
SystemContextRegister content at time of the exception
*PacketDataPointer to the Payload data for the packet

Definition at line 575 of file Processor.c.

◆ MaxEfiException()

UINTN MaxEfiException ( VOID  )

Return the number of entries in the gExceptionType[]

Return values
UINTN,thenumber of entries in the gExceptionType[] array.

Definition at line 77 of file Processor.c.

◆ MaxRegisterCount()

UINTN MaxRegisterCount ( VOID  )

Return the number of entries in the gRegisters[]

Return values
UINTN,thenumber of entries (registers) in the gRegisters[] array.

Definition at line 90 of file Processor.c.

◆ ReadGeneralRegisters()

VOID EFIAPI ReadGeneralRegisters ( IN EFI_SYSTEM_CONTEXT  SystemContext)

Reads the general registers into an output buffer and sends it as a packet

Parameters
SystemContextRegister content at time of the exception

Definition at line 216 of file Processor.c.

◆ ReadNthRegister()

VOID ReadNthRegister ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  InBuffer 
)

Reads the n-th register's value into an output buffer and sends it as a packet

Parameters
SystemContextRegister content at time of the exception
InBufferPointer to the input buffer received from gdb server

Definition at line 187 of file Processor.c.

◆ RemoveBreakPoint()

VOID EFIAPI RemoveBreakPoint ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  PacketData 
)

‘z1, [addr], [length]’ ‘z2, [addr], [length]’ ‘z3, [addr], [length]’ ‘z4, [addr], [length]’

Remove hardware breakpoint/watchpoint at address addr of size length

Parameters
SystemContextRegister content at time of the exception
*PacketDataPointer to the Payload data for the packet

Definition at line 608 of file Processor.c.

◆ RemoveSingleStep()

VOID RemoveSingleStep ( IN EFI_SYSTEM_CONTEXT  SystemContext)

Remove Single Step in the SystemContext

Parameters
SystemContextRegister content at time of the exception

Definition at line 417 of file Processor.c.

◆ SearchBreakpointList()

ARM_SOFTWARE_BREAKPOINT * SearchBreakpointList ( IN UINT32  Address)

Definition at line 497 of file Processor.c.

◆ SetBreakpoint()

VOID SetBreakpoint ( IN UINT32  Address)

Definition at line 519 of file Processor.c.

◆ SingleStep()

VOID EFIAPI SingleStep ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  PacketData 
)

‘s [addr ]’ Single step. addr is the Address at which to resume. If addr is omitted, resume at same Address.

Parameters
SystemContextRegister content at time of the exception

Definition at line 462 of file Processor.c.

◆ ValidateAddress()

BOOLEAN ValidateAddress ( IN VOID *  Address)

Definition at line 649 of file Processor.c.

◆ ValidateException()

BOOLEAN ValidateException ( IN EFI_EXCEPTION_TYPE  ExceptionType,
IN OUT EFI_SYSTEM_CONTEXT  SystemContext 
)

Definition at line 661 of file Processor.c.

◆ WriteGeneralRegisters()

VOID EFIAPI WriteGeneralRegisters ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  InBuffer 
)

‘G XX...’ Writes the new values received into the input buffer to the general registers

Parameters
SystemContextRegister content at time of the exception
InBufferPointer to the input buffer received from gdb server

pointer to the input buffer

Definition at line 330 of file Processor.c.

◆ WriteNthRegister()

VOID WriteNthRegister ( IN EFI_SYSTEM_CONTEXT  SystemContext,
IN CHAR8 *  InBuffer 
)

‘P n...=r...’ Writes the new value of n-th register received into the input buffer to the n-th register

Parameters
SystemContextRegister content at time of the exception
InBufferPointer to the input buffer received from gdb server

Definition at line 292 of file Processor.c.

Variable Documentation

◆ BreakpointList

LIST_ENTRY BreakpointList

Definition at line 378 of file Processor.c.

◆ gExceptionType

EFI_EXCEPTION_TYPE_ENTRY gExceptionType[]
Initial value:
= {
{ EXCEPT_ARM_SOFTWARE_INTERRUPT, GDB_SIGTRAP }
}

Definition at line 18 of file Processor.c.

◆ gRegisterOffsets

UINTN gRegisterOffsets[]

Definition at line 26 of file Processor.c.

◆ mSingleStepActive

BOOLEAN mSingleStepActive = FALSE

Definition at line 363 of file Processor.c.

◆ mSingleStepData

UINT32 mSingleStepData

Definition at line 365 of file Processor.c.

◆ mSingleStepDataSize

UINTN mSingleStepDataSize

Definition at line 366 of file Processor.c.

◆ mSingleStepPC

UINT32 mSingleStepPC

Definition at line 364 of file Processor.c.