CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: rin Date: Mon Jun 22 06:49:04 UTC 2020 Modified Files: src/lib/libc/arch/powerpc/gen: _lwp.c Log Message: Turn on _UC_TLSBASE for sure in the same manner as other ports. No functional changes since that flag is turned on via getcontext(2). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/powerpc/gen/_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/powerpc/gen/_lwp.c diff -u src/lib/libc/arch/powerpc/gen/_lwp.c:1.7 src/lib/libc/arch/powerpc/gen/_lwp.c:1.8 --- src/lib/libc/arch/powerpc/gen/_lwp.c:1.7 Thu Mar 22 05:36:50 2012 +++ src/lib/libc/arch/powerpc/gen/_lwp.c Mon Jun 22 06:49:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: _lwp.c,v 1.7 2012/03/22 05:36:50 matt Exp $ */ +/* $NetBSD: _lwp.c,v 1.8 2020/06/22 06:49:04 rin Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -37,7 +37,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: _lwp.c,v 1.7 2012/03/22 05:36:50 matt Exp $"); +__RCSID("$NetBSD: _lwp.c,v 1.8 2020/06/22 06:49:04 rin Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" @@ -67,6 +67,8 @@ _lwp_makecontext(ucontext_t *u, void (*s u->uc_mcontext.__gregs[1] = sp;/* stack */ u->uc_mcontext.__gregs[33] = (uintptr_t) _lwp_exit; /* LR */ u->uc_mcontext.__gregs[34] = (uintptr_t) start; /* PC */ + u->uc_mcontext.__gregs[_REG_R2] = (uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb); + u->uc_flags |= _UC_TLSBASE; }
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: rin Date: Mon Jun 22 06:49:04 UTC 2020 Modified Files: src/lib/libc/arch/powerpc/gen: _lwp.c Log Message: Turn on _UC_TLSBASE for sure in the same manner as other ports. No functional changes since that flag is turned on via getcontext(2). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/powerpc/gen/_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: uwe Date: Wed Feb 28 20:51:58 UTC 2018 Modified Files: src/lib/libc/arch/powerpc/gen: swapcontext.S Log Message: PIC code clobbers %r30 so we need to update the saved oucp with caller's %r30 manually. Makes old context happy when it needs to do more function calls after restore. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/powerpc/gen/swapcontext.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: uwe Date: Wed Feb 28 20:51:58 UTC 2018 Modified Files: src/lib/libc/arch/powerpc/gen: swapcontext.S Log Message: PIC code clobbers %r30 so we need to update the saved oucp with caller's %r30 manually. Makes old context happy when it needs to do more function calls after restore. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/powerpc/gen/swapcontext.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/powerpc/gen/swapcontext.S diff -u src/lib/libc/arch/powerpc/gen/swapcontext.S:1.7 src/lib/libc/arch/powerpc/gen/swapcontext.S:1.8 --- src/lib/libc/arch/powerpc/gen/swapcontext.S:1.7 Thu Sep 12 15:36:15 2013 +++ src/lib/libc/arch/powerpc/gen/swapcontext.S Wed Feb 28 20:51:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: swapcontext.S,v 1.7 2013/09/12 15:36:15 joerg Exp $ */ +/* $NetBSD: swapcontext.S,v 1.8 2018/02/28 20:51:58 uwe Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "SYS.h" #include "assym.h" -__RCSID("$NetBSD: swapcontext.S,v 1.7 2013/09/12 15:36:15 joerg Exp $") +__RCSID("$NetBSD: swapcontext.S,v 1.8 2018/02/28 20:51:58 uwe Exp $") #define XCALLFRAMELEN (((2+3)*SZREG + CALLFRAMELEN - 1) & -CALLFRAMELEN) #define XCALLFRAME_R30 (XCALLFRAMELEN-1*SZREG) @@ -57,6 +57,10 @@ ENTRY(swapcontext) stw %r0,UC_GREGS_PC(%r11) # pc <- lr addi %r0,%r1,XCALLFRAMELEN stw %r0,UC_GREGS_R1(%r11) # adjust sp +#ifdef __PIC__ + lwz %r0,XCALLFRAME_R30(%r1) + stw %r0,UC_GREGS_R30(%r11) # caller's r30 +#endif lwz %r3,XCALLFRAME_UCP(%r1) # load ucp bl PIC_PLT(_C_LABEL(setcontext)) # setcontext(ucp) 1:
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: macallan Date: Tue Jan 28 13:47:04 UTC 2014 Modified Files: src/lib/libc/arch/powerpc/gen: Makefile.inc Added Files: src/lib/libc/arch/powerpc/gen: fabs_ieee754.S fabs_ieee754.c Removed Files: src/lib/libc/arch/powerpc/gen: fabs.c Log Message: split fabs.c into hardfloat .S and softfloat .c as requested by joerg To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libc/arch/powerpc/gen/Makefile.inc cvs rdiff -u -r1.4 -r0 src/lib/libc/arch/powerpc/gen/fabs.c cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/powerpc/gen/fabs_ieee754.S \ src/lib/libc/arch/powerpc/gen/fabs_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/powerpc/gen/Makefile.inc diff -u src/lib/libc/arch/powerpc/gen/Makefile.inc:1.25 src/lib/libc/arch/powerpc/gen/Makefile.inc:1.26 --- src/lib/libc/arch/powerpc/gen/Makefile.inc:1.25 Sat Mar 12 07:55:09 2011 +++ src/lib/libc/arch/powerpc/gen/Makefile.inc Tue Jan 28 13:47:04 2014 @@ -1,8 +1,8 @@ -# $NetBSD: Makefile.inc,v 1.25 2011/03/12 07:55:09 matt Exp $ +# $NetBSD: Makefile.inc,v 1.26 2014/01/28 13:47:04 macallan Exp $ SRCS+= __setjmp14.S __sigsetjmp14.S _setjmp.S SRCS+= bswap16.c bswap32.c bswap64.c -SRCS+= fabs.c flt_rounds.c +SRCS+= flt_rounds.c SRCS+= syncicache.c SRCS+= _lwp.c makecontext.c resumecontext.c swapcontext.S @@ -19,6 +19,9 @@ SRCS+= nanf.c .if (${MKSOFTFLOAT} == no) SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c SRCS+= fpgetsticky.c fpsetsticky.c +SRCS+= fabs_ieee754.S +.else +SRCS+= fabs_ieee754.c .endif CPPFLAGS._lwp.c += -D_LIBC_SOURCE Added files: Index: src/lib/libc/arch/powerpc/gen/fabs_ieee754.S diff -u /dev/null src/lib/libc/arch/powerpc/gen/fabs_ieee754.S:1.1 --- /dev/null Tue Jan 28 13:47:04 2014 +++ src/lib/libc/arch/powerpc/gen/fabs_ieee754.S Tue Jan 28 13:47:04 2014 @@ -0,0 +1,12 @@ +/* $NetBSD: fabs_ieee754.S,v 1.1 2014/01/28 13:47:04 macallan Exp $ */ + +#include machine/asm.h + +#if defined(LIBC_SCCS) +__RCSID($NetBSD: fabs_ieee754.S,v 1.1 2014/01/28 13:47:04 macallan Exp $) +#endif + +ENTRY(fabs) + fabs %f1,%f1 + blr +END(fabs) Index: src/lib/libc/arch/powerpc/gen/fabs_ieee754.c diff -u /dev/null src/lib/libc/arch/powerpc/gen/fabs_ieee754.c:1.1 --- /dev/null Tue Jan 28 13:47:04 2014 +++ src/lib/libc/arch/powerpc/gen/fabs_ieee754.c Tue Jan 28 13:47:04 2014 @@ -0,0 +1,11 @@ +/* $NetBSD: fabs_ieee754.c,v 1.1 2014/01/28 13:47:04 macallan Exp $ */ + +#include math.h + +double +fabs(double x) +{ + if (x 0) + x = -x; + return (x); +}
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: macallan Date: Tue Jan 28 14:10:39 UTC 2014 Removed Files: src/lib/libc/arch/powerpc/gen: fabs_ieee754.c Log Message: no need to duplicate the generic fabs_ieee754.c here To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/lib/libc/arch/powerpc/gen/fabs_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: macallan Date: Tue Jan 28 13:47:04 UTC 2014 Modified Files: src/lib/libc/arch/powerpc/gen: Makefile.inc Added Files: src/lib/libc/arch/powerpc/gen: fabs_ieee754.S fabs_ieee754.c Removed Files: src/lib/libc/arch/powerpc/gen: fabs.c Log Message: split fabs.c into hardfloat .S and softfloat .c as requested by joerg To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libc/arch/powerpc/gen/Makefile.inc cvs rdiff -u -r1.4 -r0 src/lib/libc/arch/powerpc/gen/fabs.c cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/powerpc/gen/fabs_ieee754.S \ src/lib/libc/arch/powerpc/gen/fabs_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: macallan Date: Tue Jan 28 14:10:39 UTC 2014 Removed Files: src/lib/libc/arch/powerpc/gen: fabs_ieee754.c Log Message: no need to duplicate the generic fabs_ieee754.c here To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/lib/libc/arch/powerpc/gen/fabs_ieee754.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: matt Date: Thu Mar 22 05:36:50 UTC 2012 Modified Files: src/lib/libc/arch/powerpc/gen: _lwp.c Log Message: Make lint happy. While here, make sure the top of stack is aligned properly. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/powerpc/gen/_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/powerpc/gen/_lwp.c diff -u src/lib/libc/arch/powerpc/gen/_lwp.c:1.6 src/lib/libc/arch/powerpc/gen/_lwp.c:1.7 --- src/lib/libc/arch/powerpc/gen/_lwp.c:1.6 Sat Mar 12 07:55:09 2011 +++ src/lib/libc/arch/powerpc/gen/_lwp.c Thu Mar 22 05:36:50 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: _lwp.c,v 1.6 2011/03/12 07:55:09 matt Exp $ */ +/* $NetBSD: _lwp.c,v 1.7 2012/03/22 05:36:50 matt Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -37,10 +37,11 @@ #include sys/cdefs.h #if defined(LIBC_SCCS) !defined(lint) -__RCSID($NetBSD: _lwp.c,v 1.6 2011/03/12 07:55:09 matt Exp $); +__RCSID($NetBSD: _lwp.c,v 1.7 2012/03/22 05:36:50 matt Exp $); #endif /* LIBC_SCCS and not lint */ #include namespace.h +#include sys/param.h #include sys/types.h #include ucontext.h #include lwp.h @@ -50,7 +51,7 @@ void _lwp_makecontext(ucontext_t *u, void (*start)(void *), void *arg, void *tcb, caddr_t stack_base, size_t stack_size) { - void **sp; + uintptr_t sp; getcontext(u); u-uc_link = NULL; @@ -58,12 +59,14 @@ _lwp_makecontext(ucontext_t *u, void (*s u-uc_stack.ss_sp = stack_base; u-uc_stack.ss_size = stack_size; - sp = (void **) (stack_base + stack_size); - - u-uc_mcontext.__gregs[3] = (int) arg; /* arg1 */ - u-uc_mcontext.__gregs[1] = ((int) sp) - 12; /* stack */ - u-uc_mcontext.__gregs[33] = (int) _lwp_exit; /* LR */ - u-uc_mcontext.__gregs[34] = (int) start; /* PC */ + sp = (uintptr_t)stack_base + stack_size; + sp -= STACK_ALIGNBYTES + 1; + sp = ~STACK_ALIGNBYTES; + + u-uc_mcontext.__gregs[3] = (uintptr_t) arg; /* arg1 */ + u-uc_mcontext.__gregs[1] = sp;/* stack */ + u-uc_mcontext.__gregs[33] = (uintptr_t) _lwp_exit; /* LR */ + u-uc_mcontext.__gregs[34] = (uintptr_t) start; /* PC */ u-uc_mcontext.__gregs[_REG_R2] = - (__greg_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb); + (uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb); }
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: matt Date: Thu Mar 22 05:36:50 UTC 2012 Modified Files: src/lib/libc/arch/powerpc/gen: _lwp.c Log Message: Make lint happy. While here, make sure the top of stack is aligned properly. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/powerpc/gen/_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: matt Date: Sun Jul 10 21:18:47 UTC 2011 Modified Files: src/lib/libc/arch/powerpc/gen: flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c fpsetround.c fpsetsticky.c Log Message: Don't use f with non-fp types. Use a union to go between double and uint64_t. Makes clang happy. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/powerpc/gen/flt_rounds.c \ src/lib/libc/arch/powerpc/gen/fpsetsticky.c cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/powerpc/gen/fpgetmask.c \ src/lib/libc/arch/powerpc/gen/fpgetround.c \ src/lib/libc/arch/powerpc/gen/fpgetsticky.c \ src/lib/libc/arch/powerpc/gen/fpsetmask.c \ src/lib/libc/arch/powerpc/gen/fpsetround.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/powerpc/gen/flt_rounds.c diff -u src/lib/libc/arch/powerpc/gen/flt_rounds.c:1.10 src/lib/libc/arch/powerpc/gen/flt_rounds.c:1.11 --- src/lib/libc/arch/powerpc/gen/flt_rounds.c:1.10 Sat Dec 24 23:10:08 2005 +++ src/lib/libc/arch/powerpc/gen/flt_rounds.c Sun Jul 10 21:18:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: flt_rounds.c,v 1.10 2005/12/24 23:10:08 perry Exp $ */ +/* $NetBSD: flt_rounds.c,v 1.11 2011/07/10 21:18:47 matt Exp $ */ /* * Copyright (c) 1996 Mark Brinicombe @@ -33,7 +33,7 @@ #include sys/cdefs.h #if defined(LIBC_SCCS) !defined(lint) -__RCSID($NetBSD: flt_rounds.c,v 1.10 2005/12/24 23:10:08 perry Exp $); +__RCSID($NetBSD: flt_rounds.c,v 1.11 2011/07/10 21:18:47 matt Exp $); #endif /* LIBC_SCCS and not lint */ #include ieeefp.h @@ -54,9 +54,12 @@ #ifdef _SOFT_FLOAT return map[fpgetround()]; #else - uint64_t fpscr; + union { + double u_d; + uint64_t u_fpscr; + } ud; - __asm volatile(mffs %0 : =f(fpscr)); - return map[((uint32_t)fpscr FPSCR_RN)]; + __asm volatile(mffs %0 : =f(ud.u_d)); + return map[((uint32_t)ud.u_fpscr FPSCR_RN)]; #endif } Index: src/lib/libc/arch/powerpc/gen/fpsetsticky.c diff -u src/lib/libc/arch/powerpc/gen/fpsetsticky.c:1.10 src/lib/libc/arch/powerpc/gen/fpsetsticky.c:1.11 --- src/lib/libc/arch/powerpc/gen/fpsetsticky.c:1.10 Mon Apr 28 20:22:57 2008 +++ src/lib/libc/arch/powerpc/gen/fpsetsticky.c Sun Jul 10 21:18:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fpsetsticky.c,v 1.10 2008/04/28 20:22:57 martin Exp $ */ +/* $NetBSD: fpsetsticky.c,v 1.11 2011/07/10 21:18:47 matt Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(LIBC_SCCS) !defined(lint) -__RCSID($NetBSD: fpsetsticky.c,v 1.10 2008/04/28 20:22:57 martin Exp $); +__RCSID($NetBSD: fpsetsticky.c,v 1.11 2011/07/10 21:18:47 matt Exp $); #endif /* LIBC_SCCS and not lint */ #include namespace.h @@ -53,32 +53,35 @@ fp_except fpsetsticky(fp_except mask) { - uint64_t fpscr; + union { + double u_d; + uint64_t u_fpscr; + } ud; fp_except old; - __asm volatile(mffs %0 : =f(fpscr)); - old = ((uint32_t)fpscr STICKYBITS) STICKYSHFT; + __asm volatile(mffs %0 : =f(ud.u_d)); + old = ((uint32_t)ud.u_fpscr STICKYBITS) STICKYSHFT; /* * FPSCR_VX (aka FP_X_INV) is not a sticky bit but a summary of the * all the FPSCR_VX* sticky bits. So when FP_X_INV is cleared then * clear all of those bits, likewise when it's set, set them all. */ if ((mask FP_X_INV) == 0) - fpscr = ~INVBITS; + ud.u_fpscr = ~INVBITS; else - fpscr |= INVBITS; - fpscr = ~STICKYBITS; - fpscr |= ((uint32_t)mask STICKYSHFT) STICKYBITS; + ud.u_fpscr |= INVBITS; + ud.u_fpscr = ~STICKYBITS; + ud.u_fpscr |= ((uint32_t)mask STICKYSHFT) STICKYBITS; /* * Make FPSCR_FX reflect the presence of a set sticky bit (or not). */ - if (fpscr (STICKYBITS|INVBITS)) - fpscr |= FPSCR_FX; + if (ud.u_fpscr (STICKYBITS|INVBITS)) + ud.u_fpscr |= FPSCR_FX; else - fpscr = ~FPSCR_FX; + ud.u_fpscr = ~FPSCR_FX; /* * Write back the fpscr. */ - __asm volatile(mtfsf 0xff,%0 :: f(fpscr)); + __asm volatile(mtfsf 0xff,%0 :: f(ud.u_d)); return (old); } Index: src/lib/libc/arch/powerpc/gen/fpgetmask.c diff -u src/lib/libc/arch/powerpc/gen/fpgetmask.c:1.9 src/lib/libc/arch/powerpc/gen/fpgetmask.c:1.10 --- src/lib/libc/arch/powerpc/gen/fpgetmask.c:1.9 Mon Apr 28 20:22:56 2008 +++ src/lib/libc/arch/powerpc/gen/fpgetmask.c Sun Jul 10 21:18:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: fpgetmask.c,v 1.9 2008/04/28 20:22:56 martin Exp $ */ +/* $NetBSD: fpgetmask.c,v 1.10 2011/07/10 21:18:47 matt Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #if defined(LIBC_SCCS) !defined(lint) -__RCSID($NetBSD: fpgetmask.c,v 1.9 2008/04/28 20:22:56 martin Exp $); +__RCSID($NetBSD: fpgetmask.c,v 1.10 2011/07/10 21:18:47 matt Exp $); #endif /* LIBC_SCCS and not lint */ #include namespace.h @@ -50,8 +50,11 @@ fp_except fpgetmask(void) { - uint64_t fpscr; + union { + double u_d; + uint64_t u_fpscr; + } ud;
CVS commit: src/lib/libc/arch/powerpc/gen
Module Name:src Committed By: matt Date: Sun Jul 10 21:18:47 UTC 2011 Modified Files: src/lib/libc/arch/powerpc/gen: flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c fpsetround.c fpsetsticky.c Log Message: Don't use f with non-fp types. Use a union to go between double and uint64_t. Makes clang happy. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/arch/powerpc/gen/flt_rounds.c \ src/lib/libc/arch/powerpc/gen/fpsetsticky.c cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/powerpc/gen/fpgetmask.c \ src/lib/libc/arch/powerpc/gen/fpgetround.c \ src/lib/libc/arch/powerpc/gen/fpgetsticky.c \ src/lib/libc/arch/powerpc/gen/fpsetmask.c \ src/lib/libc/arch/powerpc/gen/fpsetround.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.