forked from ish-app/ish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Theodore Dubois
committed
May 24, 2018
1 parent
c1f6c4a
commit f62a273
Showing
8 changed files
with
101 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "gadgets.h" | ||
|
||
#define REP_LIST once,rep,repnz | ||
|
||
.gadget cld | ||
andl $~DF_FLAG, CPU_eflags(%_cpu) | ||
gret | ||
|
||
.macro do_strop op, size, rep | ||
# repnz is only a thing for cmps and scas | ||
.ifc \rep,repnz | ||
.ifnc \rep,cmps; .ifnc \rep,scas | ||
.exitm | ||
.endif; .endif | ||
.endif | ||
|
||
.gadget \op\size\()_\rep | ||
1: | ||
.ifc \op,stos | ||
movl %edi, %_addr | ||
write_prep | ||
.if \size == 8 | ||
movb %al, (%_addrq) | ||
.elseif \size == 16 | ||
movw %ax, (%_addrq) | ||
.elseif \size == 32 | ||
movl %eax, (%_addrq) | ||
.endif | ||
addl $(\size/8), %edi | ||
.endif | ||
.ifc \rep,rep | ||
decl %ecx | ||
jnz 1b | ||
.endif | ||
gret | ||
.endm | ||
|
||
.irp op, stos | ||
.irp size, 8,16,32 | ||
.irp rep, REP_LIST | ||
do_strop \op, \size, \rep | ||
.endr | ||
.endr | ||
.gadget_list_size \op, REP_LIST | ||
.endr | ||
# temporary | ||
.gadget_list_size movs, REP_LIST | ||
.gadget_list_size lods, REP_LIST | ||
.gadget_list_size scas, REP_LIST | ||
.gadget_list_size cmps, REP_LIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters