From owner-freebsd-mips@FreeBSD.ORG Tue Feb 18 18:03:50 2014 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04DA1D1A for ; Tue, 18 Feb 2014 18:03:50 +0000 (UTC) Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.120]) by mx1.freebsd.org (Postfix) with ESMTP id BABAC125D for ; Tue, 18 Feb 2014 18:03:49 +0000 (UTC) X-Authority-Analysis: v=2.0 cv=IJCA+3TG c=1 sm=0 a=Hbpc8ax9VmIgqBixU/K2CA==:17 a=d-bOCm4-EcoA:10 a=dBRESv0yCI8A:10 a=ozSPa0bqj5AA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=KGjhK52YXX0A:10 a=vQhPNQlUBMQA:10 a=4EZ-VXWsCWC11jozTgwA:9 a=CjuIK1q_8ugA:10 a=Hbpc8ax9VmIgqBixU/K2CA==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 76.187.139.93 Received: from [76.187.139.93] ([76.187.139.93:63302] helo=[192.168.0.22]) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id C4/BD-26616-380A3035; Tue, 18 Feb 2014 18:03:47 +0000 From: Stacey Son Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [RFC] Enable use of UserLocal Register (ULRI) if detected (patches) Message-Id: Date: Tue, 18 Feb 2014 12:03:47 -0600 To: "freebsd-mips@freebsd.org" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Feb 2014 18:03:50 -0000 Hi all: Below are some links to patches that enables the use of the UserLocal = Register Implementation (ULRI) for the Thread Local Storage (TLS) = pointer. =20 The first code change is for the user level code to use the 'rdhwr $29' = instruction to retrieve the TLS pointer instead of using the = sysarch(MIPS_GET_TLS,...) system call. For hardware that supports this = instruction this should be much faster since it doesn't require the = overhead of a system call. For hardware that doesn't support this = instruction the 'rdhwr $29' instruction is emulated by the trap() = handler in sys/mips/mips/trap.c and the overhead should be about the = same. (Actually, some quick micro benchmarks indicate that emulating the = 'rdhwr' instruction is slightly faster than the sysarch() system call.) = For the patch, see:=20 http://people.freebsd.org/~sson/mips/ulri/ulri_user.diff The next code change probes for the UserLocal Register Implementation = (ULRI) and, if found, will enable it (or actually disable it if not = found) in the kernel code. sysarch(MIPS_SET_TLS,...) calls also update = the UserLocal register as well. For the patch, see: http://people.freebsd.org/~sson/mips/ulri/ulri_kernel.diff The final patch is for qemu system-mode that adds support for the ULRI: http://people.freebsd.org/~sson/mips/ulri/ulri_qemu.diff For more information about the ULRI see "MIPS Architecture for = Programmers Volume III" section 9.9 UserLocal Register (CP0 Register 4, = Select 2). Best Regards, -stacey.=