From d28ef1859dcf0ffa362ff72e2de64dea09e37306 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 11 Sep 2025 16:53:42 -0700 Subject: [PATCH] unittests: modrm_oob include helper --- unittests/ASM/Includes/modrm_oob_macros.mac | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 unittests/ASM/Includes/modrm_oob_macros.mac diff --git a/unittests/ASM/Includes/modrm_oob_macros.mac b/unittests/ASM/Includes/modrm_oob_macros.mac new file mode 100644 index 000000000..fe1e0f5de --- /dev/null +++ b/unittests/ASM/Includes/modrm_oob_macros.mac @@ -0,0 +1,51 @@ +%macro w2 2 +; Ensures that the load doesn't read past the end. +%1 [r15 - %2] + +; Ensures the load doesn't read before the start. +%1 [r14] +%endmacro + +%macro w3 3 +; Ensures that the load doesn't read past the end. +%1 [r15 - %2], %3 + +; Ensures the load doesn't read before the start. +%1 [r14], %3 +%endmacro + +%macro r3 3 +; Ensures that the load doesn't read past the end. +%1 %3, [r15 - %2] + +; Ensures the load doesn't read before the start. +%1 %3, [r14] +%endmacro + +%macro rw3 3 +r3 %1, %2, %3 +w3 %1, %2, %3 +%endmacro + +%macro w4 4 +; Ensures that the load doesn't read past the end. +%1 [r15 - %2], %3, %4 + +; Ensures the load doesn't read before the start. +%1 [r14], %3, %4 +%endmacro + +%macro r4 4 +; Ensures that the load doesn't read past the end. +%1 %3, [r15 - %2], %4 + +; Ensures the load doesn't read before the start. +%1 %3, [r14], %4 +%endmacro + +%macro rw4 4 +r4 %1, %2, %3, %4 +w4 %1, %2, %3, %3 +%endmacro + +