-
-
Notifications
You must be signed in to change notification settings - Fork 395
[EMU] Fix ABI issue in my_cpuid leaf detection #3394
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
base: main
Are you sure you want to change the base?
Conversation
|
Or is there a better way to write it? @ptitSeb @ksco @xiangzhai |
|
If RAX is used, then the tmp32u interface should be removed, because it will not be used. Also, this seems like an ABI issue there, because the C code is normal, and there is no undefined behaviour in this function as far as I can see it. In how many other palces (like function wrapping) this same issue is happening?!!! Also, can't an alernative be something like |
This prevents the high-order bits from being cleared to zero. |
|
It would be best to delete tmp32u! |
|
There would be some cleanup to do on each dynarec code also, to avoid copying RAX to 1st parameter, but I guess that can be done later. |
|
More simply, I suspect the issue might be because of the dynarec not cleaning up upper 32bits of rax, so maybe try to just add |
Right, follow-up task. |
Let me test it in later. |
The issue of clearing high-order bits to zero in Dyname doesn't exist, but I think it should be retained to avoid similar problems. I will write some tests to check if other branches have similar issues. |
I almost forgot, you previously suggested removing the RAX copy here. I can do all of this at once to avoid multiple PRs. |
|
I didn't follow this PR, but please remove LoongArch from the PR title and commit message. |
Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
Issue: #3369
This PR fixes the issue where numpy failed to load on LoongArch due to missing X86_V2 baseline features (specifically LAHF from leaf 0x80000001).
Even though tmp32u is uint32_t, on LoongArch it is passed in a 64-bit register with dirty high bits. The switch statement was compiling into a 64-bit comparison, causing the check for 0x80000001 to fail.
The tmp32u function interface is retained.
Current, NumPy imports successfully without error.(slowly)