Embedded PowerPC Device Control Registers infrastructure.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2653 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
j_mayer 2007-04-12 21:11:03 +00:00
parent 83b1fb88f8
commit 2e719ba347
4 changed files with 117 additions and 7 deletions

View file

@ -730,8 +730,6 @@ struct CPUPPCState {
/* Time base and decrementer */
ppc_tb_t *tb_env;
/* Device control registers */
int (*dcr_read)(ppc_dcr_t *dcr_env, int dcr_num, target_ulong *val);
int (*dcr_write)(ppc_dcr_t *dcr_env, int dcr_num, target_ulong val);
ppc_dcr_t *dcr_env;
/* PowerPC TLB registers (for 4xx and 60x software driven TLBs) */
@ -863,6 +861,10 @@ void store_booke_tsr (CPUPPCState *env, target_ulong val);
#endif
#endif
/* Device control registers */
int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, target_ulong *valp);
int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val);
#define TARGET_PAGE_BITS 12
#include "cpu-all.h"

View file

@ -1249,20 +1249,26 @@ void do_load_dcr (void)
{
target_ulong val;
if (unlikely(env->dcr_read == NULL))
if (unlikely(env->dcr_env == NULL)) {
printf("No DCR environment\n");
do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL);
else if (unlikely((*env->dcr_read)(env->dcr_env, T0, &val) != 0))
} else if (unlikely(ppc_dcr_read(env->dcr_env, T0, &val) != 0)) {
printf("DCR read error\n");
do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG);
else
} else {
T0 = val;
}
}
void do_store_dcr (void)
{
if (unlikely(env->dcr_write == NULL))
if (unlikely(env->dcr_env == NULL)) {
printf("No DCR environment\n");
do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL);
else if (unlikely((*env->dcr_write)(env->dcr_env, T0, T1) != 0))
} else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) {
printf("DCR write error\n");
do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG);
}
}
void do_load_403_pb (int num)