diff options
author | Kostya Serebryany <kcc@google.com> | 2012-11-20 07:00:42 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-11-20 07:00:42 +0000 |
commit | d7d4650dd754aafc874e3b8cd5ab5b38005c84ec (patch) | |
tree | 50c7f1ca4725693f6cd29cdb416d1eaa80e7e71c /lib/asan | |
parent | 031633bef8dff03f4e8943a12e34856bd66bbc78 (diff) |
[asan] more support for powerpc, patch by Peter Bergner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@168356 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r-- | lib/asan/asan_linux.cc | 9 | ||||
-rw-r--r-- | lib/asan/asan_mapping.h | 10 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc index 1f46f268c..740bf5e7c 100644 --- a/lib/asan/asan_linux.cc +++ b/lib/asan/asan_linux.cc @@ -68,6 +68,13 @@ void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { *pc = ucontext->uc_mcontext.gregs[REG_EIP]; *bp = ucontext->uc_mcontext.gregs[REG_EBP]; *sp = ucontext->uc_mcontext.gregs[REG_ESP]; +# elif defined(__powerpc__) || defined(__powerpc64__) + ucontext_t *ucontext = (ucontext_t*)context; + *pc = ucontext->uc_mcontext.regs->nip; + *sp = ucontext->uc_mcontext.regs->gpr[PT_R1]; + // The powerpc{,64}-linux ABIs do not specify r31 as the frame + // pointer, but GCC always uses r31 when we need a frame pointer. + *bp = ucontext->uc_mcontext.regs->gpr[PT_R31]; # elif defined(__sparc__) ucontext_t *ucontext = (ucontext_t*)context; uptr *stk_ptr; @@ -151,7 +158,7 @@ void GetStackTrace(StackTrace *stack, uptr max_s, uptr pc, uptr bp) { stack->trace[0] = pc; if ((max_s) > 1) { stack->max_size = max_s; -#ifdef __arm__ +#if defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__) _Unwind_Backtrace(Unwind_Trace, stack); #else if (!asan_inited) return; diff --git a/lib/asan/asan_mapping.h b/lib/asan/asan_mapping.h index 40e32206d..8480bcfd4 100644 --- a/lib/asan/asan_mapping.h +++ b/lib/asan/asan_mapping.h @@ -33,7 +33,11 @@ extern __attribute__((visibility("default"))) uptr __asan_mapping_offset; # if __WORDSIZE == 32 # define SHADOW_OFFSET (1 << 29) # else -# define SHADOW_OFFSET (1ULL << 44) +# if defined(__powerpc64__) +# define SHADOW_OFFSET (1ULL << 41) +# else +# define SHADOW_OFFSET (1ULL << 44) +# endif # endif # endif #endif // ASAN_FLEXIBLE_MAPPING_AND_OFFSET @@ -43,7 +47,11 @@ extern __attribute__((visibility("default"))) uptr __asan_mapping_offset; #define SHADOW_TO_MEM(shadow) (((shadow) - SHADOW_OFFSET) << SHADOW_SCALE) #if __WORDSIZE == 64 +# if defined(__powerpc64__) + static const uptr kHighMemEnd = 0x00000fffffffffffUL; +# else static const uptr kHighMemEnd = 0x00007fffffffffffUL; +# endif #else // __WORDSIZE == 32 static const uptr kHighMemEnd = 0xffffffff; #endif // __WORDSIZE |