Skip to content

Commit

Permalink
AdvLoggerPkg/SecDebugAgent: Update for 64-bit
Browse files Browse the repository at this point in the history
Allows the module to be built for 64-bit SEC.

Signed-off-by: Michael Kubacki <[email protected]>
  • Loading branch information
makubacki committed Jan 20, 2024
1 parent a6a9f87 commit d19b1ee
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ UINT32 *
EFIAPI
AsmRepLodsd (
IN UINT32 *Address,
IN UINT32 Length
IN UINTN Length
);

#endif // __ADVANCED_LOGGER_SEC_DEBUGAGENT_H__
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32
# VALID_ARCHITECTURES = IA32 X64
#

[Sources]
AdvancedLoggerSecDebugAgent.c
RamForSEC.c

[Sources.Ia32]
ia32/RamForSEC.c
[Sources.IA32]
ia32/AsmRepLodsd.nasm

[Sources.X64]
X64/AsmRepLodsd.nasm

[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
Expand Down
42 changes: 42 additions & 0 deletions AdvLoggerPkg/Library/DebugAgent/Sec/X64/AsmRepLodsd.nasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
;------------------------------------------------------------------------------
;
; Copyright (c) Microsoft Corporation. All rights reserved.
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; RepLodsd.nasm
;
; Abstract:
;
; Executes a rep lodsd (repeated load dword string instruction). While there is no valid
; data at the address, this allocates entries in the cache with the correct address tags.
;
; @param Address The pointer to the cache location.
; @param Length The length in bytes of the region to load.
;
; @return Value Returns the next address to be touched (to verify the rep lodsd operation)
;
;------------------------------------------------------------------------------

SECTION .text

;------------------------------------------------------------------------------
; UINT32 *
; EFIAPI
; AsmRepLodsd (
; IN UINT32 *Address, // rcx
; IN UINTN Length // rdx
; );
;------------------------------------------------------------------------------
global ASM_PFX(AsmRepLodsd)
ASM_PFX(AsmRepLodsd):
push rsi
xchg rcx, rdx
mov rsi, rdx
shr rcx, 2
cld
rep lodsd
mov rax, rsi
pop rsi
ret
2 changes: 1 addition & 1 deletion AdvLoggerPkg/Library/DebugAgent/Sec/ia32/AsmRepLodsd.nasm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
; EFIAPI
; AsmRepLodsd (
; IN UINT32 *Address,
; IN UINT32 Length
; IN UINTN Length
; );
;------------------------------------------------------------------------------
global ASM_PFX(AsmRepLodsd)
Expand Down

0 comments on commit d19b1ee

Please sign in to comment.