Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/include Change _lwp_getprivate_fast to use a s...



details:   https://anonhg.NetBSD.org/src/rev/4d7dbb220405
branches:  trunk
changeset: 338464:4d7dbb220405
user:      matt <matt%NetBSD.org@localhost>
date:      Tue May 26 02:16:38 2015 +0000

description:
Change _lwp_getprivate_fast to use a syscall instead of rdhwr since rdhwr
emulation is problematic for the CN50xx.

diffstat:

 sys/arch/mips/include/mcontext.h |  26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diffs (43 lines):

diff -r f26d85aa1853 -r 4d7dbb220405 sys/arch/mips/include/mcontext.h
--- a/sys/arch/mips/include/mcontext.h  Tue May 26 02:09:34 2015 +0000
+++ b/sys/arch/mips/include/mcontext.h  Tue May 26 02:16:38 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mcontext.h,v 1.20 2012/09/12 15:09:49 matt Exp $       */
+/*     $NetBSD: mcontext.h,v 1.21 2015/05/26 02:16:38 matt Exp $       */
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -203,17 +203,25 @@
        /*
         * Only emit a rdhwr $3, $29 so the kernel can quickly emulate it.
         */
-       __asm __volatile(".set push; .set mips32r2; "
-               "rdhwr $3,$29; .set pop;"
-#ifdef __mips_o32
-               "addiu %[__tcb],$3,%1"
+       __asm __volatile(
+#if 1
+               // For some reason the syscall is much faster than
+               // emulating rdhwr $3,$29 on a CN50xx
+               "addiu $2,$0,316; syscall; nop; move %[__tcb],$2"
 #else
-               "daddiu %[__tcb],$3,%1"
+               ".set push"   
+               ";.set mips32r2"
+               ";.p2align 4"
+               ";ssnop"
+               ";rdhwr $3,$29"
+               ";ssnop"
+               ";move %0,$3"
+               ";.set pop"     
 #endif
            : [__tcb]"=r"(__tcb)
-           : [__offset]"n"(-(TLS_TP_OFFSET + sizeof(*__tcb)))
-           : "v1");
-       return __tcb;
+           :
+           : "v0", "v1", "a3");
+       return __tcb - (TLS_TP_OFFSET / sizeof(*__tcb) + 1);
 }
 
 void _lwp_setprivate(void *);



Home | Main Index | Thread Index | Old Index