Skip to content

Got some time to play around? Here is a sample playground #1980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@ endif()
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_mem)
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_ctl)
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_ctl)
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_playground)

if(UNICORN_TRACER)
target_compile_options(unicorn-common PRIVATE -DUNICORN_TRACER)
Expand Down
1 change: 1 addition & 0 deletions samples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ UNICORN_ARCHS := $(shell if [ -e ../config.log ]; then cat ../config.log;\
else printf "$(UNICORN_ARCHS)"; fi)

SOURCES =
SOURCES += sample_playground.c
ifneq (,$(findstring arm,$(UNICORN_ARCHS)))
SOURCES += sample_arm.c
SOURCES += sample_armeb.c
Expand Down
12 changes: 6 additions & 6 deletions samples/sample_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void mmu_write_callback(uc_engine *uc, uc_mem_type type,
uint64_t address, int size, int64_t value,
void *user_data)
{
printf("write at 0x%lx: 0x%lx\n", address, value);
printf("write at 0x%" PRIx64 ": 0x%" PRIx64 "\n", address, value);
}

static void x86_mmu_prepare_tlb(uc_engine *uc, uint64_t vaddr,
Expand Down Expand Up @@ -280,16 +280,16 @@ void cpu_tlb(void)
printf("failed to read from child memory\n");
exit(1);
}
printf("parrent result == %lu\n", parrent);
printf("child result == %lu\n", child);
printf("parrent result == %" PRIu64 "\n", parrent);
printf("child result == %" PRIu64 "\n", child);
uc_close(uc);
}

static bool virtual_tlb_callback(uc_engine *uc, uint64_t addr, uc_mem_type type,
uc_tlb_entry *result, void *user_data)
{
bool *parrent_done = user_data;
printf("tlb lookup for address: 0x%lX\n", addr);
printf("tlb lookup for address: 0x%" PRIx64 "\n", addr);
switch (addr & ~(0xfff)) {
case 0x2000:
result->paddr = 0x0;
Expand Down Expand Up @@ -431,8 +431,8 @@ void virtual_tlb(void)
printf("failed to read from child memory\n");
exit(1);
}
printf("parrent result == %lu\n", parrent);
printf("child result == %lu\n", child);
printf("parrent result == %" PRIu64 "\n", parrent);
printf("child result == %" PRIu64 "\n", child);
uc_close(uc);
}

Expand Down
Loading
Loading