Date: Tue, 4 Jun 2013 05:07:03 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251365 - in stable/9: lib/libc/amd64/gen lib/libc/arm/gen lib/libc/gen lib/libc/i386/gen lib/libc/ia64/gen lib/libc/mips/gen lib/libc/powerpc/gen lib/libc/powerpc64/gen lib/libc/sparc6... Message-ID: <201306040507.r54573iV033621@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Jun 4 05:07:03 2013 New Revision: 251365 URL: http://svnweb.freebsd.org/changeset/base/251365 Log: MFC r251047: Avoid a nested frame for getcontext() call in check_deferred_signal(). Modified: stable/9/lib/libc/amd64/gen/getcontextx.c stable/9/lib/libc/arm/gen/getcontextx.c stable/9/lib/libc/gen/Symbol.map stable/9/lib/libc/i386/gen/getcontextx.c stable/9/lib/libc/ia64/gen/getcontextx.c stable/9/lib/libc/mips/gen/getcontextx.c stable/9/lib/libc/powerpc/gen/getcontextx.c stable/9/lib/libc/powerpc64/gen/getcontextx.c stable/9/lib/libc/sparc64/gen/getcontextx.c stable/9/lib/libthr/thread/thr_sig.c stable/9/sys/sys/ucontext.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libthr/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/lib/libc/amd64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/amd64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/amd64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -57,14 +57,12 @@ __getcontextx_size(void) } int -__fillcontextx(char *ctx) +__fillcontextx2(char *ctx) { struct amd64_get_xfpustate xfpu; ucontext_t *ucp; ucp = (ucontext_t *)ctx; - if (getcontext(ucp) == -1) - return (-1); if (xstate_sz != 0) { xfpu.addr = (char *)(ucp + 1); xfpu.len = xstate_sz; @@ -80,6 +78,18 @@ __fillcontextx(char *ctx) return (0); } +int +__fillcontextx(char *ctx) +{ + ucontext_t *ucp; + + ucp = (ucontext_t *)ctx; + if (getcontext(ucp) == -1) + return (-1); + __fillcontextx2(ctx); + return (0); +} + __weak_reference(__getcontextx, getcontextx); ucontext_t * Modified: stable/9/lib/libc/arm/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/arm/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/arm/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/gen/Symbol.map ============================================================================== --- stable/9/lib/libc/gen/Symbol.map Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/gen/Symbol.map Tue Jun 4 05:07:03 2013 (r251365) @@ -526,5 +526,6 @@ FBSDprivate_1.0 { __elf_aux_vector; __pthread_map_stacks_exec; __fillcontextx; + __fillcontextx2; __getcontextx_size; }; Modified: stable/9/lib/libc/i386/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/i386/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/i386/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -89,14 +89,12 @@ __getcontextx_size(void) } int -__fillcontextx(char *ctx) +__fillcontextx2(char *ctx) { struct i386_get_xfpustate xfpu; ucontext_t *ucp; ucp = (ucontext_t *)ctx; - if (getcontext(ucp) == -1) - return (-1); if (xstate_sz != 0) { xfpu.addr = (char *)(ucp + 1); xfpu.len = xstate_sz; @@ -112,6 +110,18 @@ __fillcontextx(char *ctx) return (0); } +int +__fillcontextx(char *ctx) +{ + ucontext_t *ucp; + + ucp = (ucontext_t *)ctx; + if (getcontext(ucp) == -1) + return (-1); + __fillcontextx2(ctx); + return (0); +} + __weak_reference(__getcontextx, getcontextx); ucontext_t * Modified: stable/9/lib/libc/ia64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/ia64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/ia64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/mips/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/mips/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/mips/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/powerpc/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/powerpc/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/powerpc/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/powerpc64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/powerpc64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/powerpc64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libc/sparc64/gen/getcontextx.c ============================================================================== --- stable/9/lib/libc/sparc64/gen/getcontextx.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libc/sparc64/gen/getcontextx.c Tue Jun 4 05:07:03 2013 (r251365) @@ -40,6 +40,13 @@ __getcontextx_size(void) } int +__fillcontextx2(char *ctx) +{ + + return (0); +} + +int __fillcontextx(char *ctx) { ucontext_t *ucp; Modified: stable/9/lib/libthr/thread/thr_sig.c ============================================================================== --- stable/9/lib/libthr/thread/thr_sig.c Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/lib/libthr/thread/thr_sig.c Tue Jun 4 05:07:03 2013 (r251365) @@ -323,8 +323,13 @@ check_deferred_signal(struct pthread *cu return; #if defined(__amd64__) || defined(__i386__) - uc = alloca(__getcontextx_size()); - __fillcontextx((char *)uc); + int uc_len; + uc_len = __getcontextx_size(); + uc = alloca(uc_len); + getcontext(uc); + if (curthread->deferred_siginfo.si_signo == 0) + return; + __fillcontextx2((char *)uc); #else ucontext_t ucv; uc = &ucv; Modified: stable/9/sys/sys/ucontext.h ============================================================================== --- stable/9/sys/sys/ucontext.h Tue Jun 4 03:47:21 2013 (r251364) +++ stable/9/sys/sys/ucontext.h Tue Jun 4 05:07:03 2013 (r251365) @@ -80,7 +80,8 @@ int swapcontext(ucontext_t *, const ucon #if __BSD_VISIBLE int __getcontextx_size(void); -int __fillcontextx(char *ctx); +int __fillcontextx(char *ctx) __returns_twice; +int __fillcontextx2(char *ctx); #endif __END_DECLS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306040507.r54573iV033621>