Skip to Content
Learning Malware Analysis
book

Learning Malware Analysis

by Monnappa K A
June 2018
Beginner
510 pages
13h 7m
English
Packt Publishing
Content preview from Learning Malware Analysis

9.3.3 Repeat Instructions (rep)

The movsx instruction can only copy 1, 2, or 4 bytes, but to copy the multi-byte content, the rep instruction is used, along with the string instruction. The rep instruction depends on the ecx register, and it repeats the string instruction the number of times specified by the ecx register. After the rep instruction is executed, the value of ecx is decremented. The following assembly code copies the string "Good" (along with a null terminator) from src to dst:

lea esi,[src] ; "Good",0x0lea edi,[dst]mov ecx,5rep movsb

The rep instruction, when used with the movsx instruction, is equivalent to the memcpy() function in C programming. The rep instruction has multiple forms, which allows early termination, based ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Malware Analysis

Practical Malware Analysis

Michael Sikorski, Andrew Honig
Mastering Malware Analysis

Mastering Malware Analysis

Alexey Kleymenov, Amr Thabet
Evasive Malware

Evasive Malware

Kyle Cucci

Publisher Resources

ISBN: 9781788392501Other