summaryrefslogtreecommitdiffstats
path: root/docs/re/rep_prefix.txt
blob: 23e0cec5d0b05886df3b615bf9d970f4fc9fe2ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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++;
```