From: Julian Seward Date: Tue, 17 Oct 2006 01:35:58 +0000 (+0000) Subject: Merge r6127: Extend for AIX5. Nothing surprising here. X-Git-Tag: svn/VALGRIND_3_3_0~612 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49398acb254f4cf4b8d2adc103035fffc59a7241;p=thirdparty%2Fvalgrind.git Merge r6127: Extend for AIX5. Nothing surprising here. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6264 --- diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 357fbdbd5f..e0a2862825 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -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" diff --git a/coregrind/pub_core_machine.h b/coregrind/pub_core_machine.h index bfaecb024c..92ae69994c 100644 --- a/coregrind/pub_core_machine.h +++ b/coregrind/pub_core_machine.h @@ -39,24 +39,33 @@ #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) diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h index 3648de9c48..9ed8ec55a2 100644 --- a/include/pub_tool_machine.h +++ b/include/pub_tool_machine.h @@ -31,30 +31,45 @@ #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