📄 mpc8xx_hi.c
字号:
}
}
}
break;
case 0x1100:
printf(EXCEPT, exception, "Instruction TLB Miss");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1200:
printf(EXCEPT, exception, "Data TLB Miss");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1300:
printf(EXCEPT, exception, "Instruction TLB Error");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1400:
printf(EXCEPT, exception, "Data TLB Error");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1500:
case 0x1600:
case 0x1700:
case 0x1800:
case 0x1900:
case 0x1A00:
case 0x1B00:
printf(EXCEPT, exception, "Reserved");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1C00:
printf(EXCEPT, exception, "Data Breakpoint");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1D00:
printf(EXCEPT, exception, "Instruction Breakpoint");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1E00:
printf(EXCEPT, exception, "Peripheral Breakpoint");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x1F00:
printf(EXCEPT, exception, "Development Port");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
case 0x0FF00: /* cheat for exit to dbug prompt */
cpu_handler_flag = EXEC_DBUG;
printf("\n");
break;
default:
printf(EXCEPT, exception, "Unknown");
cpu_reg_display(NULL);
cpu_disasm(CPU_REG_SRR0, TRUE);
break;
}
if ((cpu_handler_flag == EXEC_DBUG) && cpu_step_over)
{
breakpoint_remove (cpu_step_over);
cpu_step_over = 0;
}
return cpu_handler_flag;
}
/*********************************************************************/
void
cpu_cache_flush (void)
{
/*
* This routine flushes the D-Cache using an MPC8XX specific
* implementation. This routine doesn't require knowing the
* exact size of memory, and instead flushes specific cache
* lines.
*/
int line;
/*
* Flash invalidate I-cache
*/
mpc8xx_wr_ic_cst(MPC8XX_IC_CST_CMD_DISABLE);
mpc8xx_wr_ic_cst(MPC8XX_IC_CST_CMD_UNLOCKALL);
mpc8xx_wr_ic_cst(MPC8XX_IC_CST_CMD_INVALIDATE);
/* mpc8xx_wr_ic_cst(MPC8XX_IC_CST_CMD_ENABLE);*/
mpc8xx_wr_dc_cst(MPC8XX_DC_CST_CMD_DISABLE);
mpc8xx_wr_dc_cst(MPC8XX_DC_CST_CMD_UNLOCKALL);
for (line = 0; line < (MPC8XX_DCACHE_SIZE/16); ++line)
{
mpc8xx_wr_dc_adr(line);
mpc8xx_wr_dc_cst(MPC8XX_DC_CST_CMD_FLUSHLINE);
}
mpc8xx_wr_dc_cst(MPC8XX_DC_CST_CMD_INVALIDATE);
}
/*********************************************************************/
#define REGREAD (1)
#define REGWRITE (0)
static const char FORMAT8[] = " %8s: %02X\n";
static const char FORMAT16[] = " %8s: %04X\n";
static const char FORMAT32[] = " %8s: %08X\n";
#define IRMD(MOD,REG,SIZE) \
if ((strcasecmp(#REG,reg) == 0) || display_all) \
{ \
if (regread) \
{ \
printf(FORMAT ## SIZE, #REG, \
imm-> MOD . REG ); \
pause(&displayed); \
} \
else \
imm-> MOD . REG = value; \
\
if (!display_all) \
return; \
}
static int display_all;
static int displayed;
/*********************************************************************/
#ifdef Mpc8xx_siu
static void
irmd_siu (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(siu, SIUMCR, 32)
IRMD(siu, SYPCR, 32)
#ifndef SWT
IRMD(siu, SWT, 32)
#endif
IRMD(siu, SWSR, 16)
IRMD(siu, SIPEND, 32)
IRMD(siu, SIMASK, 32)
IRMD(siu, SIEL, 32)
IRMD(siu, SIVEC, 32)
IRMD(siu, TESR, 32)
IRMD(siu, SDCR, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_pcmcia
static void
irmd_pcmcia (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(pcmcia, PBR0, 32)
IRMD(pcmcia, POR0, 32)
IRMD(pcmcia, PBR1, 32)
IRMD(pcmcia, POR1, 32)
IRMD(pcmcia, PBR2, 32)
IRMD(pcmcia, POR2, 32)
IRMD(pcmcia, PBR3, 32)
IRMD(pcmcia, POR3, 32)
IRMD(pcmcia, PBR4, 32)
IRMD(pcmcia, POR4, 32)
IRMD(pcmcia, PBR5, 32)
IRMD(pcmcia, POR5, 32)
IRMD(pcmcia, PBR6, 32)
IRMD(pcmcia, POR6, 32)
IRMD(pcmcia, PBR7, 32)
IRMD(pcmcia, POR7, 32)
#ifndef PGCRA
IRMD(pcmcia, PGCRA, 32)
#endif
IRMD(pcmcia, PGCRB, 32)
IRMD(pcmcia, PSCR, 32)
IRMD(pcmcia, PIPR, 32)
IRMD(pcmcia, PER, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_memc
static void
irmd_memc (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(memc, BR0, 32)
IRMD(memc, OR0, 32)
IRMD(memc, BR1, 32)
IRMD(memc, OR1, 32)
IRMD(memc, BR2, 32)
IRMD(memc, OR2, 32)
IRMD(memc, BR3, 32)
IRMD(memc, OR3, 32)
IRMD(memc, BR4, 32)
IRMD(memc, OR4, 32)
IRMD(memc, BR5, 32)
IRMD(memc, OR5, 32)
IRMD(memc, BR6, 32)
IRMD(memc, OR6, 32)
IRMD(memc, BR7, 32)
IRMD(memc, OR7, 32)
IRMD(memc, MAR, 32)
IRMD(memc, MCR, 32)
IRMD(memc, MAMR, 32)
IRMD(memc, MBMR, 32)
IRMD(memc, MSTAT, 16)
IRMD(memc, MPTPR, 16)
IRMD(memc, MDR, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_sit
static void
irmd_sit (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(sit, TBSCR, 16)
IRMD(sit, TBREFF0, 32)
IRMD(sit, TBREFF1, 32)
IRMD(sit, RTCSC, 16)
IRMD(sit, RTC, 32)
IRMD(sit, RTSEC, 32)
IRMD(sit, RTCAL, 32)
IRMD(sit, PISCR, 16)
IRMD(sit, PITC, 32)
IRMD(sit, PITR, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_clock
static void
irmd_clock (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(clock, SCCR, 32)
IRMD(clock, PLPRCR, 32)
IRMD(clock, RSR, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_sitkey
static void
irmd_sitkey (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(sitkey, TBSCRK, 32)
IRMD(sitkey, TBREFF0K, 32)
IRMD(sitkey, TBREFF1K, 32)
IRMD(sitkey, TBK, 32)
IRMD(sitkey, RTCSCK, 32)
IRMD(sitkey, RTSECK, 32)
IRMD(sitkey, RTCALK, 32)
IRMD(sitkey, PISCRK, 32)
IRMD(sitkey, PITCK, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_clockey
static void
irmd_clockey (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(clockey, SCCRK, 32)
IRMD(clockey, PLPRCRK, 32)
IRMD(clockey, RSRK, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_i2c
static void
irmd_i2c (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(i2c, I2MOD, 8)
IRMD(i2c, I2ADD, 8)
IRMD(i2c, I2BRG, 8)
IRMD(i2c, I2COM, 8)
IRMD(i2c, I2CER, 8)
IRMD(i2c, I2CMR, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_dma
static void
irmd_dma (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(dma, SDAR, 32)
IRMD(dma, SDSR, 8)
IRMD(dma, SDMR, 8)
IRMD(dma, IDSR1, 8)
IRMD(dma, IDMR1, 8)
IRMD(dma, IDSR2, 8)
IRMD(dma, IDMR2, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_cpic
static void
irmd_cpic (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(cpic, CIVR, 16)
IRMD(cpic, CICR, 32)
IRMD(cpic, CIPR, 32)
IRMD(cpic, CIMR, 32)
IRMD(cpic, CISR, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_portio
static void
irmd_portio (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(portio, PADIR, 16)
IRMD(portio, PAPAR, 16)
IRMD(portio, PAODR, 16)
IRMD(portio, PADAT, 16)
IRMD(portio, PCDIR, 16)
IRMD(portio, PCPAR, 16)
IRMD(portio, PCSO, 16)
IRMD(portio, PCDAT, 16)
IRMD(portio, PCINT, 16)
IRMD(portio, PDDIR, 16)
IRMD(portio, PDPAR, 16)
IRMD(portio, PDDAT, 16)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_cpmtimer
static void
irmd_cpmtimer (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(cpmtimer, TGCR, 16)
IRMD(cpmtimer, TMR1, 16)
IRMD(cpmtimer, TRR1, 16)
IRMD(cpmtimer, TCR1, 16)
IRMD(cpmtimer, TCN1, 16)
IRMD(cpmtimer, TMR2, 16)
IRMD(cpmtimer, TRR2, 16)
IRMD(cpmtimer, TCR2, 16)
IRMD(cpmtimer, TCN2, 16)
IRMD(cpmtimer, TMR3, 16)
IRMD(cpmtimer, TRR3, 16)
IRMD(cpmtimer, TCR3, 16)
IRMD(cpmtimer, TCN3, 16)
IRMD(cpmtimer, TMR4, 16)
IRMD(cpmtimer, TRR4, 16)
IRMD(cpmtimer, TCR4, 16)
IRMD(cpmtimer, TCN4, 16)
IRMD(cpmtimer, TER1, 16)
IRMD(cpmtimer, TER2, 16)
IRMD(cpmtimer, TER3, 16)
IRMD(cpmtimer, TER4, 16)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_cp
static void
irmd_cp (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(cp, CPCR, 16)
IRMD(cp, RCCR, 16)
IRMD(cp, CPMCR1, 16)
IRMD(cp, CPMCR2, 16)
IRMD(cp, CPMCR3, 16)
IRMD(cp, CPMCR4, 16)
IRMD(cp, RTER, 16)
IRMD(cp, RTMR, 16)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_brgs
static void
irmd_brgs (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(brgs, BRGC1, 32)
IRMD(brgs, BRGC2, 32)
#ifndef BRGC3
IRMD(brgs, BRGC3, 32)
#endif
#ifndef BRGC4
IRMD(brgs, BRGC4, 32)
#endif
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc1
static void
irmd_scc1 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc1, GSMR_L, 32)
IRMD(scc1, GSMR_H, 32)
IRMD(scc1, PSMR, 16)
IRMD(scc1, TODR, 16)
IRMD(scc1, DSR, 16)
IRMD(scc1, SCCE, 16)
IRMD(scc1, SCCM, 16)
IRMD(scc1, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc2
static void
irmd_scc2 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc2, GSMR_L, 32)
IRMD(scc2, GSMR_H, 32)
IRMD(scc2, PSMR, 16)
IRMD(scc2, TODR, 16)
IRMD(scc2, DSR, 16)
IRMD(scc2, SCCE, 16)
IRMD(scc2, SCCM, 16)
IRMD(scc2, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc3
static void
irmd_scc3 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc3, GSMR_L, 32)
IRMD(scc3, GSMR_H, 32)
IRMD(scc3, PSMR, 16)
IRMD(scc3, TODR, 16)
IRMD(scc3, DSR, 16)
IRMD(scc3, SCCE, 16)
IRMD(scc3, SCCM, 16)
IRMD(scc3, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc4
static void
irmd_scc4 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc4, GSMR_L, 32)
IRMD(scc4, GSMR_H, 32)
IRMD(scc4, PSMR, 16)
IRMD(scc4, TODR, 16)
IRMD(scc4, DSR, 16)
IRMD(scc4, SCCE, 16)
IRMD(scc4, SCCM, 16)
IRMD(scc4, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -