Module Name: src Committed By: matt Date: Tue May 26 02:16:38 UTC 2015
Modified Files: src/sys/arch/mips/include: mcontext.h Log Message: Change _lwp_getprivate_fast to use a syscall instead of rdhwr since rdhwr emulation is problematic for the CN50xx. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/include/mcontext.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/include/mcontext.h diff -u src/sys/arch/mips/include/mcontext.h:1.20 src/sys/arch/mips/include/mcontext.h:1.21 --- src/sys/arch/mips/include/mcontext.h:1.20 Wed Sep 12 15:09:49 2012 +++ src/sys/arch/mips/include/mcontext.h Tue May 26 02:16:38 2015 @@ -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 @@ __lwp_gettcb_fast(void) /* * 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 *);