Skip to contentSkip to conversation

[6009] Fix smsw for x86_64 guest and bigendian host case

Qemu-devel malc 2 participants 3 messages Dec 13, 2008

lore
Share & tools
lore

malc

author
#0 lore raw

Revision: 6009

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6009
Author:   malc
Date:     2008-12-13 15:51:14 +0000 (Sat, 13 Dec 2008)

Log Message:
-----------
Fix smsw for x86_64 guest and bigendian host case

Modified Paths:
--------------
trunk/target-i386/translate.c

Modified: trunk/target-i386/translate.c
===================================================================

target-i386/translate.c +4 -0
@@ -7078,7 +7078,11 @@
             break;
         case 4: /* smsw */
             gen_svm_check_intercept(s, pc_start, SVM_EXIT_READ_CR0);
+#if defined TARGET_X86_64 && defined WORDS_BIGENDIAN
+            tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]) + 4);
+#else
             tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]));
+#endif
             gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 1);
             break;
         case 6: /* lmsw */
#1 lore raw

target-i386/translate.c line 7085

Quoted 5 lines · malc
target-i386/translate.c +4 -0
+#if defined TARGET_X86_64 && defined WORDS_BIGENDIAN
+            tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]) + 4);
+#else
             tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]));
+#endif

Hmm -- shouldn't REG_L_OFFSET be added instead of using #ifdefs?

Signature · 1 line
Stuart Brady
author
#2 lore raw
Quoted 8 lines · Stuart Brady

target-i386/translate.c line 7085

Quoted 5 lines · malc
target-i386/translate.c +4 -0
+#if defined TARGET_X86_64 && defined WORDS_BIGENDIAN
+            tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]) + 4);
+#else
             tcg_gen_ld32u_tl(cpu_T[0], cpu_env, offsetof(CPUX86State,cr[0]));
+#endif

Hmm -- shouldn't REG_L_OFFSET be added instead of using #ifdefs?

Probably not. This mixes GPRs with CRs, that said the core idea is sound.

Signature · 1 line
mailto:[email protected]