Skip to content

[DYNAREC] Auto-initialize Zydis for dynarec dump in trace builds#4049

Open
Mikura-Kyouka wants to merge 1 commit into
ptitSeb:mainfrom
Mikura-Kyouka:autodump
Open

[DYNAREC] Auto-initialize Zydis for dynarec dump in trace builds#4049
Mikura-Kyouka wants to merge 1 commit into
ptitSeb:mainfrom
Mikura-Kyouka:autodump

Conversation

@Mikura-Kyouka

Copy link
Copy Markdown
Contributor

No description provided.

@ptitSeb

ptitSeb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Your change would make Zydis to initialize all the time, wich is something we do not want. It should initialize only when needed.

@ksco

ksco commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

wich is something we do not want.

Why?

@ptitSeb

ptitSeb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

wich is something we do not want.

Why?

We don't need to load stuffs we don't use. Why having more memory consumed for nothing?

@ksco

ksco commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Only if you enabled HAVE_TRACE when compiling, which non-devs should not enable.

@ptitSeb

ptitSeb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Still, I don't want lib loaded if we don't use it. Adding a check of dump or trace enable is easy enough, I don't see why we shouldn't keep the test.

@Mikura-Kyouka

Copy link
Copy Markdown
Contributor Author

My intention is that I think it is not intuitive to use BOX64_TRACE=0-1 to enable Zydis loading. Maybe a new option can be added for control, and the new option will be automatically turned on when BOX64_TRACE is on.

@ptitSeb

ptitSeb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

My intention is that I think it is not intuitive to use BOX64_TRACE=0-1 to enable Zydis loading. Maybe a new option can be added for control, and the new option will be automatically turned on when BOX64_TRACE is on.

I understand, and I aggree but I think there is a need for a env. var. option for that.

Comment thread src/emu/x64run.c
__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.


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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants