From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 21 13:14:24 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A09916A4CE for ; Wed, 21 Jan 2004 13:14:24 -0800 (PST) Received: from hexagon.stack.nl (hexagon.stack.nl [131.155.140.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id 45CE743D45 for ; Wed, 21 Jan 2004 13:13:46 -0800 (PST) (envelope-from marcolz@stack.nl) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010:2e0:81ff:fe22:51d8]) by hexagon.stack.nl (Postfix) with ESMTP id 400EEB89#077DD50A2 for ; Wed, 21 Jan 2004 22:13:45 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 333) id D65DF1CC71; Wed, 21 Jan 2004 22:13:44 +0100 (CET) Date: Wed, 21 Jan 2004 22:13:44 +0100 From: Marc Olzheim To: hackers@freebsd.org Message-ID: <20040121211344.GA97203@stack.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline X-Operating-System: FreeBSD turtle.stack.nl 5.2-BETA FreeBSD 5.2-BETA X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.5.1i Subject: libc_r/uthread/uthread_create.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2004 21:14:24 -0000 --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline For debugging purposes would like to propose the following patch. The only thing besides from not knowing anything about other architectures than i386, is that I don't know exactly what happens when compiling with -fomit-frame-pointer Could someone tell me ? Marc --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pthread_ebp.patch" --- /usr/src/lib/libc_r/uthread/pthread_private.h Tue Jun 3 00:22:52 2003 +++ /usr/src/lib/libc_r/uthread/pthread_private.h Wed Jan 21 21:44:21 2004 @@ -86,7 +86,8 @@ fdata = (char *) (ucp)->uc_mcontext.mc_fpstate; \ __asm__("frstor %0": :"m"(*fdata)); \ } while (0) -#define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (int)(ra) +#define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (int)(ra) +#define SET_FRAME_PTR_JB(jb, fp) (jb)[0]._jb[3] = (int)(fp) #elif defined(__amd64__) #define GET_STACK_JB(jb) ((unsigned long)((jb)[0]._jb[2])) #define GET_STACK_SJB(sjb) ((unsigned long)((sjb)[0]._sjb[2])) @@ -105,6 +106,7 @@ __asm__("fxrstor %0": :"m"(*fdata)); \ } while (0) #define SET_RETURN_ADDR_JB(jb, ra) (jb)[0]._jb[0] = (long)(ra) +#define SET_FRAME_PTR_JB(jb, fp) #elif defined(__alpha__) #include #define GET_STACK_JB(jb) ((unsigned long)((jb)[0]._jb[R_SP + 4])) @@ -120,6 +122,7 @@ (jb)[0]._jb[R_RA + 4] = (long)(ra); \ (jb)[0]._jb[R_T12 + 4] = (long)(ra); \ } while (0) +#define SET_FRAME_PTR_JB(jb, fp) #elif defined(__ia64__) #define GET_BSP_JB(jb) (*((unsigned long*)JMPBUF_ADDR_OF(jb,J_BSP))) #define GET_STACK_JB(jb) (*((unsigned long*)JMPBUF_ADDR_OF(jb,J_SP))) @@ -136,6 +139,7 @@ GET_BSP_JB(jb) = (long)(stk); \ } while (0) #define UPD_STACK_JB(jb, stk) GET_STACK_JB(jb) = (long)(stk) +#define SET_FRAME_PTR_JB(jb, fp) #elif defined(__sparc64__) #include @@ -164,6 +168,7 @@ #define FP_RESTORE_UC(ucp) /* XXX */ #define SET_RETURN_ADDR_JB(jb, ra) \ (jb)[0]._jb[_JB_PC] = (long)(ra) - 8 +#define SET_FRAME_PTR_JB(jb, fp) #else #error "Don't recognize this architecture!" #endif --- /usr/src/lib/libc_r/uthread/uthread_create.c Wed Dec 3 07:54:40 2003 +++ /usr/src/lib/libc_r/uthread/uthread_create.c Wed Jan 21 04:01:31 2004 @@ -146,6 +146,7 @@ * _thread_start(). */ SET_RETURN_ADDR_JB(new_thread->ctx.jb, _thread_start); + SET_FRAME_PTR_JB(new_thread->ctx.jb, NULL); #if !defined(__ia64__) stackp = (long)new_thread->stack + pattr->stacksize_attr - sizeof(double); --4Ckj6UjgE2iN1+kY--