/*---------------------------------------------------------------------------*/
/*-- Device registration hook -----------------------------------------------*/
/*---------------------------------------------------------------------------*/
-static device_init(SIM_DESC sd) {
+static void device_init(SIM_DESC sd) {
#ifdef DEVICE_INIT
extern void register_devices(SIM_DESC);
register_devices(sd);
#endif
}
+/* start-sanitize-sky */
+static struct {
+ short i[16];
+ int f[NUM_VU_REGS - 16];
+} vu_regs[2];
+/* end-sanitize-sky */
+
/*---------------------------------------------------------------------------*/
/*-- GDB simulator interface ------------------------------------------------*/
/*---------------------------------------------------------------------------*/
for( rn = LAST_EMBED_REGNUM+1; rn < NUM_REGS; rn++)
cpu->register_widths[rn] = 64;
/* end-sanitize-r5900 */
+
+ /* start-sanitize-sky */
+#ifdef TARGET_SKY
+ /* Now the VU registers */
+ for( rn = 0; rn < 16; rn++ ) { /* first the integer registers */
+ cpu->register_widths[rn + NUM_R5900_REGS] = 16;
+ cpu->register_widths[rn + NUM_R5900_REGS + NUM_VU_REGS] = 16;
+
+ /* Hack for now - to test gdb interface */
+ vu_regs[0].i[rn] = rn + 0x100;
+ vu_regs[1].i[rn] = rn + 0x200;
+ }
+
+ for( rn = 16; rn < NUM_VU_REGS; rn++ ) { /* then the FP registers */
+ float f;
+
+ cpu->register_widths[rn + NUM_R5900_REGS] = 32;
+ cpu->register_widths[rn + NUM_R5900_REGS + NUM_VU_REGS] = 32;
+
+ /* Hack for now - to test gdb interface */
+ if( rn < 24 ) {
+ f = rn - 16 + 100.0;
+ vu_regs[0].f[rn-16] = *((unsigned *) &f);
+ f = rn - 16 + 200.0;
+ vu_regs[1].f[rn-16] = *((unsigned *) &f);
+ }
+ else {
+ f = (rn - 24)/4 + (rn - 24)%4 + 1000.0;
+ vu_regs[0].f[rn-16] = *((unsigned *) &f);
+ f = (rn - 24)/4 + (rn - 24)%4 + 2000.0;
+ vu_regs[1].f[rn-16] = *((unsigned *) &f);
+ }
+ }
+#endif
+ /* end-sanitize-sky */
}
#if defined(TRACE)
if (cpu->register_widths[rn] == 0)
sim_io_eprintf(sd,"Invalid register width for %d (register store ignored)\n",rn);
+ /* start-sanitize-sky */
+#ifdef TARGET_SKY
+ else if( rn > NUM_R5900_REGS ) {
+ rn = rn - NUM_R5900_REGS;
+
+ if( rn < 16 )
+ vu_regs[0].i[rn] = T2H_2( *(unsigned short *) memory );
+ else if( rn < NUM_VU_REGS )
+ vu_regs[0].f[rn - 16] = T2H_4( *(unsigned int *) memory );
+ else {
+ rn = rn - NUM_VU_REGS;
+
+ if( rn < 16 )
+ vu_regs[1].i[rn] = T2H_2( *(unsigned short *) memory );
+ else if( rn < NUM_VU_REGS )
+ vu_regs[1].f[rn - 16] = T2H_4( *(unsigned int *) memory );
+ else
+ sim_io_eprintf( sd, "Invalid VU register (register store ignored)\n" );
+ }
+ }
+#endif
+ /* end-sanitize-sky */
/* start-sanitize-r5900 */
else if (rn == REGISTER_SA)
SA = T2H_8(*(unsigned64*)memory);
if (cpu->register_widths[rn] == 0)
sim_io_eprintf(sd,"Invalid register width for %d (register fetch ignored)\n",rn);
+ /* start-sanitize-sky */
+#ifdef TARGET_SKY
+ else if( rn > NUM_R5900_REGS ) {
+ rn = rn - NUM_R5900_REGS;
+
+ if( rn < 16 )
+ *((unsigned short *) memory) = H2T_2( vu_regs[0].i[rn] );
+ else if( rn < NUM_VU_REGS )
+ *((unsigned int *) memory) = H2T_4( vu_regs[0].f[rn - 16] );
+ else {
+ rn = rn - NUM_VU_REGS;
+
+ if( rn < 16 )
+ (*(unsigned short *) memory) = H2T_2( vu_regs[1].i[rn] );
+ else if( rn < NUM_VU_REGS )
+ (*(unsigned int *) memory) = H2T_4( vu_regs[1].f[rn - 16] );
+ else
+ sim_io_eprintf( sd, "Invalid VU register (register fetch ignored)\n" );
+ }
+ }
+#endif
+ /* end-sanitize-sky */
/* start-sanitize-r5900 */
else if (rn == REGISTER_SA)
*((unsigned64*)memory) = H2T_8(SA);