From dc011987f266878ad29009e4fdbc27f666ab31d2 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Sat, 7 Jul 2007 20:50:33 +0000 Subject: [PATCH] Use unsigned 32-bit load for ld/lduw git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3051 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-sparc/op_mem.h | 5 +++++ target-sparc/translate.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/target-sparc/op_mem.h b/target-sparc/op_mem.h index f5dbd2605f..a175d0d591 100644 --- a/target-sparc/op_mem.h +++ b/target-sparc/op_mem.h @@ -103,6 +103,11 @@ void OPPROTO glue(op_casx, MEMSUFFIX)(void) T2 = tmp; } +void OPPROTO glue(op_lduw, MEMSUFFIX)(void) +{ + T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff); +} + void OPPROTO glue(op_ldsw, MEMSUFFIX)(void) { T1 = (int64_t)(glue(ldl, MEMSUFFIX)(T0) & 0xffffffff); diff --git a/target-sparc/translate.c b/target-sparc/translate.c index a2f3d5bd34..074ed21fdd 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -470,6 +470,7 @@ OP_LD_TABLE(ldf); OP_LD_TABLE(lddf); #ifdef TARGET_SPARC64 +OP_LD_TABLE(lduw); OP_LD_TABLE(ldsw); OP_LD_TABLE(ldx); OP_LD_TABLE(stx); @@ -2810,7 +2811,11 @@ static void disas_sparc_insn(DisasContext * dc) (xop > 0x2c && xop <= 0x33) || xop == 0x1f || xop == 0x3d) { switch (xop) { case 0x0: /* load word */ +#ifndef TARGET_SPARC64 gen_op_ldst(ld); +#else + gen_op_ldst(lduw); +#endif break; case 0x1: /* load unsigned byte */ gen_op_ldst(ldub); @@ -2844,8 +2849,10 @@ static void disas_sparc_insn(DisasContext * dc) goto illegal_insn; if (!supervisor(dc)) goto priv_insn; -#endif gen_op_lda(insn, 1, 4, 0); +#else + gen_op_lduwa(insn, 1, 4, 0); +#endif break; case 0x11: /* load unsigned byte alternate */ #ifndef TARGET_SPARC64 @@ -2926,6 +2933,7 @@ static void disas_sparc_insn(DisasContext * dc) (void) &gen_op_ldfa; (void) &gen_op_lddfa; #else + (void) &gen_op_lda; #if !defined(CONFIG_USER_ONLY) (void) &gen_op_cas; (void) &gen_op_casx;