Line 34... |
Line 34... |
int ofs = regno % MAX_SPRS_PER_GRP;
|
int ofs = regno % MAX_SPRS_PER_GRP;
|
|
|
regno /= MAX_SPRS_PER_GRP;
|
regno /= MAX_SPRS_PER_GRP;
|
regno += ofs;
|
regno += ofs;
|
|
|
if (regno < MAX_SPRS)
|
/* printf("mtspr(%x, %x)\n", regno, value);
|
|
*/ if (regno < MAX_SPRS)
|
sprs[regno] = value;
|
sprs[regno] = value;
|
else {
|
else {
|
printf("\nABORT: write out of SPR range\n");
|
printf("\nABORT: write out of SPR range\n");
|
cont_run = 0;
|
cont_run = 0;
|
}
|
}
|
Line 52... |
Line 53... |
int ofs = regno % MAX_SPRS_PER_GRP;
|
int ofs = regno % MAX_SPRS_PER_GRP;
|
|
|
regno /= MAX_SPRS_PER_GRP;
|
regno /= MAX_SPRS_PER_GRP;
|
regno += ofs;
|
regno += ofs;
|
|
|
if (regno < MAX_SPRS)
|
/* printf("mfspr(%x)%x\n", regno, sprs[regno]);
|
|
*/ if (regno < MAX_SPRS)
|
return sprs[regno];
|
return sprs[regno];
|
else {
|
else {
|
printf("\nABORT: read out of SPR range\n");
|
printf("\nABORT: read out of SPR range\n");
|
cont_run = 0;
|
cont_run = 0;
|
}
|
}
|
Line 83... |
Line 85... |
sprword regvalue = mfspr(regno);
|
sprword regvalue = mfspr(regno);
|
|
|
return (regvalue >> bitnum) & 0x1;
|
return (regvalue >> bitnum) & 0x1;
|
}
|
}
|
|
|
|
/* Set specific SPR bit(s) identified by mask. */
|
|
void setsprbits(int regno, unsigned long mask, unsigned long value)
|
|
{
|
|
sprword regvalue = mfspr(regno);
|
|
sprword shifted = 0x0;
|
|
int m, v = 0;
|
|
|
|
/* m counts bits in valuemask */
|
|
/* v counts bits in value */
|
|
for (m = 0; m < 32; m++)
|
|
if ((mask >> m) & 0x1) {
|
|
shifted |= ((value >> v) & 0x1) << m;
|
|
v++;
|
|
}
|
|
|
|
/* printf("oldvalue %x setsprbits(%x, %x, %x) shifted %x", regvalue, regno, mask, value, shifted); */
|
|
mtspr(regno, (regvalue & ~mask) | shifted);
|
|
|
|
return;
|
|
}
|
|
|
|
/* Get specific SPR bit(s) identified by mask. */
|
|
unsigned long getsprbits(int regno, unsigned long mask)
|
|
{
|
|
sprword regvalue = mfspr(regno);
|
|
sprword shifted = 0x0;
|
|
int m, v = 0;
|
|
|
|
/* m counts bits in valuemask */
|
|
/* v counts bits in regvalue */
|
|
for (m = 0; m < 32; m++)
|
|
if ((mask >> m) & 0x1) {
|
|
shifted |= ((regvalue >> m) & 0x1) << v;
|
|
v++;
|
|
}
|
|
|
|
return shifted;
|
|
}
|
|
|
/* Show status of important SPRs. */
|
/* Show status of important SPRs. */
|
void sprs_status()
|
void sprs_status()
|
{
|
{
|
printf("VR : 0x%.8x MPR : 0x%.8x\n", mfspr(SPR_VR), mfspr(SPR_MPR));
|
printf("VR : 0x%.8x MPR : 0x%.8x\n", mfspr(SPR_VR), mfspr(SPR_MPR));
|
printf("SR : 0x%.8x\n", mfspr(SPR_SR));
|
printf("SR : 0x%.8x\n", mfspr(SPR_SR));
|
printf("MACLO: 0x%.8x MACHI: 0x%.8x\n", mfspr(SPR_MACLO), mfspr(SPR_MACHI));
|
printf("MACLO: 0x%.8x MACHI: 0x%.8x\n", mfspr(SPR_MACLO), mfspr(SPR_MACHI));
|
printf("EPCR0: 0x%.8x EPCR1: 0x%.8x\n", mfspr(SPR_EPCR_BASE), mfspr(SPR_EPCR_BASE+1));
|
printf("EPCR0: 0x%.8x EPCR1: 0x%.8x\n", mfspr(SPR_EPCR_BASE), mfspr(SPR_EPCR_BASE+1));
|
printf("EEAR0: 0x%.8x EEAR1: 0x%.8x\n", mfspr(SPR_EEAR_BASE), mfspr(SPR_EEAR_BASE+1));
|
printf("EEAR0: 0x%.8x EEAR1: 0x%.8x\n", mfspr(SPR_EEAR_BASE), mfspr(SPR_EEAR_BASE+1));
|
|
printf("ESR0 : 0x%.8x ESR1 : 0x%.8x\n", mfspr(SPR_ESR_BASE), mfspr(SPR_ESR_BASE+1));
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|