[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [5893] target-ppc: convert dcr load/store to TCG
From: |
Aurelien Jarno |
Subject: |
[Qemu-devel] [5893] target-ppc: convert dcr load/store to TCG |
Date: |
Sat, 06 Dec 2008 16:37:19 +0000 |
Revision: 5893
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5893
Author: aurel32
Date: 2008-12-06 16:37:18 +0000 (Sat, 06 Dec 2008)
Log Message:
-----------
target-ppc: convert dcr load/store to TCG
Signed-off-by: Aurelien Jarno <address@hidden>
Modified Paths:
--------------
trunk/target-ppc/helper.h
trunk/target-ppc/op.c
trunk/target-ppc/op_helper.c
trunk/target-ppc/op_helper.h
trunk/target-ppc/translate.c
Modified: trunk/target-ppc/helper.h
===================================================================
--- trunk/target-ppc/helper.h 2008-12-06 13:03:35 UTC (rev 5892)
+++ trunk/target-ppc/helper.h 2008-12-06 16:37:18 UTC (rev 5893)
@@ -181,4 +181,7 @@
DEF_HELPER_2(divs, tl, tl, tl)
DEF_HELPER_2(divso, tl, tl, tl)
+DEF_HELPER_1(load_dcr, tl, tl);
+DEF_HELPER_2(store_dcr, void, tl, tl);
+
#include "def-helper.h"
Modified: trunk/target-ppc/op.c
===================================================================
--- trunk/target-ppc/op.c 2008-12-06 13:03:35 UTC (rev 5892)
+++ trunk/target-ppc/op.c 2008-12-06 16:37:18 UTC (rev 5893)
@@ -349,18 +349,6 @@
#endif
/* PowerPC 4xx specific micro-ops */
-void OPPROTO op_load_dcr (void)
-{
- do_load_dcr();
- RETURN();
-}
-
-void OPPROTO op_store_dcr (void)
-{
- do_store_dcr();
- RETURN();
-}
-
#if !defined(CONFIG_USER_ONLY)
void OPPROTO op_440_tlbre (void)
{
Modified: trunk/target-ppc/op_helper.c
===================================================================
--- trunk/target-ppc/op_helper.c 2008-12-06 13:03:35 UTC (rev 5892)
+++ trunk/target-ppc/op_helper.c 2008-12-06 16:37:18 UTC (rev 5893)
@@ -1756,9 +1756,9 @@
/* Embedded PowerPC specific helpers */
/* XXX: to be improved to check access rights when in user-mode */
-void do_load_dcr (void)
+target_ulong helper_load_dcr (target_ulong dcrn)
{
- target_ulong val;
+ target_ulong val = 0;
if (unlikely(env->dcr_env == NULL)) {
if (loglevel != 0) {
@@ -1766,18 +1766,17 @@
}
raise_exception_err(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL);
- } else if (unlikely(ppc_dcr_read(env->dcr_env, T0, &val) != 0)) {
+ } else if (unlikely(ppc_dcr_read(env->dcr_env, dcrn, &val) != 0)) {
if (loglevel != 0) {
fprintf(logfile, "DCR read error %d %03x\n", (int)T0, (int)T0);
}
raise_exception_err(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL | POWERPC_EXCP_PRIV_REG);
- } else {
- T0 = val;
}
+ return val;
}
-void do_store_dcr (void)
+void helper_store_dcr (target_ulong dcrn, target_ulong val)
{
if (unlikely(env->dcr_env == NULL)) {
if (loglevel != 0) {
@@ -1785,7 +1784,7 @@
}
raise_exception_err(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL);
- } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) {
+ } else if (unlikely(ppc_dcr_write(env->dcr_env, dcrn, val) != 0)) {
if (loglevel != 0) {
fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0);
}
Modified: trunk/target-ppc/op_helper.h
===================================================================
--- trunk/target-ppc/op_helper.h 2008-12-06 13:03:35 UTC (rev 5892)
+++ trunk/target-ppc/op_helper.h 2008-12-06 16:37:18 UTC (rev 5893)
@@ -41,8 +41,6 @@
#endif
/* PowerPC 4xx specific helpers */
-void do_load_dcr (void);
-void do_store_dcr (void);
#if !defined(CONFIG_USER_ONLY)
void do_4xx_tlbre_lo (void);
void do_4xx_tlbre_hi (void);
Modified: trunk/target-ppc/translate.c
===================================================================
--- trunk/target-ppc/translate.c 2008-12-06 13:03:35 UTC (rev 5892)
+++ trunk/target-ppc/translate.c 2008-12-06 16:37:18 UTC (rev 5893)
@@ -5625,15 +5625,16 @@
#if defined(CONFIG_USER_ONLY)
GEN_EXCP_PRIVREG(ctx);
#else
- uint32_t dcrn = SPR(ctx->opcode);
-
+ TCGv dcrn;
if (unlikely(!ctx->supervisor)) {
GEN_EXCP_PRIVREG(ctx);
return;
}
- tcg_gen_movi_tl(cpu_T[0], dcrn);
- gen_op_load_dcr();
- tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
+ /* NIP cannot be restored if the memory exception comes from an helper */
+ gen_update_nip(ctx, ctx->nip - 4);
+ dcrn = tcg_const_tl(SPR(ctx->opcode));
+ gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], dcrn);
+ tcg_temp_free(dcrn);
#endif
}
@@ -5643,15 +5644,16 @@
#if defined(CONFIG_USER_ONLY)
GEN_EXCP_PRIVREG(ctx);
#else
- uint32_t dcrn = SPR(ctx->opcode);
-
+ TCGv dcrn;
if (unlikely(!ctx->supervisor)) {
GEN_EXCP_PRIVREG(ctx);
return;
}
- tcg_gen_movi_tl(cpu_T[0], dcrn);
- tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
- gen_op_store_dcr();
+ /* NIP cannot be restored if the memory exception comes from an helper */
+ gen_update_nip(ctx, ctx->nip - 4);
+ dcrn = tcg_const_tl(SPR(ctx->opcode));
+ gen_helper_store_dcr(dcrn, cpu_gpr[rS(ctx->opcode)]);
+ tcg_temp_free(dcrn);
#endif
}
@@ -5666,9 +5668,9 @@
GEN_EXCP_PRIVREG(ctx);
return;
}
- tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
- gen_op_load_dcr();
- tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
+ /* NIP cannot be restored if the memory exception comes from an helper */
+ gen_update_nip(ctx, ctx->nip - 4);
+ gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
/* Note: Rc update flag set leads to undefined state of Rc0 */
#endif
}
@@ -5684,9 +5686,9 @@
GEN_EXCP_PRIVREG(ctx);
return;
}
- tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
- tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
- gen_op_store_dcr();
+ /* NIP cannot be restored if the memory exception comes from an helper */
+ gen_update_nip(ctx, ctx->nip - 4);
+ gen_helper_store_dcr(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]);
/* Note: Rc update flag set leads to undefined state of Rc0 */
#endif
}
@@ -5694,18 +5696,18 @@
/* mfdcrux (PPC 460) : user-mode access to DCR */
GEN_HANDLER(mfdcrux, 0x1F, 0x03, 0x09, 0x00000000, PPC_DCRUX)
{
- tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
- gen_op_load_dcr();
- tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
+ /* NIP cannot be restored if the memory exception comes from an helper */
+ gen_update_nip(ctx, ctx->nip - 4);
+ gen_helper_load_dcr(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
/* Note: Rc update flag set leads to undefined state of Rc0 */
}
/* mtdcrux (PPC 460) : user-mode access to DCR */
GEN_HANDLER(mtdcrux, 0x1F, 0x03, 0x0D, 0x00000000, PPC_DCRUX)
{
- tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
- tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
- gen_op_store_dcr();
+ /* NIP cannot be restored if the memory exception comes from an helper */
+ gen_update_nip(ctx, ctx->nip - 4);
+ gen_helper_store_dcr(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]);
/* Note: Rc update flag set leads to undefined state of Rc0 */
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [5893] target-ppc: convert dcr load/store to TCG,
Aurelien Jarno <=