2005-09-19 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Mon, 19 Sep 2005 14:21:09 +0000 (14:21 +0000)
committerPaul Brook <paul@codesourcery.com>
Mon, 19 Sep 2005 14:21:09 +0000 (14:21 +0000)
* armdefs.h: Define ARMsword and ARMsdword. Use stdint.h when
available.
* armemu.c: Use them.
* armvirt.c (ARMul_MemoryInit): Use correct type for size.
* configure.ac: Check for stdint.h.
* config.in: Regenerate.
* configure: Regenerate.

sim/arm/ChangeLog
sim/arm/armdefs.h
sim/arm/armemu.c
sim/arm/armvirt.c
sim/arm/config.in
sim/arm/configure
sim/arm/configure.ac

index e791416..370cde7 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-19  Paul Brook  <paul@codesourcery.com>
+
+       * armdefs.h: Define ARMsword and ARMsdword. Use stdint.h when
+       available.
+       * armemu.c: Use them.
+       * armvirt.c (ARMul_MemoryInit): Use correct type for size.
+       * configure.ac: Check for stdint.h.
+       * config.in: Regenerate.
+       * configure: Regenerate.
+
 2005-05-24  Nick Clifton  <nickc@redhat.com>
 
        * thumbemu.c (handle_v6_thumb_insn): New function.
index 0800e3e..2942023 100644 (file)
@@ -15,6 +15,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
 
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 
 typedef char *VoidStar;
 #endif
 
-typedef unsigned long ARMword; /* must be 32 bits wide */
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef uint32_t ARMword;
+typedef int32_t ARMsword;
+typedef uint64_t ARMdword;
+typedef int64_t ARMsdword;
+#else
+typedef unsigned int ARMword;  /* must be 32 bits wide */
+typedef signed int ARMsword;
 typedef unsigned long long ARMdword;   /* Must be at least 64 bits wide.  */
+typedef signed long long ARMsdword;
+#endif
 typedef struct ARMul_State ARMul_State;
 
 typedef unsigned ARMul_CPInits (ARMul_State * state);
index ab57495..e4879eb 100644 (file)
@@ -1584,9 +1584,9 @@ check_PMUintr:
                      && (BIT (5) == 0 || BITS (12, 15) == 0))
                    {
                      /* ElSegundo SMLAWy/SMULWy insn.  */
-                     unsigned long long op1 = state->Reg[BITS (0, 3)];
-                     unsigned long long op2 = state->Reg[BITS (8, 11)];
-                     unsigned long long result;
+                     ARMdword op1 = state->Reg[BITS (0, 3)];
+                     ARMdword op2 = state->Reg[BITS (8, 11)];
+                     ARMdword result;
 
                      if (BIT (6))
                        op2 >>= 16;
@@ -1733,10 +1733,10 @@ check_PMUintr:
                  if (BIT (4) == 0 && BIT (7) == 1)
                    {
                      /* ElSegundo SMLALxy insn.  */
-                     unsigned long long op1 = state->Reg[BITS (0, 3)];
-                     unsigned long long op2 = state->Reg[BITS (8, 11)];
-                     unsigned long long dest;
-                     unsigned long long result;
+                     ARMdword op1 = state->Reg[BITS (0, 3)];
+                     ARMdword op2 = state->Reg[BITS (8, 11)];
+                     ARMdword dest;
+                     ARMdword result;
 
                      if (BIT (5))
                        op1 >>= 16;
@@ -1749,7 +1749,7 @@ check_PMUintr:
                      if (op2 & 0x8000)
                        op2 -= 65536;
 
-                     dest = (unsigned long long) state->Reg[BITS (16, 19)] << 32;
+                     dest = (ARMdword) state->Reg[BITS (16, 19)] << 32;
                      dest |= state->Reg[BITS (12, 15)];
                      dest += op1 * op2;
                      state->Reg[BITS (12, 15)] = dest;
@@ -3684,8 +3684,8 @@ check_PMUintr:
                      {
                        /* XScale MIA instruction.  Signed multiplication of
                           two 32 bit values and addition to 40 bit accumulator.  */
-                       long long Rm = state->Reg[MULLHSReg];
-                       long long Rs = state->Reg[MULACCReg];
+                       ARMsdword Rm = state->Reg[MULLHSReg];
+                       ARMsdword Rs = state->Reg[MULACCReg];
 
                        if (Rm & (1 << 31))
                          Rm -= 1ULL << 32;
@@ -3704,7 +3704,7 @@ check_PMUintr:
                        ARMword t2 = state->Reg[MULACCReg] >> 16;
                        ARMword t3 = state->Reg[MULLHSReg] & 0xffff;
                        ARMword t4 = state->Reg[MULACCReg] & 0xffff;
-                       long long t5;
+                       ARMsdword t5;
 
                        if (t1 & (1 << 15))
                          t1 -= 1 << 16;
@@ -3734,7 +3734,7 @@ check_PMUintr:
                        /* XScale MIAxy instruction.  */
                        ARMword t1;
                        ARMword t2;
-                       long long t5;
+                       ARMsdword t5;
 
                        if (BIT (17))
                          t1 = state->Reg[MULLHSReg] >> 16;
@@ -3926,9 +3926,9 @@ GetDPRegRHS (ARMul_State * state, ARMword instr)
          if (shamt == 0)
            return (base);
          else if (shamt >= 32)
-           return ((ARMword) ((long int) base >> 31L));
+           return ((ARMword) ((ARMsword) base >> 31L));
          else
-           return ((ARMword) ((long int) base >> (int) shamt));
+           return ((ARMword) ((ARMsword) base >> (int) shamt));
        case ROR:
          shamt &= 0x1f;
          if (shamt == 0)
@@ -3958,9 +3958,9 @@ GetDPRegRHS (ARMul_State * state, ARMword instr)
            return (base >> shamt);
        case ASR:
          if (shamt == 0)
-           return ((ARMword) ((long int) base >> 31L));
+           return ((ARMword) ((ARMsword) base >> 31L));
          else
-           return ((ARMword) ((long int) base >> (int) shamt));
+           return ((ARMword) ((ARMsword) base >> (int) shamt));
        case ROR:
          if (shamt == 0)
            /* It's an RRX.  */
@@ -4041,12 +4041,12 @@ GetDPSRegRHS (ARMul_State * state, ARMword instr)
          else if (shamt >= 32)
            {
              ASSIGNC (base >> 31L);
-             return ((ARMword) ((long int) base >> 31L));
+             return ((ARMword) ((ARMsword) base >> 31L));
            }
          else
            {
-             ASSIGNC ((ARMword) ((long int) base >> (int) (shamt - 1)) & 1);
-             return ((ARMword) ((long int) base >> (int) shamt));
+             ASSIGNC ((ARMword) ((ARMsword) base >> (int) (shamt - 1)) & 1);
+             return ((ARMword) ((ARMsword) base >> (int) shamt));
            }
        case ROR:
          if (shamt == 0)
@@ -4095,12 +4095,12 @@ GetDPSRegRHS (ARMul_State * state, ARMword instr)
          if (shamt == 0)
            {
              ASSIGNC (base >> 31L);
-             return ((ARMword) ((long int) base >> 31L));
+             return ((ARMword) ((ARMsword) base >> 31L));
            }
          else
            {
-             ASSIGNC ((ARMword) ((long int) base >> (int) (shamt - 1)) & 1);
-             return ((ARMword) ((long int) base >> (int) shamt));
+             ASSIGNC ((ARMword) ((ARMsword) base >> (int) (shamt - 1)) & 1);
+             return ((ARMword) ((ARMsword) base >> (int) shamt));
            }
        case ROR:
          if (shamt == 0)
@@ -4239,9 +4239,9 @@ GetLSRegRHS (ARMul_State * state, ARMword instr)
        return (base >> shamt);
     case ASR:
       if (shamt == 0)
-       return ((ARMword) ((long int) base >> 31L));
+       return ((ARMword) ((ARMsword) base >> 31L));
       else
-       return ((ARMword) ((long int) base >> (int) shamt));
+       return ((ARMword) ((ARMsword) base >> (int) shamt));
     case ROR:
       if (shamt == 0)
        /* It's an RRX.  */
@@ -5086,10 +5086,10 @@ Multiply64 (ARMul_State * state, ARMword instr, int msigned, int scc)
          /* Compute sign of result and adjust operands if necessary.  */
          sign = (Rm ^ Rs) & 0x80000000;
 
-         if (((signed long) Rm) < 0)
+         if (((ARMsword) Rm) < 0)
            Rm = -Rm;
 
-         if (((signed long) Rs) < 0)
+         if (((ARMsword) Rs) < 0)
            Rs = -Rs;
        }
 
index b8301f7..969085d 100644 (file)
@@ -139,7 +139,7 @@ ARMul_MemoryInit (ARMul_State * state, unsigned long initmemsize)
   if (initmemsize)
     state->MemSize = initmemsize;
 
-  pagetable = (ARMword **) malloc (sizeof (ARMword) * NUMPAGES);
+  pagetable = (ARMword **) malloc (sizeof (ARMword *) * NUMPAGES);
 
   if (pagetable == NULL)
     return FALSE;
index 1f87a2b..6a98479 100644 (file)
-/* config.in.  Generated automatically from configure.in by autoheader.  */
+/* config.in.  Generated from configure.ac by autoheader.  */
 
-/* Define if using alloca.c.  */
-#undef C_ALLOCA
+/* Define to 1 if NLS is requested.  */
+#undef ENABLE_NLS
 
-/* Define to empty if the keyword does not work.  */
-#undef const
+/* Define as 1 if you have catgets and don't want to use GNU gettext.  */
+#undef HAVE_CATGETS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
+#undef HAVE_GETTEXT
 
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
-   This function is required for alloca.c support on those systems.  */
+/* Define as 1 if you have the stpcpy function.  */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES.  */
+#undef HAVE_LC_MESSAGES
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
 #undef CRAY_STACKSEG_END
 
-/* Define if you have alloca, as a function or macro.  */
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if NLS is requested */
+#undef ENABLE_NLS
+
+/* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
-/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
 #undef HAVE_ALLOCA_H
 
-/* Define if you have a working `mmap' system call.  */
-#undef HAVE_MMAP
+/* Define to 1 if you have the <argz.h> header file. */
+#undef HAVE_ARGZ_H
 
-/* Define as __inline if that's what the C compiler calls it.  */
-#undef inline
+/* Define to 1 if you have the `dcgettext' function. */
+#undef HAVE_DCGETTEXT
 
-/* Define to `long' if <sys/types.h> doesn't define.  */
-#undef off_t
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
 
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
 
-/* Define as the return type of signal handlers (int or void).  */
-#undef RETSIGTYPE
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
 
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-#undef size_t
+/* Define to 1 if you have the <fpu_control.h> header file. */
+#undef HAVE_FPU_CONTROL_H
 
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-#undef STACK_DIRECTION
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
 
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
 
-/* Define to 1 if NLS is requested.  */
-#undef ENABLE_NLS
+/* Define to 1 if you have the `getrusage' function. */
+#undef HAVE_GETRUSAGE
 
-/* Define as 1 if you have gettext and don't want to use GNU gettext.  */
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
 #undef HAVE_GETTEXT
 
-/* Define as 1 if you have the stpcpy function.  */
-#undef HAVE_STPCPY
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
 
-/* Define if your locale.h file contains LC_MESSAGES.  */
+/* Define if your locale.h file contains LC_MESSAGES. */
 #undef HAVE_LC_MESSAGES
 
-/* Define if you have the __argz_count function.  */
-#undef HAVE___ARGZ_COUNT
-
-/* Define if you have the __argz_next function.  */
-#undef HAVE___ARGZ_NEXT
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
 
-/* Define if you have the __argz_stringify function.  */
-#undef HAVE___ARGZ_STRINGIFY
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
 
-/* Define if you have the __setfpucw function.  */
-#undef HAVE___SETFPUCW
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
 
-/* Define if you have the dcgettext function.  */
-#undef HAVE_DCGETTEXT
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
 
-/* Define if you have the getcwd function.  */
-#undef HAVE_GETCWD
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
 
-/* Define if you have the getpagesize function.  */
-#undef HAVE_GETPAGESIZE
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
 
-/* Define if you have the getrusage function.  */
-#undef HAVE_GETRUSAGE
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
 
-/* Define if you have the munmap function.  */
+/* Define to 1 if you have the `munmap' function. */
 #undef HAVE_MUNMAP
 
-/* Define if you have the putenv function.  */
+/* Define to 1 if you have the <nl_types.h> header file. */
+#undef HAVE_NL_TYPES_H
+
+/* Define to 1 if you have the `putenv' function. */
 #undef HAVE_PUTENV
 
-/* Define if you have the setenv function.  */
+/* Define to 1 if you have the `setenv' function. */
 #undef HAVE_SETENV
 
-/* Define if you have the setlocale function.  */
+/* Define to 1 if you have the `setlocale' function. */
 #undef HAVE_SETLOCALE
 
-/* Define if you have the sigaction function.  */
+/* Define to 1 if you have the `sigaction' function. */
 #undef HAVE_SIGACTION
 
-/* Define if you have the stpcpy function.  */
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the stpcpy function */
 #undef HAVE_STPCPY
 
-/* Define if you have the strcasecmp function.  */
+/* Define to 1 if you have the `strcasecmp' function. */
 #undef HAVE_STRCASECMP
 
-/* Define if you have the strchr function.  */
+/* Define to 1 if you have the `strchr' function. */
 #undef HAVE_STRCHR
 
-/* Define if you have the time function.  */
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `time' function. */
 #undef HAVE_TIME
 
-/* Define if you have the <argz.h> header file.  */
-#undef HAVE_ARGZ_H
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
 
-/* Define if you have the <fcntl.h> header file.  */
-#undef HAVE_FCNTL_H
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
 
-/* Define if you have the <fpu_control.h> header file.  */
-#undef HAVE_FPU_CONTROL_H
+/* Define to 1 if you have the <values.h> header file. */
+#undef HAVE_VALUES_H
 
-/* Define if you have the <limits.h> header file.  */
-#undef HAVE_LIMITS_H
+/* Define to 1 if you have the `__argz_count' function. */
+#undef HAVE___ARGZ_COUNT
 
-/* Define if you have the <locale.h> header file.  */
-#undef HAVE_LOCALE_H
+/* Define to 1 if you have the `__argz_next' function. */
+#undef HAVE___ARGZ_NEXT
 
-/* Define if you have the <malloc.h> header file.  */
-#undef HAVE_MALLOC_H
+/* Define to 1 if you have the `__argz_stringify' function. */
+#undef HAVE___ARGZ_STRINGIFY
 
-/* Define if you have the <nl_types.h> header file.  */
-#undef HAVE_NL_TYPES_H
+/* Define to 1 if you have the `__setfpucw' function. */
+#undef HAVE___SETFPUCW
 
-/* Define if you have the <stdlib.h> header file.  */
-#undef HAVE_STDLIB_H
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
 
-/* Define if you have the <string.h> header file.  */
-#undef HAVE_STRING_H
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
 
-/* Define if you have the <strings.h> header file.  */
-#undef HAVE_STRINGS_H
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
 
-/* Define if you have the <sys/param.h> header file.  */
-#undef HAVE_SYS_PARAM_H
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
 
-/* Define if you have the <sys/resource.h> header file.  */
-#undef HAVE_SYS_RESOURCE_H
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
 
-/* Define if you have the <sys/time.h> header file.  */
-#undef HAVE_SYS_TIME_H
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
 
-/* Define if you have the <time.h> header file.  */
-#undef HAVE_TIME_H
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+       STACK_DIRECTION > 0 => grows toward higher addresses
+       STACK_DIRECTION < 0 => grows toward lower addresses
+       STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
 
-/* Define if you have the <unistd.h> header file.  */
-#undef HAVE_UNISTD_H
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
 
-/* Define if you have the <values.h> header file.  */
-#undef HAVE_VALUES_H
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
index ea056b8..b4be017 100755 (executable)
@@ -7034,7 +7034,8 @@ sim_link_links="${sim_link_links} targ-vals.def"
 
 
 
-for ac_header in unistd.h
+
+for ac_header in unistd.h stdint.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
index 1d9cffb..8682c25 100644 (file)
@@ -9,7 +9,7 @@ sinclude(../common/aclocal.m4)
 # it by inlining the macro's contents.
 sinclude(../common/common.m4)
 
-AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_HEADERS(unistd.h stdint.h)
 
 COPRO="armcopro.o maverick.o iwmmxt.o"