This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sim/sh whitespace cleanup



Committed.


Index: gencode.c
===================================================================
RCS file: /cvs/src/src/sim/sh/gencode.c,v
retrieving revision 1.23
diff -p -r1.23 gencode.c
*** gencode.c	9 Jan 2004 19:44:50 -0000	1.23
--- gencode.c	10 Jan 2004 00:12:05 -0000
*************** op tab[] =
*** 49,55 ****
  {
  
    { "n", "", "add #<imm>,<REG_N>", "0111nnnni8*1....",
!     "R[n] += SEXT(i);",
      "if (i == 0) {",
      "  UNDEF(n); /* see #ifdef PARANOID */",
      "  break;",
--- 49,55 ----
  {
  
    { "n", "", "add #<imm>,<REG_N>", "0111nnnni8*1....",
!     "R[n] += SEXT (i);",
      "if (i == 0) {",
      "  UNDEF(n); /* see #ifdef PARANOID */",
      "  break;",
*************** op tab[] =
*** 85,91 ****
  
    { "", "", "bf <bdisp8>", "10001011i8p1....",
      "if (!T) {",
!     "  SET_NIP (PC + 4 + (SEXT(i) * 2));",
      "  cycles += 2;",
      "}",
    },
--- 85,91 ----
  
    { "", "", "bf <bdisp8>", "10001011i8p1....",
      "if (!T) {",
!     "  SET_NIP (PC + 4 + (SEXT (i) * 2));",
      "  cycles += 2;",
      "}",
    },
*************** op tab[] =
*** 235,241 ****
    /* sh2e */
    { "", "", "fabs <FREG_N>", "1111nnnn01011101",
      "FP_UNARY (n, fabs);",
!     "/* FIXME: FR(n) &= 0x7fffffff; */",
    },
  
    /* sh2e */
--- 235,241 ----
    /* sh2e */
    { "", "", "fabs <FREG_N>", "1111nnnn01011101",
      "FP_UNARY (n, fabs);",
!     "/* FIXME: FR (n) &= 0x7fffffff; */",
    },
  
    /* sh2e */
*************** op tab[] =
*** 263,269 ****
      "    int i;",
      "    float f;",
      "  } u;",
!     "  u.f = DR(n);",
      "  FPUL = u.i;",
      "}",
    },
--- 263,269 ----
      "    int i;",
      "    float f;",
      "  } u;",
!     "  u.f = DR (n);",
      "  FPUL = u.i;",
      "}",
    },
*************** op tab[] =
*** 280,286 ****
      "    float f;",
      "  } u;",
      "  u.i = FPUL;",
!     "  SET_DR(n, u.f);",
      "}",
    },
  
--- 280,286 ----
      "    float f;",
      "  } u;",
      "  u.i = FPUL;",
!     "  SET_DR (n, u.f);",
      "}",
    },
  
*************** op tab[] =
*** 308,320 ****
  
    /* sh2e */
    { "", "", "fldi0 <FREG_N>", "1111nnnn10001101",
!     "SET_FR (n, (float)0.0);",
      "/* FIXME: check for DP and (n & 1) == 0? */",
    },
  
    /* sh2e */
    { "", "", "fldi1 <FREG_N>", "1111nnnn10011101",
!     "SET_FR (n, (float)1.0);",
      "/* FIXME: check for DP and (n & 1) == 0? */",
    },
  
--- 308,320 ----
  
    /* sh2e */
    { "", "", "fldi0 <FREG_N>", "1111nnnn10001101",
!     "SET_FR (n, (float) 0.0);",
      "/* FIXME: check for DP and (n & 1) == 0? */",
    },
  
    /* sh2e */
    { "", "", "fldi1 <FREG_N>", "1111nnnn10011101",
!     "SET_FR (n, (float) 1.0);",
      "/* FIXME: check for DP and (n & 1) == 0? */",
    },
  
*************** op tab[] =
*** 325,331 ****
      "    int i;",
      "    float f;",
      "  } u;",
!     "  u.f = FR(n);",
      "  FPUL = u.i;",
    },
  
--- 325,331 ----
      "    int i;",
      "    float f;",
      "  } u;",
!     "  u.f = FR (n);",
      "  FPUL = u.i;",
    },
  
*************** op tab[] =
*** 333,348 ****
    { "", "", "float FPUL,<FREG_N>", "1111nnnn00101101",
      /* sh4 */
      "if (FPSCR_PR)",
!     "  SET_DR (n, (double)FPUL);",
      "else",
      "{",
!     "  SET_FR (n, (float)FPUL);",
      "}",
    },
  
    /* sh2e */
    { "", "", "fmac <FREG_0>,<FREG_M>,<FREG_N>", "1111nnnnmmmm1110",
!     "SET_FR (n, FR(m) * FR(0) + FR(n));",
      "/* FIXME: check for DP and (n & 1) == 0? */",
    },
  
--- 333,348 ----
    { "", "", "float FPUL,<FREG_N>", "1111nnnn00101101",
      /* sh4 */
      "if (FPSCR_PR)",
!     "  SET_DR (n, (double) FPUL);",
      "else",
      "{",
!     "  SET_FR (n, (float) FPUL);",
      "}",
    },
  
    /* sh2e */
    { "", "", "fmac <FREG_0>,<FREG_M>,<FREG_N>", "1111nnnnmmmm1110",
!     "SET_FR (n, FR (m) * FR (0) + FR (n));",
      "/* FIXME: check for DP and (n & 1) == 0? */",
    },
  
*************** op tab[] =
*** 370,376 ****
      "else",
      "{",
      "  MA (1);",
!     "  WLAT (R[n], FI(m));",
      "}",
    },
    /* sh2e */
--- 370,376 ----
      "else",
      "{",
      "  MA (1);",
!     "  WLAT (R[n], FI (m));",
      "}",
    },
    /* sh2e */
*************** op tab[] =
*** 383,389 ****
      "else",
      "{",
      "  MA (1);",
!     "  SET_FI(n, RLAT(R[m]));",
      "}",
    },
    /* sh2e */
--- 383,389 ----
      "else",
      "{",
      "  MA (1);",
!     "  SET_FI (n, RLAT (R[m]));",
      "}",
    },
    /* sh2e */
*************** op tab[] =
*** 413,419 ****
      "{",
      "  MA (1);",
      "  R[n] -= 4;",
!     "  WLAT (R[n], FI(m));",
      "}",
    },
    /* sh2e */
--- 413,419 ----
      "{",
      "  MA (1);",
      "  R[n] -= 4;",
!     "  WLAT (R[n], FI (m));",
      "}",
    },
    /* sh2e */
*************** op tab[] =
*** 426,432 ****
      "else",
      "{",
      "  MA (1);",
!     "  SET_FI(n, RLAT(R[0] + R[m]));",
      "}",
    },
    /* sh2e */
--- 426,432 ----
      "else",
      "{",
      "  MA (1);",
!     "  SET_FI (n, RLAT (R[0] + R[m]));",
      "}",
    },
    /* sh2e */
*************** op tab[] =
*** 439,445 ****
      "else",
      "{",
      "  MA (1);",
!     "  WLAT((R[0]+R[n]), FI(m));",
      "}",
    },
  
--- 439,445 ----
      "else",
      "{",
      "  MA (1);",
!     "  WLAT ((R[0]+R[n]), FI (m));",
      "}",
    },
  
*************** op tab[] =
*** 447,463 ****
  
    /* sh2e */
    { "", "", "fmul <FREG_M>,<FREG_N>", "1111nnnnmmmm0010",
!     "FP_OP(n, *, m);",
    },
  
    /* sh2e */
    { "", "", "fneg <FREG_N>", "1111nnnn01001101",
!     "FP_UNARY(n, -);",
    },
  
    /* sh4a */
    { "", "", "fpchg", "1111011111111101",
!     "SET_FPSCR (GET_FPSCR() ^ FPSCR_MASK_PR);",
    },
  
    /* sh4 */
--- 447,463 ----
  
    /* sh2e */
    { "", "", "fmul <FREG_M>,<FREG_N>", "1111nnnnmmmm0010",
!     "FP_OP (n, *, m);",
    },
  
    /* sh2e */
    { "", "", "fneg <FREG_N>", "1111nnnn01001101",
!     "FP_UNARY (n, -);",
    },
  
    /* sh4a */
    { "", "", "fpchg", "1111011111111101",
!     "SET_FPSCR (GET_FPSCR () ^ FPSCR_MASK_PR);",
    },
  
    /* sh4 */
*************** op tab[] =
*** 465,471 ****
      "if (FPSCR_PR)",
      "  RAISE_EXCEPTION (SIGILL);",
      "else",
!     "  SET_FPSCR (GET_FPSCR() ^ FPSCR_MASK_FR);",
    },
  
    /* sh4 */
--- 465,471 ----
      "if (FPSCR_PR)",
      "  RAISE_EXCEPTION (SIGILL);",
      "else",
!     "  SET_FPSCR (GET_FPSCR () ^ FPSCR_MASK_FR);",
    },
  
    /* sh4 */
*************** op tab[] =
*** 481,492 ****
  
    /* sh4 */
    { "", "", "fschg", "1111001111111101",
!     "SET_FPSCR (GET_FPSCR() ^ FPSCR_MASK_SZ);",
    },
  
    /* sh3e */
    { "", "", "fsqrt <FREG_N>", "1111nnnn01101101",
!     "FP_UNARY(n, sqrt);",
    },
  
    /* sh4 */
--- 481,492 ----
  
    /* sh4 */
    { "", "", "fschg", "1111001111111101",
!     "SET_FPSCR (GET_FPSCR () ^ FPSCR_MASK_SZ);",
    },
  
    /* sh3e */
    { "", "", "fsqrt <FREG_N>", "1111nnnn01101101",
!     "FP_UNARY (n, sqrt);",
    },
  
    /* sh4 */
*************** op tab[] =
*** 499,521 ****
  
    /* sh2e */
    { "", "", "fsub <FREG_M>,<FREG_N>", "1111nnnnmmmm0001",
!     "FP_OP(n, -, m);",
    },
  
    /* sh2e */
    { "", "", "ftrc <FREG_N>, FPUL", "1111nnnn00111101",
      /* sh4 */
      "if (FPSCR_PR) {",
!     "  if (DR(n) != DR(n)) /* NaN */",
      "    FPUL = 0x80000000;",
      "  else",
!     "    FPUL =  (int)DR(n);",
      "}",
      "else",
!     "if (FR(n) != FR(n)) /* NaN */",
      "  FPUL = 0x80000000;",
      "else",
!     "  FPUL = (int)FR(n);",
    },
  
    /* sh4 */
--- 499,521 ----
  
    /* sh2e */
    { "", "", "fsub <FREG_M>,<FREG_N>", "1111nnnnmmmm0001",
!     "FP_OP (n, -, m);",
    },
  
    /* sh2e */
    { "", "", "ftrc <FREG_N>, FPUL", "1111nnnn00111101",
      /* sh4 */
      "if (FPSCR_PR) {",
!     "  if (DR (n) != DR (n)) /* NaN */",
      "    FPUL = 0x80000000;",
      "  else",
!     "    FPUL =  (int) DR (n);",
      "}",
      "else",
!     "if (FR (n) != FR (n)) /* NaN */",
      "  FPUL = 0x80000000;",
      "else",
!     "  FPUL = (int) FR (n);",
    },
  
    /* sh4 */
*************** op tab[] =
*** 643,659 ****
    },
    { "n", "n", "lds.l @<REG_N>+,<SREG_M>", "0100nnnnssss0110",
      "MA (1);",
!     "SREG (m) = RLAT(R[n]);",
      "R[n] += 4;",
    },
    /* sh2e / sh-dsp (lds <REG_N>,DSR) */
    { "", "n", "lds <REG_N>,FPSCR", "0100nnnn01101010",
!     "SET_FPSCR(R[n]);",
    },
    /* sh2e / sh-dsp (lds.l @<REG_N>+,DSR) */
    { "n", "n", "lds.l @<REG_N>+,FPSCR", "0100nnnn01100110",
      "MA (1);",
!     "SET_FPSCR (RLAT(R[n]));",
      "R[n] += 4;",
    },
  
--- 643,659 ----
    },
    { "n", "n", "lds.l @<REG_N>+,<SREG_M>", "0100nnnnssss0110",
      "MA (1);",
!     "SREG (m) = RLAT (R[n]);",
      "R[n] += 4;",
    },
    /* sh2e / sh-dsp (lds <REG_N>,DSR) */
    { "", "n", "lds <REG_N>,FPSCR", "0100nnnn01101010",
!     "SET_FPSCR (R[n]);",
    },
    /* sh2e / sh-dsp (lds.l @<REG_N>+,DSR) */
    { "n", "n", "lds.l @<REG_N>+,FPSCR", "0100nnnn01100110",
      "MA (1);",
!     "SET_FPSCR (RLAT (R[n]));",
      "R[n] += 4;",
    },
  
*************** op tab[] =
*** 662,676 ****
    },
  
    { "nm", "nm", "mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111",
!     "macl(&R0,memory,n,m);",
    },
  
    { "nm", "nm", "mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111",
!     "macw(&R0,memory,n,m,endianw);",
    },
  
    { "n", "", "mov #<imm>,<REG_N>", "1110nnnni8*1....",
!     "R[n] = SEXT(i);",
    },
    { "n", "m", "mov <REG_M>,<REG_N>", "0110nnnnmmmm0011",
      "R[n] = R[m];",
--- 662,676 ----
    },
  
    { "nm", "nm", "mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111",
!     "macl (&R0,memory,n,m);",
    },
  
    { "nm", "nm", "mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111",
!     "macw (&R0,memory,n,m,endianw);",
    },
  
    { "n", "", "mov #<imm>,<REG_N>", "1110nnnni8*1....",
!     "R[n] = SEXT (i);",
    },
    { "n", "m", "mov <REG_M>,<REG_N>", "0110nnnnmmmm0011",
      "R[n] = R[m];",
*************** op tab[] =
*** 890,902 ****
  
    /* muls.w - see muls */
    { "", "mn", "muls <REG_M>,<REG_N>", "0010nnnnmmmm1111",
!     "MACL = ((int)(short)R[n]) * ((int)(short)R[m]);",
    },
  
    /* mulu.w - see mulu */
    { "", "mn", "mulu <REG_M>,<REG_N>", "0010nnnnmmmm1110",
!     "MACL = (((unsigned int)(unsigned short)R[n])",
!     "        * ((unsigned int)(unsigned short)R[m]));",
    },
  
    { "n", "m", "neg <REG_M>,<REG_N>", "0110nnnnmmmm1011",
--- 890,902 ----
  
    /* muls.w - see muls */
    { "", "mn", "muls <REG_M>,<REG_N>", "0010nnnnmmmm1111",
!     "MACL = ((int) (short) R[n]) * ((int) (short) R[m]);",
    },
  
    /* mulu.w - see mulu */
    { "", "mn", "mulu <REG_M>,<REG_N>", "0010nnnnmmmm1110",
!     "MACL = (((unsigned int) (unsigned short) R[n])",
!     "        * ((unsigned int) (unsigned short) R[m]));",
    },
  
    { "n", "m", "neg <REG_M>,<REG_N>", "0110nnnnmmmm1011",
*************** op tab[] =
*** 1184,1192 ****
  
    { "", "n", "tas.b @<REG_N>", "0100nnnn00011011",
      "MA (1);",
!     "ult = RBAT(R[n]);",
      "SET_SR_T (ult == 0);",
!     "WBAT(R[n],ult|0x80);",
    },
  
    { "0", "", "trapa #<imm>", "11000011i8*1....", 
--- 1184,1192 ----
  
    { "", "n", "tas.b @<REG_N>", "0100nnnn00011011",
      "MA (1);",
!     "ult = RBAT (R[n]);",
      "SET_SR_T (ult == 0);",
!     "WBAT (R[n],ult|0x80);",
    },
  
    { "0", "", "trapa #<imm>", "11000011i8*1....", 
*************** op tab[] =
*** 1196,1210 ****
  #if 0
      "else {",
      /* SH-[12] */
!     "  R[15]-=4;",
!     "  WLAT (R[15], GET_SR());",
!     "  R[15]-=4;",
      "  WLAT (R[15], PH2T (PC + 2));",
  #else
      "else if (!SR_BL) {",
!     "  SSR = GET_SR();",
      "  SPC = PH2T (PC + 2);",
!     "  SET_SR (GET_SR() | SR_MASK_MD | SR_MASK_BL | SR_MASK_RB);",
      "  /* FIXME: EXPEVT = 0x00000160; */",
  #endif
      "  SET_NIP (PT2H (RLAT (VBR + (imm<<2))));",
--- 1196,1210 ----
  #if 0
      "else {",
      /* SH-[12] */
!     "  R[15] -= 4;",
!     "  WLAT (R[15], GET_SR ());",
!     "  R[15] -= 4;",
      "  WLAT (R[15], PH2T (PC + 2));",
  #else
      "else if (!SR_BL) {",
!     "  SSR = GET_SR ();",
      "  SPC = PH2T (PC + 2);",
!     "  SET_SR (GET_SR () | SR_MASK_MD | SR_MASK_BL | SR_MASK_RB);",
      "  /* FIXME: EXPEVT = 0x00000160; */",
  #endif
      "  SET_NIP (PT2H (RLAT (VBR + (imm<<2))));",
*************** op tab[] =
*** 1242,1251 ****
  
  #if 0
    { "divs.l <REG_M>,<REG_N>", "0100nnnnmmmm1110",
!     "divl(0,R[n],R[m]);",
    },
    { "divu.l <REG_M>,<REG_N>", "0100nnnnmmmm1101",
!     "divl(0,R[n],R[m]);",
    },
  #endif
  
--- 1242,1251 ----
  
  #if 0
    { "divs.l <REG_M>,<REG_N>", "0100nnnnmmmm1110",
!     "divl (0,R[n],R[m]);",
    },
    { "divu.l <REG_M>,<REG_N>", "0100nnnnmmmm1101",
!     "divl (0,R[n],R[m]);",
    },
  #endif
  
*************** gensim_caselist (p)
*** 2619,2628 ****
  		case '1':
  		  break;
  		case '2':
! 		  printf ("<<1");
  		  break;
  		case '4':
! 		  printf ("<<2");
  		  break;
  		}
  	      printf (";\n");
--- 2619,2628 ----
  		case '1':
  		  break;
  		case '2':
! 		  printf (" << 1");
  		  break;
  		case '4':
! 		  printf (" << 2");
  		  break;
  		}
  	      printf (";\n");
*************** gensim_caselist (p)
*** 2631,2657 ****
  	}
        if (sextbit > 0)
  	{
! 	  printf ("      i = (i ^ (1<<%d))-(1<<%d);\n",
  		  sextbit - 1, sextbit - 1);
  	}
  
        if (needm && needn)
! 	printf ("      TB(m,n);\n");  
        else if (needm)
! 	printf ("      TL(m);\n");
        else if (needn)
! 	printf ("      TL(n);\n");
  
        {
  	/* Do the refs */
  	char *r;
  	for (r = p->refs; *r; r++)
  	  {
! 	    if (*r == '0') printf("      CREF(0);\n"); 
! 	    if (*r == '8') printf("      CREF(8);\n"); 
! 	    if (*r == '9') printf("      CREF(9);\n"); 
! 	    if (*r == 'n') printf("      CREF(n);\n"); 
! 	    if (*r == 'm') printf("      CREF(m);\n"); 
  	  }
        }
  
--- 2631,2657 ----
  	}
        if (sextbit > 0)
  	{
! 	  printf ("      i = (i ^ (1 << %d)) - (1 << %d);\n",
  		  sextbit - 1, sextbit - 1);
  	}
  
        if (needm && needn)
! 	printf ("      TB (m,n);\n");  
        else if (needm)
! 	printf ("      TL (m);\n");
        else if (needn)
! 	printf ("      TL (n);\n");
  
        {
  	/* Do the refs */
  	char *r;
  	for (r = p->refs; *r; r++)
  	  {
! 	    if (*r == '0') printf ("      CREF (0);\n"); 
! 	    if (*r == '8') printf ("      CREF (8);\n"); 
! 	    if (*r == '9') printf ("      CREF (9);\n"); 
! 	    if (*r == 'n') printf ("      CREF (n);\n"); 
! 	    if (*r == 'm') printf ("      CREF (m);\n"); 
  	  }
        }
  
*************** gensim_caselist (p)
*** 2670,2678 ****
  	char *r;
  	for (r = p->defs; *r; r++) 
  	  {
! 	    if (*r == '0') printf("      CDEF(0);\n"); 
! 	    if (*r == 'n') printf("      CDEF(n);\n"); 
! 	    if (*r == 'm') printf("      CDEF(m);\n"); 
  	  }
        }
  
--- 2670,2678 ----
  	char *r;
  	for (r = p->defs; *r; r++) 
  	  {
! 	    if (*r == '0') printf("      CDEF (0);\n"); 
! 	    if (*r == 'n') printf("      CDEF (n);\n"); 
! 	    if (*r == 'm') printf("      CDEF (m);\n"); 
  	  }
        }
  
*************** gendefines ()
*** 2720,2741 ****
        char *s = p->name;
        printf ("#define OPC_");
        while (*s) {
! 	if (isupper(*s)) 
! 	  *s = tolower(*s);
! 	if (isalpha(*s)) printf("%c", *s);
! 	if (*s == ' ') printf("_");
! 	if (*s == '@') printf("ind_");
! 	if (*s == ',') printf("_");
  	s++;
        }
!       printf(" %d\n",p->index);
      }
  }
  
  static int ppi_index;
  
  /* Take a ppi code, expand all varying fields in it and fill all the
!    right entries in 'table' with the opcode index.  
     NOTE: tail recursion optimization removed for simplicity.  */
  
  static void
--- 2720,2745 ----
        char *s = p->name;
        printf ("#define OPC_");
        while (*s) {
! 	if (isupper (*s)) 
! 	  *s = tolower (*s);
! 	if (isalpha (*s))
! 	  printf ("%c", *s);
! 	if (*s == ' ')
! 	  printf ("_");
! 	if (*s == '@')
! 	  printf ("ind_");
! 	if (*s == ',')
! 	  printf ("_");
  	s++;
        }
!       printf (" %d\n",p->index);
      }
  }
  
  static int ppi_index;
  
  /* Take a ppi code, expand all varying fields in it and fill all the
!    right entries in 'table' with the opcode index.
     NOTE: tail recursion optimization removed for simplicity.  */
  
  static void
Index: interp.c
===================================================================
RCS file: /cvs/src/src/sim/sh/interp.c,v
retrieving revision 1.13
diff -p -r1.13 interp.c
*** interp.c	9 Jan 2004 19:44:49 -0000	1.13
--- interp.c	10 Jan 2004 00:12:05 -0000
*************** static char *myname;
*** 183,191 ****
  #define R0 	saved_state.asregs.regs[0]
  #define Rn 	saved_state.asregs.regs[n]
  #define Rm 	saved_state.asregs.regs[m]
! #define UR0 	(unsigned int)(saved_state.asregs.regs[0])
! #define UR 	(unsigned int)R
! #define UR 	(unsigned int)R
  #define SR0 	saved_state.asregs.regs[0]
  #define CREG(n)	(saved_state.asregs.cregs.i[(n)])
  #define GBR 	saved_state.asregs.cregs.named.gbr
--- 183,191 ----
  #define R0 	saved_state.asregs.regs[0]
  #define Rn 	saved_state.asregs.regs[n]
  #define Rm 	saved_state.asregs.regs[m]
! #define UR0 	(unsigned int) (saved_state.asregs.regs[0])
! #define UR 	(unsigned int) R
! #define UR 	(unsigned int) R
  #define SR0 	saved_state.asregs.regs[0]
  #define CREG(n)	(saved_state.asregs.cregs.i[(n)])
  #define GBR 	saved_state.asregs.cregs.named.gbr
*************** do { \
*** 270,278 ****
  #define FPSCR_MASK_SZ (1 << 20)
  #define FPSCR_MASK_PR (1 << 19)
  
! #define FPSCR_FR  ((GET_FPSCR() & FPSCR_MASK_FR) != 0)
! #define FPSCR_SZ  ((GET_FPSCR() & FPSCR_MASK_SZ) != 0)
! #define FPSCR_PR  ((GET_FPSCR() & FPSCR_MASK_PR) != 0)
  
  /* Count the number of arguments in an argv.  */
  static int
--- 270,278 ----
  #define FPSCR_MASK_SZ (1 << 20)
  #define FPSCR_MASK_PR (1 << 19)
  
! #define FPSCR_FR  ((GET_FPSCR () & FPSCR_MASK_FR) != 0)
! #define FPSCR_SZ  ((GET_FPSCR () & FPSCR_MASK_SZ) != 0)
! #define FPSCR_PR  ((GET_FPSCR () & FPSCR_MASK_PR) != 0)
  
  /* Count the number of arguments in an argv.  */
  static int
*************** void
*** 330,336 ****
  raise_exception (x)
       int x;
  {
!   RAISE_EXCEPTION(x);
  }
  
  void
--- 330,336 ----
  raise_exception (x)
       int x;
  {
!   RAISE_EXCEPTION (x);
  }
  
  void
*************** do { \
*** 405,411 ****
  
  #ifdef PARANOID
  int valid[16];
! #define CREF(x)  if(!valid[x]) fail();
  #define CDEF(x)  valid[x] = 1;
  #define UNDEF(x) valid[x] = 0;
  #else
--- 405,411 ----
  
  #ifdef PARANOID
  int valid[16];
! #define CREF(x)  if (!valid[x]) fail ();
  #define CDEF(x)  valid[x] = 1;
  #define UNDEF(x) valid[x] = 0;
  #else
*************** int valid[16];
*** 416,429 ****
  
  static void parse_and_set_memory_size PARAMS ((char *str));
  static int IOMEM PARAMS ((int addr, int write, int value));
! static struct loop_bounds get_loop_bounds PARAMS((int, int, unsigned char *,
! 						  unsigned char *, int, int));
! static void process_wlat_addr PARAMS((int, int));
! static void process_wwat_addr PARAMS((int, int));
! static void process_wbat_addr PARAMS((int, int));
! static int process_rlat_addr PARAMS((int));
! static int process_rwat_addr PARAMS((int));
! static int process_rbat_addr PARAMS((int));
  static void INLINE wlat_fast PARAMS ((unsigned char *, int, int, int));
  static void INLINE wwat_fast PARAMS ((unsigned char *, int, int, int, int));
  static void INLINE wbat_fast PARAMS ((unsigned char *, int, int, int));
--- 416,429 ----
  
  static void parse_and_set_memory_size PARAMS ((char *str));
  static int IOMEM PARAMS ((int addr, int write, int value));
! static struct loop_bounds get_loop_bounds PARAMS ((int, int, unsigned char *,
! 						   unsigned char *, int, int));
! static void process_wlat_addr PARAMS ((int, int));
! static void process_wwat_addr PARAMS ((int, int));
! static void process_wbat_addr PARAMS ((int, int));
! static int process_rlat_addr PARAMS ((int));
! static int process_rwat_addr PARAMS ((int));
! static int process_rbat_addr PARAMS ((int));
  static void INLINE wlat_fast PARAMS ((unsigned char *, int, int, int));
  static void INLINE wwat_fast PARAMS ((unsigned char *, int, int, int, int));
  static void INLINE wbat_fast PARAMS ((unsigned char *, int, int, int));
*************** set_dr (n, exp)
*** 522,531 ****
        if (((n) & 1) || ((m) & 1)) \
  	RAISE_EXCEPTION (SIGILL); \
        else \
! 	SET_DR(n, (DR(n) OP DR(m))); \
      } \
    else \
!     SET_FR(n, (FR(n) OP FR(m))); \
  } while (0)
  
  #define FP_UNARY(n, OP) \
--- 522,531 ----
        if (((n) & 1) || ((m) & 1)) \
  	RAISE_EXCEPTION (SIGILL); \
        else \
! 	SET_DR (n, (DR (n) OP DR (m))); \
      } \
    else \
!     SET_FR (n, (FR (n) OP FR (m))); \
  } while (0)
  
  #define FP_UNARY(n, OP) \
*************** set_dr (n, exp)
*** 535,544 ****
        if ((n) & 1) \
  	RAISE_EXCEPTION (SIGILL); \
        else \
! 	SET_DR(n, (OP (DR(n)))); \
      } \
    else \
!     SET_FR(n, (OP (FR(n)))); \
  } while (0)
  
  #define FP_CMP(n, OP, m) \
--- 535,544 ----
        if ((n) & 1) \
  	RAISE_EXCEPTION (SIGILL); \
        else \
! 	SET_DR (n, (OP (DR (n)))); \
      } \
    else \
!     SET_FR (n, (OP (FR (n)))); \
  } while (0)
  
  #define FP_CMP(n, OP, m) \
*************** set_dr (n, exp)
*** 548,557 ****
        if (((n) & 1) || ((m) & 1)) \
  	RAISE_EXCEPTION (SIGILL); \
        else \
! 	SET_SR_T (DR(n) OP DR(m)); \
      } \
    else \
!     SET_SR_T (FR(n) OP FR(m)); \
  } while (0)
  
  static void
--- 548,557 ----
        if (((n) & 1) || ((m) & 1)) \
  	RAISE_EXCEPTION (SIGILL); \
        else \
! 	SET_SR_T (DR (n) OP DR (m)); \
      } \
    else \
!     SET_SR_T (FR (n) OP FR (m)); \
  } while (0)
  
  static void
*************** wlat_fast (memory, x, value, maskl)
*** 580,586 ****
       unsigned char *memory;
  {
    int v = value;
!   unsigned int *p = (unsigned int *)(memory + x);
    WRITE_BUSERROR (x, maskl, v, process_wlat_addr);
    *p = v;
  }
--- 580,586 ----
       unsigned char *memory;
  {
    int v = value;
!   unsigned int *p = (unsigned int *) (memory + x);
    WRITE_BUSERROR (x, maskl, v, process_wlat_addr);
    *p = v;
  }
*************** wwat_fast (memory, x, value, maskw, endi
*** 590,596 ****
       unsigned char *memory;
  {
    int v = value;
!   unsigned short *p = (unsigned short *)(memory + (x ^ endianw));
    WRITE_BUSERROR (x, maskw, v, process_wwat_addr);
    *p = v;
  }
--- 590,596 ----
       unsigned char *memory;
  {
    int v = value;
!   unsigned short *p = (unsigned short *) (memory + (x ^ endianw));
    WRITE_BUSERROR (x, maskw, v, process_wwat_addr);
    *p = v;
  }
*************** static int INLINE 
*** 611,617 ****
  rlat_fast (memory, x, maskl)
       unsigned char *memory;
  {
!   unsigned int *p = (unsigned int *)(memory + x);
    READ_BUSERROR (x, maskl, process_rlat_addr);
  
    return *p;
--- 611,617 ----
  rlat_fast (memory, x, maskl)
       unsigned char *memory;
  {
!   unsigned int *p = (unsigned int *) (memory + x);
    READ_BUSERROR (x, maskl, process_rlat_addr);
  
    return *p;
*************** rwat_fast (memory, x, maskw, endianw)
*** 622,628 ****
       unsigned char *memory;
       int x, maskw, endianw;
  {
!   unsigned short *p = (unsigned short *)(memory + (x ^ endianw));
    READ_BUSERROR (x, maskw, process_rwat_addr);
  
    return *p;
--- 622,628 ----
       unsigned char *memory;
       int x, maskw, endianw;
  {
!   unsigned short *p = (unsigned short *) (memory + (x ^ endianw));
    READ_BUSERROR (x, maskw, process_rwat_addr);
  
    return *p;
*************** static int INLINE 
*** 632,638 ****
  riat_fast (insn_ptr, endianw)
       unsigned char *insn_ptr;
  {
!   unsigned short *p = (unsigned short *)((size_t) insn_ptr ^ endianw);
  
    return *p;
  }
--- 632,638 ----
  riat_fast (insn_ptr, endianw)
       unsigned char *insn_ptr;
  {
!   unsigned short *p = (unsigned short *) ((size_t) insn_ptr ^ endianw);
  
    return *p;
  }
*************** rbat_fast (memory, x, maskb)
*** 655,664 ****
  #define WLAT(x,v) 	(wlat_fast (memory, x, v, maskl))
  #define WBAT(x,v)       (wbat_fast (memory, x, v, maskb))
  
! #define RUWAT(x)  (RWAT(x) & 0xffff)
! #define RSWAT(x)  ((short)(RWAT(x)))
! #define RSLAT(x)  ((long)(RLAT(x)))
! #define RSBAT(x)  (SEXT(RBAT(x)))
  
  #define RDAT(x, n) (do_rdat (memory, (x), (n), (maskl)))
  static int
--- 655,664 ----
  #define WLAT(x,v) 	(wlat_fast (memory, x, v, maskl))
  #define WBAT(x,v)       (wbat_fast (memory, x, v, maskb))
  
! #define RUWAT(x)  (RWAT (x) & 0xffff)
! #define RSWAT(x)  ((short) (RWAT (x)))
! #define RSLAT(x)  ((long) (RLAT (x)))
! #define RSBAT(x)  (SEXT (RBAT (x)))
  
  #define RDAT(x, n) (do_rdat (memory, (x), (n), (maskl)))
  static int
*************** process_rbat_addr (addr)
*** 763,773 ****
  
  #define SEXT(x)     	(((x &  0xff) ^ (~0x7f))+0x80)
  #define SEXT12(x)	(((x & 0xfff) ^ 0x800) - 0x800)
! #define SEXTW(y)    	((int)((short)y))
  #if 0
! #define SEXT32(x)	((int)((x & 0xffffffff) ^ 0x80000000U) - 0x7fffffff - 1)
  #else
! #define SEXT32(x)	((int)(x))
  #endif
  #define SIGN32(x)	(SEXT32 (x) >> 31)
  
--- 763,773 ----
  
  #define SEXT(x)     	(((x &  0xff) ^ (~0x7f))+0x80)
  #define SEXT12(x)	(((x & 0xfff) ^ 0x800) - 0x800)
! #define SEXTW(y)    	((int) ((short) y))
  #if 0
! #define SEXT32(x)	((int) ((x & 0xffffffff) ^ 0x80000000U) - 0x7fffffff - 1)
  #else
! #define SEXT32(x)	((int) (x))
  #endif
  #define SIGN32(x)	(SEXT32 (x) >> 31)
  
*************** do { \
*** 806,812 ****
  
  #define L(x)   thislock = x;
  #define TL(x)  if ((x) == prevlock) stalls++;
! #define TB(x,y)  if ((x) == prevlock || (y)==prevlock) stalls++;
  
  #endif
  
--- 806,812 ----
  
  #define L(x)   thislock = x;
  #define TL(x)  if ((x) == prevlock) stalls++;
! #define TB(x,y)  if ((x) == prevlock || (y) == prevlock) stalls++;
  
  #endif
  
*************** trap (i, regs, insn_ptr, memory, maskl, 
*** 1004,1013 ****
     Besides, it's quite dangerous.  */
  #if 0
  	  case SYS_execve:
! 	    regs[0] = execve (ptr (regs[5]), (char **)ptr (regs[6]), (char **)ptr (regs[7]));
  	    break;
  	  case SYS_execv:
! 	    regs[0] = execve (ptr (regs[5]),(char **) ptr (regs[6]), 0);
  	    break;
  #endif
  	  case SYS_pipe:
--- 1004,1014 ----
     Besides, it's quite dangerous.  */
  #if 0
  	  case SYS_execve:
! 	    regs[0] = execve (ptr (regs[5]), (char **) ptr (regs[6]), 
! 			      (char **) ptr (regs[7]));
  	    break;
  	  case SYS_execv:
! 	    regs[0] = execve (ptr (regs[5]), (char **) ptr (regs[6]), 0);
  	    break;
  #endif
  	  case SYS_pipe:
*************** trap (i, regs, insn_ptr, memory, maskl, 
*** 1032,1040 ****
  	  case SYS_write:
  	    strnswap (regs[6], regs[7]);
  	    if (regs[5] == 1)
! 	      regs[0] = (int)callback->write_stdout (callback, ptr(regs[6]), regs[7]);
  	    else
! 	      regs[0] = (int)callback->write (callback, regs[5], ptr (regs[6]), regs[7]);
  	    strnswap (regs[6], regs[7]);
  	    break;
  	  case SYS_lseek:
--- 1033,1043 ----
  	  case SYS_write:
  	    strnswap (regs[6], regs[7]);
  	    if (regs[5] == 1)
! 	      regs[0] = (int) callback->write_stdout (callback, 
! 						      ptr (regs[6]), regs[7]);
  	    else
! 	      regs[0] = (int) callback->write (callback, regs[5], 
! 					       ptr (regs[6]), regs[7]);
  	    strnswap (regs[6], regs[7]);
  	    break;
  	  case SYS_lseek:
*************** trap (i, regs, insn_ptr, memory, maskl, 
*** 1047,1053 ****
  	    {
  	      int len = strswaplen (regs[5]);
  	      strnswap (regs[5], len);
! 	      regs[0] = callback->open (callback,ptr (regs[5]), regs[6]);
  	      strnswap (regs[5], len);
  	      break;
  	    }
--- 1050,1056 ----
  	    {
  	      int len = strswaplen (regs[5]);
  	      strnswap (regs[5], len);
! 	      regs[0] = callback->open (callback, ptr (regs[5]), regs[6]);
  	      strnswap (regs[5], len);
  	      break;
  	    }
*************** macw (regs, memory, n, m, endianw)
*** 1338,1348 ****
    long tempm, tempn;
    long prod, macl, sum;
  
!   tempm=RSWAT(regs[m]); regs[m]+=2;
!   tempn=RSWAT(regs[n]); regs[n]+=2;
  
    macl = MACL;
!   prod = (long)(short) tempm * (long)(short) tempn;
    sum = prod + macl;
    if (S)
      {
--- 1341,1351 ----
    long tempm, tempn;
    long prod, macl, sum;
  
!   tempm=RSWAT (regs[m]); regs[m]+=2;
!   tempn=RSWAT (regs[n]); regs[n]+=2;
  
    macl = MACL;
!   prod = (long) (short) tempm * (long) (short) tempn;
    sum = prod + macl;
    if (S)
      {
*************** macl (regs, memory, n, m)
*** 1382,1391 ****
      long long m64; /* 64 bit MAC */
    }mac64;
  
!   tempm = RSLAT(regs[m]);
    regs[m] += 4;
  
!   tempn = RSLAT(regs[n]);
    regs[n] += 4;
  
    mach = MACH;
--- 1385,1394 ----
      long long m64; /* 64 bit MAC */
    }mac64;
  
!   tempm = RSLAT (regs[m]);
    regs[m] += 4;
  
!   tempn = RSLAT (regs[n]);
    regs[n] += 4;
  
    mach = MACH;
*************** macl (regs, memory, n, m)
*** 1394,1400 ****
    mac64.m[0] = macl;
    mac64.m[1] = mach;
  
!   ans = (long long)tempm * (long long)tempn; /* Multiply 32bit * 32bit */
  
    mac64.m64 += ans; /* Accumulate   64bit + 64 bit */
  
--- 1397,1403 ----
    mac64.m[0] = macl;
    mac64.m[1] = mach;
  
!   ans = (long long) tempm * (long long) tempn; /* Multiply 32bit * 32bit */
  
    mac64.m64 += ans; /* Accumulate   64bit + 64 bit */
  
*************** fsrra_s (float in)
*** 1477,1483 ****
       architectural spec.  */
    frac = frexp (result, &exp);
    frac = ldexp (frac, 24);
!   error = 4.; /* 1 << 24-1-21 */
    /* use eps to compensate for possible 1 ulp error in our 'exact' result.  */
    eps = ldexp (1., -29);
    upper = floor (frac + error - eps);
--- 1480,1486 ----
       architectural spec.  */
    frac = frexp (result, &exp);
    frac = ldexp (frac, 24);
!   error = 4.0; /* 1 << 24-1-21 */
    /* use eps to compensate for possible 1 ulp error in our 'exact' result.  */
    eps = ldexp (1., -29);
    upper = floor (frac + error - eps);
*************** get_loop_bounds (rs, re, memory, mem_end
*** 1530,1537 ****
    return loop;
  }
  
! static void
! ppi_insn();
  
  #include "ppi.c"
  
--- 1533,1539 ----
    return loop;
  }
  
! static void ppi_insn ();
  
  #include "ppi.c"
  
*************** static void
*** 1657,1663 ****
  init_pointers ()
  {
    host_little_endian = 0;
!   *(char*)&host_little_endian = 1;
    host_little_endian &= 1;
  
    if (saved_state.asregs.msize != 1 << sim_memory_size)
--- 1659,1665 ----
  init_pointers ()
  {
    host_little_endian = 0;
!   * (char*) &host_little_endian = 1;
    host_little_endian &= 1;
  
    if (saved_state.asregs.msize != 1 << sim_memory_size)
*************** sim_store_register (sd, rn, memory, leng
*** 1948,1954 ****
    unsigned val;
  
    init_pointers ();
!   val = swap (* (int *)memory);
    switch (rn)
      {
      case SIM_SH_R0_REGNUM: case SIM_SH_R1_REGNUM: case SIM_SH_R2_REGNUM:
--- 1950,1956 ----
    unsigned val;
  
    init_pointers ();
!   val = swap (* (int *) memory);
    switch (rn)
      {
      case SIM_SH_R0_REGNUM: case SIM_SH_R1_REGNUM: case SIM_SH_R2_REGNUM:
*************** sim_info (sd, verbose)
*** 2240,2246 ****
       SIM_DESC sd;
       int verbose;
  {
!   double timetaken = (double) saved_state.asregs.ticks / (double) now_persec ();
    double virttime = saved_state.asregs.cycles / 36.0e6;
  
    callback->printf_filtered (callback, "\n\n# instructions executed  %10d\n", 
--- 2242,2249 ----
       SIM_DESC sd;
       int verbose;
  {
!   double timetaken = 
!     (double) saved_state.asregs.ticks / (double) now_persec ();
    double virttime = saved_state.asregs.cycles / 36.0e6;
  
    callback->printf_filtered (callback, "\n\n# instructions executed  %10d\n", 
*************** sim_create_inferior (sd, prog_bfd, argv,
*** 2394,2400 ****
  {
    /* Clear the registers. */
    memset (&saved_state, 0,
! 	  (char*)&saved_state.asregs.end_of_registers - (char*)&saved_state);
  
    /* Set the PC.  */
    if (prog_bfd != NULL)
--- 2397,2403 ----
  {
    /* Clear the registers. */
    memset (&saved_state, 0,
! 	  (char*) &saved_state.asregs.end_of_registers - (char*) &saved_state);
  
    /* Set the PC.  */
    if (prog_bfd != NULL)
*************** sim_do_command (sd, cmd)
*** 2420,2432 ****
      }
  
    cmdsize = strlen (sms_cmd);
!   if (strncmp (cmd, sms_cmd, cmdsize) == 0 && strchr (" \t", cmd[cmdsize]) != NULL)
      {
        parse_and_set_memory_size (cmd + cmdsize + 1);
      }
    else if (strcmp (cmd, "help") == 0)
      {
!       (callback->printf_filtered) (callback, "List of SH simulator commands:\n\n");
        (callback->printf_filtered) (callback, "set-memory-size <n> -- Set the number of address bits to use\n");
        (callback->printf_filtered) (callback, "\n");
      }
--- 2423,2437 ----
      }
  
    cmdsize = strlen (sms_cmd);
!   if (strncmp (cmd, sms_cmd, cmdsize) == 0 
!       && strchr (" \t", cmd[cmdsize]) != NULL)
      {
        parse_and_set_memory_size (cmd + cmdsize + 1);
      }
    else if (strcmp (cmd, "help") == 0)
      {
!       (callback->printf_filtered) (callback, 
! 				   "List of SH simulator commands:\n\n");
        (callback->printf_filtered) (callback, "set-memory-size <n> -- Set the number of address bits to use\n");
        (callback->printf_filtered) (callback, "\n");
      }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]