mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +02:00
IntelFsp2Pkg: BaseFspDebugLibSerialPort Support for X64
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3833 Add BaseFspDebugLibSerialPort Support for X64. Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Ashraf Ali S <ashraf.ali.s@intel.com> Cc: Ted Kuo <ted.kuo@intel.com> Signed-off-by: Ted Kuo <ted.kuo@intel.com> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
This commit is contained in:
parent
5b56c52b5c
commit
0531f61376
@ -16,7 +16,7 @@
|
|||||||
LIBRARY_CLASS = DebugLib
|
LIBRARY_CLASS = DebugLib
|
||||||
|
|
||||||
#
|
#
|
||||||
# VALID_ARCHITECTURES = IA32
|
# VALID_ARCHITECTURES = IA32 X64
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
@ -25,6 +25,9 @@
|
|||||||
[Sources.Ia32]
|
[Sources.Ia32]
|
||||||
Ia32/FspDebug.nasm
|
Ia32/FspDebug.nasm
|
||||||
|
|
||||||
|
[Sources.X64]
|
||||||
|
X64/FspDebug.nasm
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
IntelFsp2Pkg/IntelFsp2Pkg.dec
|
IntelFsp2Pkg/IntelFsp2Pkg.dec
|
||||||
|
@ -33,7 +33,7 @@ VA_LIST mVaListNull;
|
|||||||
|
|
||||||
@return StackFramePointer stack frame pointer of function call.
|
@return StackFramePointer stack frame pointer of function call.
|
||||||
**/
|
**/
|
||||||
UINT32 *
|
UINTN *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetStackFramePointer (
|
GetStackFramePointer (
|
||||||
VOID
|
VOID
|
||||||
@ -193,13 +193,13 @@ DebugBPrint (
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
FillHex (
|
FillHex (
|
||||||
UINT32 Value,
|
UINTN Value,
|
||||||
CHAR8 *Buffer
|
CHAR8 *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
INTN Idx;
|
INTN Idx;
|
||||||
|
|
||||||
for (Idx = 7; Idx >= 0; Idx--) {
|
for (Idx = (sizeof (UINTN) * 2) - 1; Idx >= 0; Idx--) {
|
||||||
Buffer[Idx] = mHexTable[Value & 0x0F];
|
Buffer[Idx] = mHexTable[Value & 0x0F];
|
||||||
Value >>= 4;
|
Value >>= 4;
|
||||||
}
|
}
|
||||||
@ -228,26 +228,35 @@ DebugAssertInternal (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
|
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
|
||||||
UINT32 *Frame;
|
UINTN *Frame;
|
||||||
|
|
||||||
Frame = (UINT32 *)GetStackFramePointer ();
|
Frame = (UINTN *)GetStackFramePointer ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generate the ASSERT() message in Ascii format
|
// Generate the ASSERT() message in Ascii format
|
||||||
//
|
//
|
||||||
|
if (sizeof (UINTN) == sizeof (UINT32)) {
|
||||||
AsciiStrnCpyS (
|
AsciiStrnCpyS (
|
||||||
Buffer,
|
Buffer,
|
||||||
sizeof (Buffer) / sizeof (CHAR8),
|
sizeof (Buffer) / sizeof (CHAR8),
|
||||||
"-> EBP:0x00000000 EIP:0x00000000\n",
|
"-> EBP:0x00000000 EIP:0x00000000\n",
|
||||||
sizeof (Buffer) / sizeof (CHAR8) - 1
|
sizeof (Buffer) / sizeof (CHAR8) - 1
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
AsciiStrnCpyS (
|
||||||
|
Buffer,
|
||||||
|
sizeof (Buffer) / sizeof (CHAR8),
|
||||||
|
"-> RBP:0x0000000000000000 RIP:0x0000000000000000\n",
|
||||||
|
sizeof (Buffer) / sizeof (CHAR8) - 1
|
||||||
|
);
|
||||||
|
}
|
||||||
SerialPortWrite ((UINT8 *)"ASSERT DUMP:\n", 13);
|
SerialPortWrite ((UINT8 *)"ASSERT DUMP:\n", 13);
|
||||||
while (Frame != NULL) {
|
while (Frame != NULL) {
|
||||||
FillHex ((UINT32)Frame, Buffer + 9);
|
FillHex ((UINTN)Frame, Buffer + 9);
|
||||||
FillHex (Frame[1], Buffer + 9 + 8 + 8);
|
FillHex (Frame[1], Buffer + 9 + (sizeof (UINTN) * 2) + 8);
|
||||||
SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
|
SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
|
||||||
if ((Frame[0] > (UINT32)Frame) && (Frame[0] < (UINT32)Frame + 0x00100000)) {
|
if ((Frame[0] > (UINTN)Frame) && (Frame[0] < (UINTN)Frame + 0x00100000)) {
|
||||||
Frame = (UINT32 *)Frame[0];
|
Frame = (UINTN *)Frame[0];
|
||||||
} else {
|
} else {
|
||||||
Frame = NULL;
|
Frame = NULL;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
|
||||||
|
; SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; FSP Debug functions
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
SECTION .text
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; UINT32 *
|
||||||
|
; EFIAPI
|
||||||
|
; GetStackFramePointer (
|
||||||
|
; VOID
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
global ASM_PFX(GetStackFramePointer)
|
||||||
|
ASM_PFX(GetStackFramePointer):
|
||||||
|
mov rax, rbp
|
||||||
|
ret
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user