From 559520f56a2074f4daa3d6abf00a356f4ec6a144 Mon Sep 17 00:00:00 2001 From: dusoleil Date: Mon, 20 Dec 2021 02:52:55 -0500 Subject: Add doc about the rep prefix on an x86 instruction Signed-off-by: dusoleil --- docs/re/rep_prefix.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/re/rep_prefix.txt (limited to 'docs/re/rep_prefix.txt') diff --git a/docs/re/rep_prefix.txt b/docs/re/rep_prefix.txt new file mode 100644 index 0000000..b1206cc --- /dev/null +++ b/docs/re/rep_prefix.txt @@ -0,0 +1,18 @@ +The "rep" prefix on a string instruction repeats that string instruction for CX block loads. +e.g. +STOS is "Store String" +It will store the value in AX at the address in RDI +(technically, STOSB, STOSW, STOD, and STOSQ use AL, AX, EAX, and RAX respectively) +If RCX = 0x20, RDI = some buffer, and RAX = 0, + +`rep stosq` + +is equivalent to: + +``` +buf_ptr = buf +for(i = 0x20; i != 0; i++) + *buf_ptr = 0; + buf_ptr++; +``` + -- cgit v1.2.3 From d9b88e5486046a5d1f8c6b3d51b305152de3a51d Mon Sep 17 00:00:00 2001 From: dusoleil Date: Sat, 25 Dec 2021 12:43:52 -0500 Subject: Fix typo in for loop in asm rep prefix doc Signed-off-by: dusoleil --- docs/re/rep_prefix.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/re/rep_prefix.txt') diff --git a/docs/re/rep_prefix.txt b/docs/re/rep_prefix.txt index b1206cc..23e0cec 100644 --- a/docs/re/rep_prefix.txt +++ b/docs/re/rep_prefix.txt @@ -11,7 +11,7 @@ is equivalent to: ``` buf_ptr = buf -for(i = 0x20; i != 0; i++) +for(i = 0x20; i != 0; i--) *buf_ptr = 0; buf_ptr++; ``` -- cgit v1.2.3