diff --git a/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.h b/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.h index 1e4dae19ef..3dd40ea5fc 100644 --- a/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.h +++ b/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.h @@ -57,7 +57,7 @@ UINT32 * EFIAPI AsmRepLodsd ( IN UINT32 *Address, - IN UINT32 Length + IN UINTN Length ); #endif // __ADVANCED_LOGGER_SEC_DEBUGAGENT_H__ diff --git a/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.inf b/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.inf index 9cec1e7bac..c0b4a5f64a 100644 --- a/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.inf +++ b/AdvLoggerPkg/Library/DebugAgent/Sec/AdvancedLoggerSecDebugAgent.inf @@ -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 diff --git a/AdvLoggerPkg/Library/DebugAgent/Sec/ia32/RamForSEC.c b/AdvLoggerPkg/Library/DebugAgent/Sec/RamForSEC.c similarity index 100% rename from AdvLoggerPkg/Library/DebugAgent/Sec/ia32/RamForSEC.c rename to AdvLoggerPkg/Library/DebugAgent/Sec/RamForSEC.c diff --git a/AdvLoggerPkg/Library/DebugAgent/Sec/X64/AsmRepLodsd.nasm b/AdvLoggerPkg/Library/DebugAgent/Sec/X64/AsmRepLodsd.nasm new file mode 100644 index 0000000000..fcfe34865a --- /dev/null +++ b/AdvLoggerPkg/Library/DebugAgent/Sec/X64/AsmRepLodsd.nasm @@ -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 diff --git a/AdvLoggerPkg/Library/DebugAgent/Sec/ia32/AsmRepLodsd.nasm b/AdvLoggerPkg/Library/DebugAgent/Sec/ia32/AsmRepLodsd.nasm index 8499095e4c..7bc179168a 100644 --- a/AdvLoggerPkg/Library/DebugAgent/Sec/ia32/AsmRepLodsd.nasm +++ b/AdvLoggerPkg/Library/DebugAgent/Sec/ia32/AsmRepLodsd.nasm @@ -26,7 +26,7 @@ ; EFIAPI ; AsmRepLodsd ( ; IN UINT32 *Address, -; IN UINT32 Length +; IN UINTN Length ; ); ;------------------------------------------------------------------------------ global ASM_PFX(AsmRepLodsd)