Skip to content

Commit 4ffba8b

Browse files
committed
vmem_write clear tb cache after write
So you don't need to manual clear the tb after change code. see #2258
1 parent 260e551 commit 4ffba8b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

uc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,14 +892,18 @@ uc_err uc_vmem_write(uc_engine *uc, uint64_t address, uc_prot prot,
892892
align = uc->target_page_align;
893893
pagesize = uc->target_page_size;
894894
len = MIN(size - count, (address & ~align) + pagesize - address);
895-
if (uc_vmem_translate(uc, address, prot, &paddr) != UC_ERR_OK) {
895+
if (uc_vmem_translate(uc, address, prot, &paddr) != UC_ERR_OK) {
896896
restore_jit_state(uc);
897897
return UC_ERR_WRITE_PROT;
898-
}
898+
}
899899
if (uc_mem_write(uc, paddr, bytes, len) != UC_ERR_OK) {
900900
restore_jit_state(uc);
901901
return UC_ERR_WRITE_PROT;
902902
}
903+
if (uc_ctl_remove_cache(uc, address, address + len) != UC_ERR_OK) {
904+
restore_jit_state(uc);
905+
return UC_ERR_WRITE_PROT;
906+
}
903907
bytes += len;
904908
address += len;
905909
count += len;

0 commit comments

Comments
 (0)