Skip to content

Fixes for PPC64 CPU emulation#2308

Merged
wtdcode merged 2 commits into
unicorn-engine:devfrom
kukrimate:ppc-fix
Jul 14, 2026
Merged

Fixes for PPC64 CPU emulation#2308
wtdcode merged 2 commits into
unicorn-engine:devfrom
kukrimate:ppc-fix

Conversation

@kukrimate

@kukrimate kukrimate commented Mar 10, 2026

Copy link
Copy Markdown

The default POWER10 1.0 was pointing to the correct place in the array, but for manually set indices we still need to append the same offset in order to set the correct CPU.

Additionally MSR.HV bit is not actually respected for CPUs that should support it.

@kukrimate kukrimate changed the title Fix setting PPC64 CPU model manually Fixes for PPC64 CPU emulation Mar 10, 2026
@wtdcode

wtdcode commented Jul 4, 2026

Copy link
Copy Markdown
Member

LGTM, but you should target dev.

The default POWER10 1.0 was pointing to the correct place in the array,
but for manually set indices we still need to append the same offset in
order to set the correct CPU.
Without this, PPC64 models with the HV bit do not work.

hreg_store_msr cannot set MSR.HV to 1 even if alter_hv = 1,
it just takes the value from the environment unless alter_hv = 1
*AND* MSR.HV was already set.

    if (!alter_hv || !(env->msr & MSR_HVB)) {
        value &= ~MSR_HVB;
        value |= env->msr & MSR_HVB;
    }
@kukrimate

Copy link
Copy Markdown
Author

@wtdcode Changed target and rebased.

@wtdcode wtdcode merged commit e04c16c into unicorn-engine:dev Jul 14, 2026
38 checks passed
@kukrimate kukrimate deleted the ppc-fix branch July 14, 2026 07:23
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.

2 participants