Skip to content

Commit

Permalink
Do nothing for a repeated string instruction if ecx is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed May 25, 2018
1 parent 01d919d commit 93788b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions emu/gadgets-x86/gadgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
cmpl TLB_ENTRY_page_if_writable(%_tlb,%r14), %r15d
.endif
movl %r15d, -TLB_entries+TLB_dirty_page(%_tlb)
je 2f
je 10f
call handle_\type\()_miss
2:
10:
addq TLB_ENTRY_data_minus_addr(%_tlb,%r14), %_addrq
.endm

Expand Down
5 changes: 5 additions & 0 deletions emu/gadgets-x86/string.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
.endif

.gadget \op\size\()_\rep
.ifc \rep,rep
testl %ecx, %ecx
jz 2f
1:
.endif
.ifc \op,stos
movl %edi, %_addr
write_prep
Expand All @@ -38,6 +42,7 @@
.ifc \rep,rep
decl %ecx
jnz 1b
2:
.endif
gret 1
.endm
Expand Down

0 comments on commit 93788b4

Please sign in to comment.