From 9a7009c496e0b8faef298cc7063545692ae3ba3f Mon Sep 17 00:00:00 2001 From: Lijuan Xiao Date: Tue, 15 May 2012 18:58:42 +0800 Subject: Fix profiling functionality provided by V8 for x86 Change-Id: I0af645b60f7aa90472ff9c9ddff6b3b2df92e914 Signed-off-by: Lijuan Xiao --- src/platform-linux.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/platform-linux.cc b/src/platform-linux.cc index 474c5406..39633a24 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -808,7 +808,7 @@ Semaphore* OS::CreateSemaphore(int count) { #ifdef ENABLE_LOGGING_AND_PROFILING -#if !defined(__GLIBC__) && (defined(__arm__) || defined(__thumb__) || defined(__i386__)) +#if !defined(__GLIBC__) && (defined(__arm__) || defined(__thumb__)) // Android runs a fairly new Linux kernel, so signal info is there, // but the C library doesn't have the structs defined. @@ -830,10 +830,27 @@ typedef struct ucontext { __sigset_t uc_sigmask; } ucontext_t; enum ArmRegisters {R15 = 15, R13 = 13, R11 = 11}; -enum X86Registers {REG_EIP = 14, REG_ESP = 7, REG_EBP = 6}; -#endif +#elif !defined(__GLIBC__) && defined(__i386__) +// x86 version for Android. +struct sigcontext { + uint32_t gregs[19]; + void* fpregs; + uint32_t oldmask; + uint32_t cr2; +}; +typedef uint32_t __sigset_t; +typedef struct sigcontext mcontext_t; +typedef struct ucontext { + uint32_t uc_flags; + struct ucontext* uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; +} ucontext_t; +enum { REG_EBP = 6, REG_ESP = 7, REG_EIP = 14 }; +#endif static int GetThreadID() { // Glibc doesn't provide a wrapper for gettid(2). -- cgit v1.2.3