Move mem_xxx samples to regress. Add check to only flush tlb when unmapping if there is a current cpu

This commit is contained in:
Chris Eagle 2015-09-04 00:48:24 -07:00
parent 06481933e0
commit 8cfd902e4b
6 changed files with 10 additions and 8 deletions

View File

@ -49,10 +49,13 @@ void memory_unmap(struct uc_struct *uc, MemoryRegion *mr)
{ {
int i; int i;
target_ulong addr; target_ulong addr;
//make sure all pages associated with the MemoryRegion are flushed // Make sure all pages associated with the MemoryRegion are flushed
// Only need to do this if we are in a running state
if (uc->current_cpu) {
for (addr = mr->addr; addr < mr->end; addr += uc->target_page_size) { for (addr = mr->addr; addr < mr->end; addr += uc->target_page_size) {
tlb_flush_page(uc->current_cpu, addr); tlb_flush_page(uc->current_cpu, addr);
} }
}
mr->enabled = false; mr->enabled = false;
memory_region_del_subregion(get_system_memory(uc), mr); memory_region_del_subregion(get_system_memory(uc), mr);

View File

@ -7,6 +7,9 @@ TESTS += block_test
TESTS += ro_mem_test nr_mem_test TESTS += ro_mem_test nr_mem_test
TESTS += timeout_segfault TESTS += timeout_segfault
TESTS += rep_movsb TESTS += rep_movsb
TESTS += mem_unmap
TESTS += mem_protect
TESTS += mem_exec
all: $(TESTS) all: $(TESTS)

View File

@ -97,9 +97,6 @@ endif
ifneq (,$(findstring x86,$(UNICORN_ARCHS))) ifneq (,$(findstring x86,$(UNICORN_ARCHS)))
SOURCES += sample_x86.c SOURCES += sample_x86.c
SOURCES += shellcode.c SOURCES += shellcode.c
SOURCES += mem_unmap.c
SOURCES += mem_protect.c
SOURCES += mem_exec.c
endif endif
ifneq (,$(findstring m68k,$(UNICORN_ARCHS))) ifneq (,$(findstring m68k,$(UNICORN_ARCHS)))
SOURCES += sample_m68k.c SOURCES += sample_m68k.c
@ -114,8 +111,7 @@ all: $(BINARY)
clean: clean:
rm -rf *.o $(OBJS_ELF) $(BINARY) $(SAMPLEDIR)/*.exe $(SAMPLEDIR)/*.static $(OBJDIR)/lib$(LIBNAME)* $(OBJDIR)/$(LIBNAME)* rm -rf *.o $(OBJS_ELF) $(BINARY) $(SAMPLEDIR)/*.exe $(SAMPLEDIR)/*.static $(OBJDIR)/lib$(LIBNAME)* $(OBJDIR)/$(LIBNAME)*
rm -rf libunicorn*.so libunicorn*.lib libunicorn*.dylib unicorn*.dll unicorn*.lib rm -rf libunicorn*.so libunicorn*.lib libunicorn*.dylib unicorn*.dll unicorn*.lib
rm -rf sample_x86 sample_arm sample_arm64 sample_mips sample_sparc sample_ppc sample_m68k \ rm -rf sample_x86 sample_arm sample_arm64 sample_mips sample_sparc sample_ppc sample_m68k shellcode
shellcode mem_unmap mem_protect mem_exec
$(BINARY): $(OBJS) $(BINARY): $(OBJS)