|
From: <sv...@va...> - 2006-10-01 17:57:15
|
Author: sewardj
Date: 2006-10-01 18:57:12 +0100 (Sun, 01 Oct 2006)
New Revision: 6127
Log:
Extend for AIX. Nothing surprising here.
Modified:
branches/AIX5/coregrind/m_machine.c
branches/AIX5/coregrind/pub_core_machine.h
branches/AIX5/include/pub_tool_machine.h
Modified: branches/AIX5/coregrind/m_machine.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_machine.c 2006-10-01 17:49:33 UTC (rev 6126=
)
+++ branches/AIX5/coregrind/m_machine.c 2006-10-01 17:57:12 UTC (rev 6127=
)
@@ -29,6 +29,7 @@
*/
=20
#include "pub_core_basics.h"
+#include "pub_core_vki.h"
#include "pub_core_threadstate.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcbase.h"
@@ -369,7 +370,7 @@
if (__builtin_setjmp(env_sigill)) {
have_F =3D False;
} else {
- __asm__ __volatile__("fmr 0,0");
+ __asm__ __volatile__(".long 0xFC000090"); /*fmr 0,0 */
}
=20
/* Altivec insns */
@@ -396,7 +397,7 @@
if (__builtin_setjmp(env_sigill)) {
have_FX =3D False;
} else {
- __asm__ __volatile__("fsqrt 0,0");
+ __asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0 */
}
=20
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
@@ -407,7 +408,7 @@
if (__builtin_setjmp(env_sigill)) {
have_GX =3D False;
} else {
- __asm__ __volatile__("frsqrte 0,0");
+ __asm__ __volatile__(".long 0xFC000034"); /* frsqrte 0,0 */
}
=20
r =3D VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
@@ -481,7 +482,7 @@
if (__builtin_setjmp(env_sigill)) {
have_V =3D False;
} else {
- __asm__ __volatile__("vor 0,0,0");
+ __asm__ __volatile__(".long 0x10000484"); /*vor 0,0,0*/
}
=20
/* General-Purpose optional (fsqrt, fsqrts) */
@@ -491,7 +492,7 @@
if (__builtin_setjmp(env_sigill)) {
have_FX =3D False;
} else {
- __asm__ __volatile__("fsqrt 0,0");
+ __asm__ __volatile__(".long 0xFC00002C"); /*fsqrt 0,0*/
}
=20
/* Graphics optional (stfiwx, fres, frsqrte, fsel) */
@@ -501,7 +502,7 @@
if (__builtin_setjmp(env_sigill)) {
have_GX =3D False;
} else {
- __asm__ __volatile__("frsqrte 0,0");
+ __asm__ __volatile__(".long 0xFC000034"); /*frsqrte 0,0*/
}
=20
VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
@@ -581,22 +582,18 @@
=20
=20
// 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)
+#if defined(VGP_x86_linux) || defined(VGP_amd64_linux) \
+ || defined(VGP_ppc32_linux)
return f;
-#elif defined(VGP_amd64_linux)
- return f;
-#elif 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 =3D (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 =3D (UWord*)f;
return (void*)(descr[0]);
#else
# error "Unknown platform"
Modified: branches/AIX5/coregrind/pub_core_machine.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/pub_core_machine.h 2006-10-01 17:49:33 UTC (r=
ev 6126)
+++ branches/AIX5/coregrind/pub_core_machine.h 2006-10-01 17:57:12 UTC (r=
ev 6127)
@@ -39,24 +39,33 @@
=20
#include "pub_tool_machine.h"
=20
-#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
=20
#if defined(VGA_x86)
Modified: branches/AIX5/include/pub_tool_machine.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/include/pub_tool_machine.h 2006-10-01 17:49:33 UTC (rev=
6126)
+++ branches/AIX5/include/pub_tool_machine.h 2006-10-01 17:57:12 UTC (rev=
6127)
@@ -31,30 +31,45 @@
#ifndef __PUB_TOOL_MACHINE_H
#define __PUB_TOOL_MACHINE_H
=20
-#if defined(VGA_x86)
+#if defined(VGP_x86_linux)
# define VG_MIN_INSTR_SZB 1 // min length of native instructi=
on
# define VG_MAX_INSTR_SZB 16 // max length of native instructi=
on
# define VG_CLREQ_SZB 14 // length of a client request, ma=
y
// be larger than VG_MAX_INSTR_=
SZB
# define VG_STACK_REDZONE_SZB 0 // number of addressable bytes be=
low %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=20
# 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=20
# define VG_CLREQ_SZB 20
# define VG_STACK_REDZONE_SZB 288 // number of addressable bytes be=
low R1
// from 64-bit PowerPC ELF ABI Su=
pplement 1.7
+#elif defined(VGP_ppc32_aix5)
+# define VG_MIN_INSTR_SZB 4
+# define VG_MAX_INSTR_SZB 4=20
+# 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=20
+# define VG_CLREQ_SZB 20
+# define VG_STACK_REDZONE_SZB 288 // is this right?
#else
-# error Unknown arch
+# error Unknown platform
#endif
=20
// Guest state accessors
|