mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-06-23 09:07:57 +00:00
target/i386: implement undocumented 'smsw r32' behavior
In 32-bit mode, the higher 16 bits of the destination register are undefined. In practice CR0[31:0] is stored, just like in 64-bit mode, so just remove the "if" that currently differentiates the behavior. Backports commit c0c8445255b2b5b440c355431c8b01b7b7b7c8cf from qemu
This commit is contained in:
parent
cf54c51869
commit
5b794349d3
|
@ -8116,12 +8116,13 @@ case 0x101:
|
||||||
CASE_MODRM_OP(4): /* smsw */
|
CASE_MODRM_OP(4): /* smsw */
|
||||||
gen_svm_check_intercept(s, pc_start, SVM_EXIT_READ_CR0);
|
gen_svm_check_intercept(s, pc_start, SVM_EXIT_READ_CR0);
|
||||||
tcg_gen_ld_tl(tcg_ctx, s->T0, cpu_env, offsetof(CPUX86State, cr[0]));
|
tcg_gen_ld_tl(tcg_ctx, s->T0, cpu_env, offsetof(CPUX86State, cr[0]));
|
||||||
if (CODE64(s)) {
|
/*
|
||||||
|
* In 32-bit mode, the higher 16 bits of the destination
|
||||||
|
* register are undefined. In practice CR0[31:0] is stored
|
||||||
|
* just like in 64-bit mode.
|
||||||
|
*/
|
||||||
mod = (modrm >> 6) & 3;
|
mod = (modrm >> 6) & 3;
|
||||||
ot = (mod != 3 ? MO_16 : s->dflag);
|
ot = (mod != 3 ? MO_16 : s->dflag);
|
||||||
} else {
|
|
||||||
ot = MO_16;
|
|
||||||
}
|
|
||||||
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1);
|
gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1);
|
||||||
break;
|
break;
|
||||||
case 0xee: /* rdpkru */
|
case 0xee: /* rdpkru */
|
||||||
|
|
Loading…
Reference in a new issue