Line 22... |
Line 22... |
typedef unsigned long sprword;
|
typedef unsigned long sprword;
|
|
|
/* Prototypes */
|
/* Prototypes */
|
inline void mtspr(const int regno, const sprword value);
|
inline void mtspr(const int regno, const sprword value);
|
static inline sprword mfspr_(const int regno);
|
static inline sprword mfspr_(const int regno);
|
#ifdef DEBUGMOD_OFF
|
|
extern sprword sprs[MAX_SPRS];
|
extern sprword sprs[MAX_SPRS];
|
extern int cont_run; /* defined in toplevel.c */
|
|
#define mfspr(regno)\
|
|
((regno == SPR_SR && temp_disable_except > 0)?(sprs[regno] & ~SPR_SR_EXR)\
|
|
:((regno < MAX_SPRS)?(sprs[regno])\
|
|
:((printf("\nABORT: read out of SPR range %08X\n", regno),\
|
|
cont_run = 0))))
|
|
#else /* DEBUGMOD_OFF */
|
|
#define mfspr(regno) mfspr_(regno)
|
#define mfspr(regno) mfspr_(regno)
|
#endif /* DEBUGMOD_OFF */
|
|
|
|
static inline void setsprbit(const int regno, const int bitnum, const unsigned long bitvalue);
|
static inline void setsprbit(const int regno, const int bitnum, const unsigned long bitvalue);
|
static inline int getsprbit(const int regno, const int bitnum);
|
static inline int getsprbit(const int regno, const int bitnum);
|
void sprs_status();
|
void sprs_status();
|
|
|
#include "sim-config.h"
|
#include "sim-config.h"
|
|
#include "tick.h"
|
|
|
/* Ugly, but fast */
|
/* Ugly, but fast */
|
/* Get a specific SPR. */
|
/* Get a specific SPR. */
|
static inline sprword
|
static inline sprword
|
mfspr_(const int regno)
|
mfspr_(const int regno)
|
Line 55... |
Line 47... |
switch (regno) {
|
switch (regno) {
|
case SPR_NPC:
|
case SPR_NPC:
|
return pc;
|
return pc;
|
case SPR_PPC:
|
case SPR_PPC:
|
return pcprev;
|
return pcprev;
|
|
case SPR_TTCR:
|
|
return spr_read_ttcr();
|
default:
|
default:
|
/* Links to GPRS */
|
/* Links to GPRS */
|
if(regno >= 0x0400 && regno < 0x0420)
|
if(regno >= 0x0400 && regno < 0x0420)
|
return reg[regno - 0x0400];
|
return reg[regno - 0x0400];
|
else if (regno < MAX_SPRS)
|
else if (regno < MAX_SPRS)
|
Line 85... |
Line 79... |
v++;
|
v++;
|
}
|
}
|
|
|
/* printf("oldvalue %x setsprbits(%x, %x, %x) shifted %x", regvalue, regno, mask, value, shifted); */
|
/* printf("oldvalue %x setsprbits(%x, %x, %x) shifted %x", regvalue, regno, mask, value, shifted); */
|
mtspr(regno, (regvalue & ~mask) | shifted);
|
mtspr(regno, (regvalue & ~mask) | shifted);
|
|
|
return;
|
|
}
|
}
|
|
|
/* Get specific SPR bit(s) identified by mask. */
|
/* Get specific SPR bit(s) identified by mask. */
|
static inline unsigned long
|
static inline unsigned long
|
getsprbits(const int regno, const unsigned long mask)
|
getsprbits(const int regno, const unsigned long mask)
|