Commit ef0d51af1e5b7f29bfb72f0bf5f528c272c277a8
1 parent
1addc7c5
target-ppc: convert PPC 440 instructions to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5836 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
26 additions
and
36 deletions
target-ppc/helper.h
@@ -170,4 +170,6 @@ DEF_HELPER_1(load_74xx_tlbi, void, tl) | @@ -170,4 +170,6 @@ DEF_HELPER_1(load_74xx_tlbi, void, tl) | ||
170 | DEF_HELPER_1(602_mfrom, tl, tl) | 170 | DEF_HELPER_1(602_mfrom, tl, tl) |
171 | #endif | 171 | #endif |
172 | 172 | ||
173 | +DEF_HELPER_3(dlmzb, tl, tl, tl, i32) | ||
174 | + | ||
173 | #include "def-helper.h" | 175 | #include "def-helper.h" |
target-ppc/op.c
@@ -706,23 +706,6 @@ void OPPROTO op_4xx_tlbwe_hi (void) | @@ -706,23 +706,6 @@ void OPPROTO op_4xx_tlbwe_hi (void) | ||
706 | 706 | ||
707 | /* SPR micro-ops */ | 707 | /* SPR micro-ops */ |
708 | /* 440 specific */ | 708 | /* 440 specific */ |
709 | -void OPPROTO op_440_dlmzb (void) | ||
710 | -{ | ||
711 | - do_440_dlmzb(); | ||
712 | - RETURN(); | ||
713 | -} | ||
714 | - | ||
715 | -void OPPROTO op_440_dlmzb_update_Rc (void) | ||
716 | -{ | ||
717 | - if (T0 == 8) | ||
718 | - T0 = 0x2; | ||
719 | - else if (T0 < 4) | ||
720 | - T0 = 0x4; | ||
721 | - else | ||
722 | - T0 = 0x8; | ||
723 | - RETURN(); | ||
724 | -} | ||
725 | - | ||
726 | #if !defined(CONFIG_USER_ONLY) | 709 | #if !defined(CONFIG_USER_ONLY) |
727 | void OPPROTO op_store_pir (void) | 710 | void OPPROTO op_store_pir (void) |
728 | { | 711 | { |
target-ppc/op_helper.c
@@ -1999,24 +1999,39 @@ void do_store_403_pb (int num) | @@ -1999,24 +1999,39 @@ void do_store_403_pb (int num) | ||
1999 | #endif | 1999 | #endif |
2000 | 2000 | ||
2001 | /* 440 specific */ | 2001 | /* 440 specific */ |
2002 | -void do_440_dlmzb (void) | 2002 | +target_ulong helper_dlmzb (target_ulong high, target_ulong low, uint32_t update_Rc) |
2003 | { | 2003 | { |
2004 | target_ulong mask; | 2004 | target_ulong mask; |
2005 | int i; | 2005 | int i; |
2006 | 2006 | ||
2007 | i = 1; | 2007 | i = 1; |
2008 | for (mask = 0xFF000000; mask != 0; mask = mask >> 8) { | 2008 | for (mask = 0xFF000000; mask != 0; mask = mask >> 8) { |
2009 | - if ((T0 & mask) == 0) | 2009 | + if ((high & mask) == 0) { |
2010 | + if (update_Rc) { | ||
2011 | + env->crf[0] = 0x4; | ||
2012 | + } | ||
2010 | goto done; | 2013 | goto done; |
2014 | + } | ||
2011 | i++; | 2015 | i++; |
2012 | } | 2016 | } |
2013 | for (mask = 0xFF000000; mask != 0; mask = mask >> 8) { | 2017 | for (mask = 0xFF000000; mask != 0; mask = mask >> 8) { |
2014 | - if ((T1 & mask) == 0) | ||
2015 | - break; | 2018 | + if ((low & mask) == 0) { |
2019 | + if (update_Rc) { | ||
2020 | + env->crf[0] = 0x8; | ||
2021 | + } | ||
2022 | + goto done; | ||
2023 | + } | ||
2016 | i++; | 2024 | i++; |
2017 | } | 2025 | } |
2026 | + if (update_Rc) { | ||
2027 | + env->crf[0] = 0x2; | ||
2028 | + } | ||
2018 | done: | 2029 | done: |
2019 | - T0 = i; | 2030 | + env->xer = (env->xer & ~0x7F) | i; |
2031 | + if (update_Rc) { | ||
2032 | + env->crf[0] |= xer_so; | ||
2033 | + } | ||
2034 | + return i; | ||
2020 | } | 2035 | } |
2021 | 2036 | ||
2022 | /*****************************************************************************/ | 2037 | /*****************************************************************************/ |
target-ppc/op_helper.h
@@ -63,9 +63,6 @@ void do_4xx_tlbwe_lo (void); | @@ -63,9 +63,6 @@ void do_4xx_tlbwe_lo (void); | ||
63 | void do_4xx_tlbwe_hi (void); | 63 | void do_4xx_tlbwe_hi (void); |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | -/* PowerPC 440 specific helpers */ | ||
67 | -void do_440_dlmzb (void); | ||
68 | - | ||
69 | /* PowerPC 403 specific helpers */ | 66 | /* PowerPC 403 specific helpers */ |
70 | #if !defined(CONFIG_USER_ONLY) | 67 | #if !defined(CONFIG_USER_ONLY) |
71 | void do_load_403_pb (int num); | 68 | void do_load_403_pb (int num); |
target-ppc/translate.c
@@ -5747,17 +5747,10 @@ GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_WRTEE) | @@ -5747,17 +5747,10 @@ GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_WRTEE) | ||
5747 | /* dlmzb */ | 5747 | /* dlmzb */ |
5748 | GEN_HANDLER(dlmzb, 0x1F, 0x0E, 0x02, 0x00000000, PPC_440_SPEC) | 5748 | GEN_HANDLER(dlmzb, 0x1F, 0x0E, 0x02, 0x00000000, PPC_440_SPEC) |
5749 | { | 5749 | { |
5750 | - tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); | ||
5751 | - tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); | ||
5752 | - gen_op_440_dlmzb(); | ||
5753 | - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); | ||
5754 | - tcg_gen_andi_tl(cpu_xer, cpu_xer, ~0x7F); | ||
5755 | - tcg_gen_or_tl(cpu_xer, cpu_xer, cpu_T[0]); | ||
5756 | - if (Rc(ctx->opcode)) { | ||
5757 | - gen_op_440_dlmzb_update_Rc(); | ||
5758 | - tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_T[0]); | ||
5759 | - tcg_gen_andi_i32(cpu_crf[0], cpu_crf[0], 0xf); | ||
5760 | - } | 5750 | + TCGv_i32 t0 = tcg_const_i32(Rc(ctx->opcode)); |
5751 | + gen_helper_dlmzb(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], | ||
5752 | + cpu_gpr[rB(ctx->opcode)], t0); | ||
5753 | + tcg_temp_free_i32(t0); | ||
5761 | } | 5754 | } |
5762 | 5755 | ||
5763 | /* mbar replaces eieio on 440 */ | 5756 | /* mbar replaces eieio on 440 */ |