]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge r6127: Extend for AIX5. Nothing surprising here.
authorJulian Seward <jseward@acm.org>
Tue, 17 Oct 2006 01:35:58 +0000 (01:35 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 17 Oct 2006 01:35:58 +0000 (01:35 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6264

coregrind/m_machine.c
coregrind/pub_core_machine.h
include/pub_tool_machine.h

index 357fbdbd5feae460a0f8e653465afe17009dc26a..e0a2862825614db84d261433354b8b998661c338 100644 (file)
@@ -370,7 +370,7 @@ Bool VG_(machine_get_hwcaps)( void )
      if (__builtin_setjmp(env_sigill)) {
         have_F = False;
      } else {
-        __asm__ __volatile__("fmr 0,0");
+        __asm__ __volatile__(".long 0xFC000090"); /*fmr 0,0 */
      }
 
      /* Altivec insns */
@@ -397,7 +397,7 @@ Bool VG_(machine_get_hwcaps)( void )
      if (__builtin_setjmp(env_sigill)) {
         have_FX = False;
      } else {
-        __asm__ __volatile__("fsqrt 0,0");
+        __asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0 */
      }
 
      /* Graphics optional (stfiwx, fres, frsqrte, fsel) */
@@ -408,7 +408,7 @@ Bool VG_(machine_get_hwcaps)( void )
      if (__builtin_setjmp(env_sigill)) {
         have_GX = False;
      } else {
-        __asm__ __volatile__("frsqrte 0,0");
+        __asm__ __volatile__(".long 0xFC000034"); /* frsqrte 0,0 */
      }
 
      r = VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
@@ -482,7 +482,7 @@ Bool VG_(machine_get_hwcaps)( void )
      if (__builtin_setjmp(env_sigill)) {
         have_V = False;
      } else {
-        __asm__ __volatile__("vor 0,0,0");
+        __asm__ __volatile__(".long 0x10000484"); /*vor 0,0,0*/
      }
 
      /* General-Purpose optional (fsqrt, fsqrts) */
@@ -492,7 +492,7 @@ Bool VG_(machine_get_hwcaps)( void )
      if (__builtin_setjmp(env_sigill)) {
         have_FX = False;
      } else {
-        __asm__ __volatile__("fsqrt 0,0");
+        __asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0*/
      }
 
      /* Graphics optional (stfiwx, fres, frsqrte, fsel) */
@@ -502,7 +502,7 @@ Bool VG_(machine_get_hwcaps)( void )
      if (__builtin_setjmp(env_sigill)) {
         have_GX = False;
      } else {
-        __asm__ __volatile__("frsqrte 0,0");
+        __asm__ __volatile__(".long 0xFC000034"); /*frsqrte 0,0*/
      }
 
      VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
@@ -582,22 +582,18 @@ void VG_(machine_get_VexArchInfo)( /*OUT*/VexArch* pVa,
 
 
 // Given a pointer to a function as obtained by "& functionname" in C,
-// produce a pointer to the actual entry point for the function.  For
-// most platforms it's the identity function.  Unfortunately, on
-// ppc64-linux it isn't (sigh).
+// produce a pointer to the actual entry point for the function.
 void* VG_(fnptr_to_fnentry)( void* f )
 {
-#if defined(VGP_x86_linux)
-   return f;
-#elif defined(VGP_amd64_linux)
-   return f;
-#elif defined(VGP_ppc32_linux)
+#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) \
+                           || defined(VGP_ppc32_linux)
    return f;
-#elif defined(VGP_ppc64_linux)
-   /* f is a pointer to a 3-word function descriptor, of which
-      the first word is the entry address. */
-   /* Don't ask me.  Really.  I have no idea why. */
-   ULong* descr = (ULong*)f;
+#elif defined(VGP_ppc64_linux) || defined(VGP_ppc32_aix5) \
+                               || defined(VGP_ppc64_aix5)
+   /* All other ppc variants use the AIX scheme, in which f is a
+      pointer to a 3-word function descriptor, of which the first word
+      is the entry address. */
+   UWord* descr = (UWord*)f;
    return (void*)(descr[0]);
 #else
 #  error "Unknown platform"
index bfaecb024c247c5f558fce78a53b8b1b62f3bf5e..92ae69994c701d7282bb2a369ce5f6bb2c7e8a22 100644 (file)
 
 #include "pub_tool_machine.h"
 
-#if defined(VGA_x86)
+#if defined(VGP_x86_linux)
 #  define VG_ELF_DATA2XXX     ELFDATA2LSB
 #  define VG_ELF_MACHINE      EM_386
 #  define VG_ELF_CLASS        ELFCLASS32
-#elif defined(VGA_amd64)
+#  undef  VG_PLAT_USES_PPCTOC
+#elif defined(VGP_amd64_linux)
 #  define VG_ELF_DATA2XXX     ELFDATA2LSB
 #  define VG_ELF_MACHINE      EM_X86_64
 #  define VG_ELF_CLASS        ELFCLASS64
-#elif defined(VGA_ppc32)
+#  undef  VG_PLAT_USES_PPCTOC
+#elif defined(VGP_ppc32_linux)
 #  define VG_ELF_DATA2XXX     ELFDATA2MSB
 #  define VG_ELF_MACHINE      EM_PPC
 #  define VG_ELF_CLASS        ELFCLASS32
-#elif defined(VGA_ppc64)
+#  undef  VG_PLAT_USES_PPCTOC
+#elif defined(VGP_ppc64_linux)
 #  define VG_ELF_DATA2XXX     ELFDATA2MSB
 #  define VG_ELF_MACHINE      EM_PPC64
 #  define VG_ELF_CLASS        ELFCLASS64
+#  define VG_PLAT_USES_PPCTOC 1
+#elif defined(VGO_aix5)
+#  undef  VG_ELF_DATA2XXX
+#  undef  VG_ELF_MACHINE
+#  undef  VG_ELF_CLASS
+#  define VG_PLAT_USES_PPCTOC 1
 #else
-#  error Unknown arch
+#  error Unknown platform
 #endif
 
 #if defined(VGA_x86)
index 3648de9c484d7ebd1f0a31f8144e0eb23bafc0b2..9ed8ec55a2ebaf31849281fa7afd66170ecf0509 100644 (file)
 #ifndef __PUB_TOOL_MACHINE_H
 #define __PUB_TOOL_MACHINE_H
 
-#if defined(VGA_x86)
+#if defined(VGP_x86_linux)
 #  define VG_MIN_INSTR_SZB          1  // min length of native instruction
 #  define VG_MAX_INSTR_SZB         16  // max length of native instruction
 #  define VG_CLREQ_SZB             14  // length of a client request, may
                                        //   be larger than VG_MAX_INSTR_SZB
 #  define VG_STACK_REDZONE_SZB      0  // number of addressable bytes below %RSP
-#elif defined(VGA_amd64)
+#elif defined(VGP_amd64_linux)
 #  define VG_MIN_INSTR_SZB          1
 #  define VG_MAX_INSTR_SZB         16
 #  define VG_CLREQ_SZB             19
 #  define VG_STACK_REDZONE_SZB    128
-#elif defined(VGA_ppc32)
+#elif defined(VGP_ppc32_linux)
 #  define VG_MIN_INSTR_SZB          4
 #  define VG_MAX_INSTR_SZB          4 
 #  define VG_CLREQ_SZB             20
 #  define VG_STACK_REDZONE_SZB      0
-#elif defined(VGA_ppc64)
+#elif defined(VGP_ppc64_linux)
 #  define VG_MIN_INSTR_SZB          4
 #  define VG_MAX_INSTR_SZB          4 
 #  define VG_CLREQ_SZB             20
 #  define VG_STACK_REDZONE_SZB    288  // number of addressable bytes below R1
                                        // from 64-bit PowerPC ELF ABI Supplement 1.7
+#elif defined(VGP_ppc32_aix5)
+#  define VG_MIN_INSTR_SZB          4
+#  define VG_MAX_INSTR_SZB          4 
+#  define VG_CLREQ_SZB             20
+   /* The PowerOpen ABI actually says 220 bytes, but that is not an
+      8-aligned number, and frequently forces Memcheck's
+      mc_{new,die}_mem_stack_N routines into slow cases by losing
+      8-alignment of the area to be messed with.  So let's just say
+      224 instead.  Gdb has a similar kludge. */
+#  define VG_STACK_REDZONE_SZB    224
+#elif defined(VGP_ppc64_aix5)
+#  define VG_MIN_INSTR_SZB          4
+#  define VG_MAX_INSTR_SZB          4 
+#  define VG_CLREQ_SZB             20
+#  define VG_STACK_REDZONE_SZB    288 // is this right?
 #else
-#  error Unknown arch
+#  error Unknown platform
 #endif
 
 // Guest state accessors