Skip to content
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
12 changes: 3 additions & 9 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,9 @@ static void addLibPaths(box64context_t* context)
static void setupZydis(box64context_t* context)
{
#ifdef HAVE_TRACE
if ((BOX64ENV(trace_init) && strcmp(BOX64ENV(trace_init), "0")) || (BOX64ENV(trace) && strcmp(BOX64ENV(trace), "0"))) {
context->x64trace = 1;
}
if (context->x64trace) {
printf_log(LOG_INFO, "Initializing Zydis lib\n");
if (InitX64Trace(context)) {
printf_log(LOG_INFO, "Zydis init failed. No x86 trace activated\n");
context->x64trace = 0;
}
printf_log(LOG_INFO, "Initializing Zydis lib\n");
if (InitX64Trace(context)) {
printf_log(LOG_INFO, "Zydis init failed. No x86 trace activated\n");
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/emu/x64run.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int Run(x64emu_t *emu, int step)
#if defined(HAVE_TRACE)
__builtin_prefetch((void*)addr, 0, 0);
emu->prev2_ip = emu->old_ip;
if(my_context->dec && IsTraceAddr(addr))
if(my_context->dec && BOX64ENV(trace) && strcmp(BOX64ENV(trace), "0") && IsTraceAddr(addr))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to avoid the use of strcmp in the main loop of the interpreter.

PrintTrace(emu, addr, 0);
#endif
emu->old_ip = addr;
Expand Down
1 change: 0 additions & 1 deletion src/include/box64context.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ typedef struct box64context_s {

path_collection_t box64_emulated_libs; // Collection of libs that should not be wrapped

int x64trace;

@ptitSeb ptitSeb Jul 16, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing this variable? you could use it instead to know when instruction trace is enabled (instead of when zydis is used for dump purpose for example)

int trace_tid;

zydis_t *zydis; // dlopen the zydis dissasembler
Expand Down
12 changes: 3 additions & 9 deletions src/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,9 @@ static void loadTest(const char** filepath, const char* include_path)
static void setupZydis(box64context_t* context)
{
#ifdef HAVE_TRACE
if ((BOX64ENV(trace_init) && strcmp(BOX64ENV(trace_init), "0")) || (BOX64ENV(trace) && strcmp(BOX64ENV(trace), "0"))) {
context->x64trace = 1;
}
if (context->x64trace) {
printf_log(LOG_INFO, "Initializing Zydis lib\n");
if (InitX64Trace(context)) {
printf_log(LOG_INFO, "Zydis init failed. No x86 trace activated\n");
context->x64trace = 0;
}
printf_log(LOG_INFO, "Initializing Zydis lib\n");
if (InitX64Trace(context)) {
printf_log(LOG_INFO, "Zydis init failed. No x86 trace activated\n");
}
#endif
}
Expand Down
Loading