Avoid updating CR3 when writing CR1 and CR2

This commit is contained in:
elicn
2024-09-28 22:11:54 +03:00
parent 433bb163d9
commit 6cb9bfe5c0

View File

@@ -1156,6 +1156,8 @@ uc_err reg_write(void *_env, int mode, unsigned int regid, const void *value,
goto write_cr;
case UC_X86_REG_CR1:
case UC_X86_REG_CR2:
CHECK_REG_TYPE(uint32_t);
goto write_cr;
case UC_X86_REG_CR3:
CHECK_REG_TYPE(uint32_t);
cpu_x86_update_cr3(env, *(uint32_t *)value);
@@ -1396,6 +1398,8 @@ uc_err reg_write(void *_env, int mode, unsigned int regid, const void *value,
goto write_cr64;
case UC_X86_REG_CR1:
case UC_X86_REG_CR2:
CHECK_REG_TYPE(uint64_t);
goto write_cr64;
case UC_X86_REG_CR3:
CHECK_REG_TYPE(uint64_t);
cpu_x86_update_cr3(env, *(uint32_t *)value);