Line 24... |
Line 24... |
#include "arch.h"
|
#include "arch.h"
|
#include "sprs.h"
|
#include "sprs.h"
|
|
|
extern int cont_run; /* defined in toplevel.c */
|
extern int cont_run; /* defined in toplevel.c */
|
extern int tt_stopped; /* defined in tick.c */
|
extern int tt_stopped; /* defined in tick.c */
|
|
extern int GlobalMode; /* CZ 21/06/01 */
|
|
|
static sprword sprs[MAX_SPRS];
|
static sprword sprs[MAX_SPRS];
|
|
|
int temp_disable_except = 0;
|
int temp_disable_except = 0;
|
int audio_cnt = 0;
|
int audio_cnt = 0;
|
Line 64... |
Line 65... |
break;
|
break;
|
case 0x1234:
|
case 0x1234:
|
printf("MTSPR(0x1234, %x);\n", value);
|
printf("MTSPR(0x1234, %x);\n", value);
|
break;
|
break;
|
}
|
}
|
|
|
|
/* What the hell is happening here? This looks like a bug
|
|
waiting to happen. Assume regno = 2*MAX_SPRS_PER_GRP+3,
|
|
which presumably means I want to set register 3 in
|
|
group 2. Instead, I calculate ofs as 3, and regno as
|
|
2, and get a final value of 5??? Is this correct?
|
|
Oh well...I didn't write this. Who knows what it is
|
|
actually supposed to do. It doesn't matter if regno
|
|
is less than MAX_SPRS_PER_GRP, which is the only
|
|
way I use it. CZ - 21/06/01
|
|
*/
|
|
|
regno /= MAX_SPRS_PER_GRP;
|
regno /= MAX_SPRS_PER_GRP;
|
regno += ofs;
|
regno += ofs;
|
|
|
|
/* CZ 21/06/01 ... the debugger wants to do this! */
|
|
if(GlobalMode)
|
|
{
|
|
extern unsigned long pc;
|
|
|
|
if(regno == SPR_PC)
|
|
{
|
|
sprs[SPR_PC] = value;
|
|
#if 0
|
|
/* There is currently a problem with symbol tables by
|
|
gdb. It doesn't properly set up the CPU. We'll ignore
|
|
this for now. */
|
|
pc = value;
|
|
pc_phy = simulate_ic_mmu_fetch(pc);
|
|
pcnext = pc+4;
|
|
#endif
|
|
return;
|
|
}
|
|
}
|
|
|
/* printf("mtspr(%x, %x)\n", regno, value);
|
/* printf("mtspr(%x, %x)\n", regno, value);
|
*/ if (regno < MAX_SPRS)
|
*/ 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");
|
Line 84... |
Line 117... |
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;
|
|
|
|
/* CZ 21/06/01 ... the debugger wants to do this! */
|
|
if(GlobalMode)
|
|
{
|
|
extern unsigned long pc;
|
|
|
|
if(regno == SPR_PC)
|
|
return pc;
|
|
}
|
|
|
/* MM: l.rfe, for example, temporarly disables
|
/* MM: l.rfe, for example, temporarly disables
|
exceptions. We will make it appear as SR bit
|
exceptions. We will make it appear as SR bit
|
is set. */
|
is set. */
|
if (regno == SPR_SR && temp_disable_except > 0)
|
if (regno == SPR_SR && temp_disable_except > 0)
|
return sprs[regno] | SPR_SR_EXR;
|
return sprs[regno] | SPR_SR_EXR;
|